Re: failed to open file (schemas/gschemas.compiled not found)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Tue, 28 Mar 2017 13:19:29 -0000
schrieb "Martin Gansser" <martinkg@xxxxxxxxxxxxxxxxx>:

> I am working on a review of gnome-shell-extension-netspeed
> (https://bugzilla.redhat.com/show_bug.cgi?id=1377631). Upstream
> Ticket: https://github.com/hedayaty/NetSpeed/issues/56 I'm using the
> latest version of NetSpeed from the extensions website, with GNOME
> 3.22, on Fedora 25 Workstation x86_64. 
> 
> I get the following error message when running the Preferences dialog
> of gnome-tweak-tool or gnome-shell-extension-prefs:
> 
> GLib.FileError: Failed to open file
> '/usr/share/gnome-shell/extensions/netspeed@xxxxxxxxxxxxxxxxxx/schemas/gschemas.compiled':
> open() failed: No such file or directory
> 
> Stack trace:
>   @/usr/share/gnome-shell/extensions/netspeed@xxxxxxxxxxxxxxxxxx/prefs.js:31
>   Application<._getExtensionPrefsModule@resource:///org/gnome/shell/extensionPrefs/main.js:74
>   wrapper@resource:///org/gnome/gjs/modules/lang.js:178
>   Application<._selectExtension@resource:///org/gnome/shell/extensionPrefs/main.js:89
>   wrapper@resource:///org/gnome/gjs/modules/lang.js:178
>   Application<._onCommandLine@resource:///org/gnome/shell/extensionPrefs/main.js:239
>   wrapper@resource:///org/gnome/gjs/modules/lang.js:178
>   main@resource:///org/gnome/shell/extensionPrefs/main.js:377
>   @<main>:1
> 
> 
> Does anyone have an idea, how to fix this ?

The attached patch fixes the issue and should work with local and
global installation.
It first checks for the local path and uses it, if it exists, otherwise
uses the global path.
It does not really look good, but I tried to make just a minimal
change.

Jens
--- a/prefs.js	2017-03-28 22:42:21.070687232 +0200
+++ b/prefs.js	2017-03-28 22:42:34.680952138 +0200
@@ -27,8 +27,10 @@
 const NetworkManager = imports.gi.NetworkManager;
 const _ = Gettext.domain('netspeed').gettext;
 
-let schemaDir = Extension.dir.get_child('schemas').get_path();
-let schemaSource = Gio.SettingsSchemaSource.new_from_directory(schemaDir, Gio.SettingsSchemaSource.get_default(), false);
+let schemaDir = Extension.dir.get_child('schemas');
+let schemaSource = schemaDir.query_exists(null)?
+                    Gio.SettingsSchemaSource.new_from_directory(schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false):
+                    Gio.SettingsSchemaSource.get_default();
 let schema = schemaSource.lookup('org.gnome.shell.extensions.netspeed', false);
 let Schema = new Gio.Settings({ settings_schema: schema });
 
--- a/net_speed.js	2017-03-28 22:50:13.212931817 +0200
+++ b/net_speed.js	2017-03-28 22:50:57.355800047 +0200
@@ -302,12 +302,10 @@
         this._devices = new Array();
         this._client = NMC.Client.new();
 
-        let schemaDir = Extension.dir.get_child('schemas').get_path();
-        let schemaSource = Gio.SettingsSchemaSource.new_from_directory(
-            schemaDir,
-            Gio.SettingsSchemaSource.get_default(),
-            false
-        );
+        let schemaDir = Extension.dir.get_child('schemas');
+        let schemaSource = schemaDir.query_exists(null)?
+                            Gio.SettingsSchemaSource.new_from_directory(schemaDir.get_path(), Gio.SettingsSchemaSource.get_default(), false):
+                            Gio.SettingsSchemaSource.get_default();
         let schema = schemaSource.lookup('org.gnome.shell.extensions.netspeed', false);
         this._setting = new Gio.Settings({ settings_schema: schema });
         this._saving = 0;

Attachment: pgp2nK0I4FI_H.pgp
Description: Digitale Signatur von OpenPGP

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux