From 63af29354630aeab2b21508cb4479c2b973a39e2 Mon Sep 17 00:00:00 2001 From: ecyrbe Date: Fri, 27 May 2011 14:36:16 +0200 Subject: [PATCH] Check schema before loading it GLib Gsettings is broken and abort the entire gnome-shell when trying to load an unknown schema, so we have to check for the schema availability before loading it. --- src/extension.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/extension.js b/src/extension.js index a7150cd..f462667 100644 --- a/src/extension.js +++ b/src/extension.js @@ -65,16 +65,17 @@ WeatherMenuButton.prototype = { __proto__: PanelMenu.Button.prototype, _init: function() { - // Load Settings - this._settings = new Gio.Settings({ schema: WEATHER_SETTINGS_SCHEMA }); - if(this._settings==null){ + //check for the schemas before loading + if(!this.has_schema(WEATHER_SETTINGS_SCHEMA)){ global.log('xml weather schemas not installed'); return; } + // Load Settings + this._settings = new Gio.Settings({ schema: WEATHER_SETTINGS_SCHEMA }); this._units = this._settings.get_enum(WEATHER_UNIT_KEY); this._city = this._settings.get_string(WEATHER_CITY_KEY); this._woeid = this._settings.get_string(WEATHER_WOEID_KEY); - + // Panel icon this._weatherIcon = new St.Icon({ icon_type: St.IconType.SYMBOLIC, @@ -132,6 +133,16 @@ WeatherMenuButton.prototype = { }, + has_schema: function(schema){ + let schemas = Gio.Settings.list_schemas(); + for(let i=0;i