From f546b615e9ea5a71464c1a18e4da8baf40b655cd Mon Sep 17 00:00:00 2001 From: Neroth Date: Mon, 11 Mar 2013 00:47:31 +0100 Subject: [PATCH] Fix bug --- Makefile.am | 45 +++++++++++++++++++++++++++------------------ src/extension.js | 26 ++++++++++---------------- src/prefs.js | 5 +---- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2daa9bb..680fafd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,28 +2,37 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = src data po +uuid = "weather-extension@xeked.com" + +localprefix = $(HOME)/.local/share/gnome-shell/extensions + zip-file: all -if LOCAL_INSTALL - -rm -fR $(builddir)/_build + rm -fR $(builddir)/_build + rm -fR $(builddir)/zip-file $(MKDIR_P) $(builddir)/_build; \ + $(MKDIR_P) $(builddir)/zip-file; \ $(MAKE) install DESTDIR="$(abs_builddir)/_build"; \ - $(GLIB_COMPILE_SCHEMAS) "$(abs_builddir)/_build/$(prefix)/share/gnome-shell/extensions/weather@gnome-shell-extensions.gnome.org/schemas"; \ - (cd "$(abs_builddir)/_build/$(prefix)/share/gnome-shell/extensions/weather@gnome-shell-extensions.gnome.org" ; \ - zip -qr "$(abs_builddir)/gnome-shell-extension-weather.zip" .; \ + cp -r "$(builddir)/_build$(datadir)/gnome-shell/extensions/$(uuid)" "$(builddir)/_build"; \ + if [ -f "$(builddir)/_build$(datadir)/glib-2.0/schemas/org.gnome.shell.extensions.weather.gschema.xml" ]; then \ + $(MKDIR_P) "$(builddir)/_build/$(uuid)/schemas"; \ + mv "$(builddir)/_build$(datadir)/glib-2.0/schemas/org.gnome.shell.extensions.weather.gschema.xml" "$(builddir)/_build/$(uuid)/schemas"; \ + glib-compile-schemas "$(builddir)/_build/$(uuid)/schemas"; \ + fi; \ + cp -r "$(builddir)/_build$(datadir)/locale" "$(builddir)/_build/$(uuid)"; \ + (cd "$(builddir)/_build/$(uuid)/"; \ + zip -qr "$(abs_builddir)/zip-file/weather.shell-extension.zip" .; \ ); \ - rm -fR $(builddir)/_build ; \ - echo "===================================================================" ; \ - echo "zip-file ready for distribution:" ; \ - echo "gnome-shell-extension-weather.zip" ; \ - echo "===================================================================" -else - @echo "*" - @echo "* You need to configure the package --with-local-install=yes to create a zip-file." - @echo "*" -endif - -clean-local: - rm -f "$(abs_builddir)/gnome-shell-extension-weather.zip" + rm -fR $(builddir)/_build + +local-install: zip-file + zip_file="$(abs_builddir)/zip-file/weather.shell-extension.zip"; \ + if [ -d "$(localprefix)/$(uuid)" ]; then \ + rm -fR "$(localprefix)/$(uuid)"; \ + fi; \ + $(MKDIR_P) $(localprefix)/$(uuid); \ + (cd $(localprefix)/$(uuid); \ + unzip -q $${zip_file}; \ + ); dist-hook: dist-changelog diff --git a/src/extension.js b/src/extension.js index 1bb3251..b857e26 100644 --- a/src/extension.js +++ b/src/extension.js @@ -32,6 +32,9 @@ * */ +const ExtensionUtils = imports.misc.extensionUtils; +const Me = ExtensionUtils.getCurrentExtension(); +const Convenience = Me.imports.convenience; const Cairo = imports.cairo; const Clutter = imports.gi.Clutter; const Gettext = imports.gettext.domain('gnome-shell-extension-weather'); @@ -224,30 +227,21 @@ const WeatherMenuButton = new Lang.Class({ this.refreshWeather(true); }, - stopConnect : function() - { - this._settings.disconnect(this._settingsC); - this._settingsInterface.disconnect(this._settingsInterfaceC); - }, - loadConfig : function() { - var that = this; - var schema = WEATHER_SETTINGS_SCHEMA; - if (Gio.Settings.list_schemas().indexOf(schema) == -1) - throw _("Schema \"%s\" not found.").replace("%s",schema); - this._settings = new Gio.Settings({ schema: schema }); - this._settingsC = this._settings.connect("changed",function(){that.refreshWeather(false);}); + let that = this; + this._settings = Convenience.getSettings(WEATHER_SETTINGS_SCHEMA); + this._settings.connect("changed",function(){that.refreshWeather(false);}); }, loadConfigInterface : function() { - var that = this; - var schemaInterface = "org.gnome.desktop.interface"; + let that = this; + let schemaInterface = "org.gnome.desktop.interface"; if (Gio.Settings.list_schemas().indexOf(schemaInterface) == -1) throw _("Schema \"%s\" not found.").replace("%s",schemaInterface); this._settingsInterface = new Gio.Settings({ schema: schemaInterface }); - this._settingsInterfaceC = this._settingsInterface.connect("changed",function(){that.refreshWeather(false);}); + this._settingsInterface.connect("changed",function(){that.refreshWeather(false);}); }, get _clockFormat() @@ -1525,6 +1519,7 @@ const WeatherMenuButton = new Lang.Class({ let weatherMenu; function init() { +Convenience.initTranslations('gnome-shell-extension-weather'); } function enable() { @@ -1533,6 +1528,5 @@ function enable() { } function disable() { - weatherMenu.stopConnect(); weatherMenu.destroy(); } diff --git a/src/prefs.js b/src/prefs.js index 1f3dbbd..0f843d5 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -545,10 +545,7 @@ Extends: Gtk.Box, loadConfig : function() { let that = this; - let schema = WEATHER_SETTINGS_SCHEMA; - if (Gio.Settings.list_schemas().indexOf(schema) == -1) - throw _("Schema \"%s\" not found.").format(schema); - this.Settings = Convenience.getSettings(schema); + this.Settings = Convenience.getSettings(WEATHER_SETTINGS_SCHEMA); this.Settings.connect("changed", function(){that.refreshUI();}); },