After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664472 - gsettings: Add API so that extensions can use gsettings without crashing
gsettings: Add API so that extensions can use gsettings without crashing
Status: RESOLVED INVALID
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 663903 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-11-21 14:02 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-04-25 21:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gsettings: Add API so that extensions can use gsettings without crashing (2.30 KB, patch)
2011-11-21 14:02 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2011-11-21 14:02:06 UTC
See patch.
Comment 1 Jasper St. Pierre (not reading bugmail) 2011-11-21 14:02:08 UTC
Created attachment 201813 [details] [review]
gsettings: Add API so that extensions can use gsettings without crashing
Comment 2 Giovanni Campagna 2011-11-21 14:53:49 UTC
Review of attachment 201813 [details] [review]:

Overall, pretty nice, and would surely help!

::: js/ui/extensionSystem.js
@@ +300,3 @@
+function _compileSchema(dir) {
+    let argv = ['glib-compile-schemas', '--targetdir', dir.get_path(), dir.get_path()];
+    GLib.spawn_sync(null, argv, null, GLib.SpawnFlags.SEARCH_PATH, null, null);

You should probably catch exceptions here.

@@ +307,3 @@
+        let schema = meta.schemaSource.lookup(schemaId, true);
+        if (!schema) {
+            throw new Error(meta.uuid, 'Settings schema \'%s\' cannot be found'.format(schemaId));

Error constructor accepts only one argument. In any case, meta.uuid would be inferred by the try/catch handling the exception and logging the error.

@@ +413,3 @@
+        _compileSchema(dir);
+
+    let parentSchemaSource = Gio.SettingsSchemaSource.get_default();

Unused variable
Comment 3 Giovanni Campagna 2011-11-21 14:54:25 UTC
Review of attachment 201813 [details] [review]:

Overall, pretty nice, and would surely help!

::: js/ui/extensionSystem.js
@@ +300,3 @@
+function _compileSchema(dir) {
+    let argv = ['glib-compile-schemas', '--targetdir', dir.get_path(), dir.get_path()];
+    GLib.spawn_sync(null, argv, null, GLib.SpawnFlags.SEARCH_PATH, null, null);

You should probably catch exceptions here.

@@ +307,3 @@
+        let schema = meta.schemaSource.lookup(schemaId, true);
+        if (!schema) {
+            throw new Error(meta.uuid, 'Settings schema \'%s\' cannot be found'.format(schemaId));

Error constructor accepts only one argument. In any case, meta.uuid would be inferred by the try/catch handling the exception and logging the error.

@@ +413,3 @@
+        _compileSchema(dir);
+
+    let parentSchemaSource = Gio.SettingsSchemaSource.get_default();

Unused variable
Comment 4 Jasper St. Pierre (not reading bugmail) 2011-11-28 20:39:59 UTC
*** Bug 663903 has been marked as a duplicate of this bug. ***
Comment 5 Jasper St. Pierre (not reading bugmail) 2011-11-28 20:42:19 UTC
(In reply to comment #3)
> Review of attachment 201813 [details] [review]:
> 
> Overall, pretty nice, and would surely help!
> 
> ::: js/ui/extensionSystem.js
> @@ +300,3 @@
> +function _compileSchema(dir) {
> +    let argv = ['glib-compile-schemas', '--targetdir', dir.get_path(),
> dir.get_path()];
> +    GLib.spawn_sync(null, argv, null, GLib.SpawnFlags.SEARCH_PATH, null,
> null);
> 
> You should probably catch exceptions here.

What exceptions could there be?
Comment 6 Giovanni Campagna 2012-02-06 15:55:06 UTC
Is this still relevant (considering the new extension preferences stuff)?

In any case, exceptions could arise from not finding the executable in path or not being able to run it. Both are unlikely cases, but worth at least a warning anyway.
Comment 7 Jasper St. Pierre (not reading bugmail) 2012-02-06 17:03:25 UTC
(In reply to comment #6)
> Is this still relevant (considering the new extension preferences stuff)?

It probably is. We could just have people copy your convenience.js, but that isn't very friendly. I'll attach a new patch rebased on top of the (yet unlanded) prefs stuff.

> In any case, exceptions could arise from not finding the executable in path or
> not being able to run it. Both are unlikely cases, but worth at least a warning
> anyway.

If glib-compile-schemas isn't in PATH, we really should be crashing.
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-04-25 21:58:42 UTC
Not relevant any more.