diff --git a/README.md b/README.md index 3ffe65e..0a87b1d 100644 --- a/README.md +++ b/README.md @@ -12,33 +12,32 @@ Currently, the weather report including forecast for today and tomorrow is fetch ---- +### Depends + +* `libglib2.0-dev`, without you'll get an error about `GLIB_GSETTINGS`. +* `gnome-common` + +---- + ### Installation -* [Arch Linux](https://aur.archlinux.org/packages.php?ID=49409) -* [Frugalware](http://www.frugalware.org/packages/119339) -* [Ubuntu](https://launchpad.net/~webupd8team/+archive/gnome3/+packages) -* Generic: For a generic installation, run the following commands: - `./autogen.sh --prefix=/usr && make && sudo make install` - * Make sure you have the `libglib2.0-dev` package (or equivalent for your distribution) - installed, or else you'll get an error about `GLIB_GSETTINGS`. -* *Please report further links!* +Run the following commands in the `gnome-shell-extension-weather` directory: +`./autogen.sh --prefix=/usr && make && sudo make install && sudo ` That's it! ### Versions -Due to incompatible changes between GNOME 3.0 and 3.2, separate versions of this extension are provided: - -* For GNOME Shell 3.2, use the `master` branch. -* For GNOME Shell 3.0, use the `gnome3.0` branch. +Only for GNOME Shell 3.2 (not tested under GNOME Shell 3.0) ---- ### Configuration -gnome-shell-extension-weather uses gsettings to save your configuration. You can use `dconf-editor` or `gsettings` from the command line to modify some parameters. +Use the `Weather Settings` button to edit the configuration. +You can also use `dconf-editor` or `gsettings` to modify some parameters from the command line. -#### Location ("Cambridge, MA" (GNOME Foundation) by default) +#### City (`Cambridge, MA` (GNOME Foundation) by default) You can specify your location using the following command. Perhaps you need quotation marks as in the second command. @@ -52,6 +51,14 @@ You can modify the temperature unit using one of the following commands: gsettings set org.gnome.shell.extensions.weather unit celsius gsettings set org.gnome.shell.extensions.weather unit fahrenheit +#### Position in Panel (optional, center by default) + +The position of this GNOME Shell extension in the panel can be configured to either 'left', 'center' or 'right' (requires restart of GNOME Shell). + + gsettings set org.gnome.shell.extensions.weather position-in-panel center + gsettings set org.gnome.shell.extensions.weather position-in-panel left + gsettings set org.gnome.shell.extensions.weather position-in-panel right + #### Translate Weather Conditions (optional, true by default) You may want to configure whether to translate the weather condition. If enabled, the condition is translated based on the weather code. If disabled, the condition string from Yahoo is taken. Note: Enabling the translation sometimes results in loss of accuracy, e.g., the condition string "PM Thunderstorms" cannot be expressed in terms of weather codes. @@ -59,12 +66,12 @@ You may want to configure whether to translate the weather condition. If enabled gsettings set org.gnome.shell.extensions.weather translate-condition true gsettings set org.gnome.shell.extensions.weather translate-condition false -#### Use Symbolic Icons (optional, true by default) +#### Symbolic Icons (optional, true by default) -If desired, you can enable the usage of symbolic icons to display the weather condition (instead of full-colored icons). +If desired, you can enable the usage of full-colored icons to display the weather condition (instead of symbolic icons). - gsettings set org.gnome.shell.extensions.weather use-symbolic-icons false gsettings set org.gnome.shell.extensions.weather use-symbolic-icons true + gsettings set org.gnome.shell.extensions.weather use-symbolic-icons false #### Show Text in Panel (optional, true by default) @@ -73,21 +80,13 @@ You can configure whether to show the weather condition text (aka. comment) toge gsettings set org.gnome.shell.extensions.weather show-text-in-panel true gsettings set org.gnome.shell.extensions.weather show-text-in-panel false -#### Show Comment in Panel (optional, false by default) +#### Include condition (optional, false by default) Configures whether to show the comment (aka. weather condition text, e.g. "Windy", "Clear") in the panel. Note that the temperature is still shown (if undesired, consider show-text-in-panel option). gsettings set org.gnome.shell.extensions.weather show-comment-in-panel false gsettings set org.gnome.shell.extensions.weather show-comment-in-panel true -#### Position in Panel (optional, center by default) - -The position of this GNOME Shell extension in the panel can be configured to either 'left', 'center' or 'right' (requires restart of GNOME Shell). - - gsettings set org.gnome.shell.extensions.weather position-in-panel center - gsettings set org.gnome.shell.extensions.weather position-in-panel left - gsettings set org.gnome.shell.extensions.weather position-in-panel right - #### Refresh Interval (optional, 300 by default) The interval to refresh the weather information may be set arbitrarily and is specified in seconds. @@ -111,6 +110,7 @@ Timur Kristóf , Elad Alfassa , Simon Legner , Simon Claessens +Christian METZLER This file is part of gnome-shell-extension-weather. diff --git a/po/fr.po b/po/fr.po index 678270b..ad72bf7 100644 --- a/po/fr.po +++ b/po/fr.po @@ -271,6 +271,9 @@ msgstr "Pression :" msgid "Wind:" msgstr "Vent :" +#: extension.js:689 +msgid "Weather Settings" +msgstr "Paramètres de météo" #: weather-extension-configurator.py:113 msgid "City" diff --git a/src/extension.js b/src/extension.js index ebaf382..c5a6df8 100644 --- a/src/extension.js +++ b/src/extension.js @@ -32,7 +32,6 @@ const Cairo = imports.cairo; const Gettext = imports.gettext.domain('gnome-shell-extension-weather'); const Gio = imports.gi.Gio; const Gtk = imports.gi.Gtk; -const Json = imports.gi.Json; const Lang = imports.lang; const Mainloop = imports.mainloop; const Soup = imports.gi.Soup; @@ -160,10 +159,11 @@ WeatherMenuButton.prototype = { this._currentWeather = new St.Bin({ style_class: 'current' }); // Future weather this._futureWeather = new St.Bin({ style_class: 'forecast' /*, x_align: St.Align.START*/}); + // Setting button + this._settingWeather = new St.Bin({ style_class: 'setting' }); - // Separator (copied from Gnome shell's popupMenu.js) + // Separators (copied from Gnome shell's popupMenu.js) this._separatorArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' }); - this._separatorArea.width = 200; this._separatorArea.connect('repaint', Lang.bind(this, this._onSeparatorAreaRepaint)); // Putting the popup item together @@ -171,6 +171,7 @@ WeatherMenuButton.prototype = { mainBox.add_actor(this._currentWeather); mainBox.add_actor(this._separatorArea); mainBox.add_actor(this._futureWeather); + mainBox.add_actor(this._settingWeather); this.menu.addActor(mainBox); @@ -179,6 +180,7 @@ WeatherMenuButton.prototype = { this.rebuildCurrentWeatherUi(); this.rebuildFutureWeatherUi(); + this.rebuildSettingWeatherUi(); // Show weather Mainloop.timeout_add_seconds(3, Lang.bind(this, function() { @@ -187,25 +189,8 @@ WeatherMenuButton.prototype = { }, - getPreferencesIcon: function() { - let prefIcon = new St.Icon ({ - icon_type: this._icon_type, - icon_size: 16, - icon_name: 'system-run' - }); - let prefButton = new St.Button({ - style_class: 'panel-button' - }); - prefButton.connect('clicked', function() { - Util.spawn(["weather-extension-configurator"]); - }); - let prefBox = new St.BoxLayout({ - style_class: 'weather-config', - vertical: true - }); - prefButton.add_actor(prefIcon); - prefBox.add_actor(prefButton); - return prefBox; + _onPreferencesActivate : function() { + Util.spawn(["weather-extension-configurator"]); }, unit_to_url: function() { @@ -569,6 +554,11 @@ WeatherMenuButton.prototype = { this._futureWeather.get_child().destroy(); }, + destroySettingWeather: function() { + if (this._settingWeather.get_child() != null) + this._settingWeather.get_child().destroy(); + }, + showLoadingUi: function() { this.destroyCurrentWeather(); this.destroyFutureWeather(); @@ -582,7 +572,7 @@ WeatherMenuButton.prototype = { // This will hold the icon for the current weather this._currentWeatherIcon = new St.Icon({ icon_type: this._icon_type, - icon_size: 64, + icon_size: 72, icon_name: 'view-refresh-symbolic', style_class: 'weather-current-icon' }); @@ -633,7 +623,6 @@ WeatherMenuButton.prototype = { let xb = new St.BoxLayout(); xb.add_actor(bb); xb.add_actor(rb); - xb.add_actor(this.getPreferencesIcon()); let box = new St.BoxLayout({ style_class: 'weather-current-iconbox' @@ -691,6 +680,17 @@ WeatherMenuButton.prototype = { }, + rebuildSettingWeatherUi: function() { + this.destroySettingWeather(); + + let item = new PopupMenu.PopupSeparatorMenuItem(); + this.menu.addMenuItem(item); + + let item = new PopupMenu.PopupMenuItem(_("Weather Settings")); + item.connect('activate', Lang.bind(this, this._onPreferencesActivate)); + this.menu.addMenuItem(item); + }, + // Copied from Gnome shell's popupMenu.js _onSeparatorAreaRepaint: function(area) { let cr = area.get_context(); diff --git a/src/stylesheet.css b/src/stylesheet.css index c79ffa6..d33a1ce 100644 --- a/src/stylesheet.css +++ b/src/stylesheet.css @@ -1,22 +1,20 @@ .weather-current-summarybox { - padding-top: 15px; } .weather-current-summary { - font-size: 35px; + font-size: 40px; } .weather-current-databox { - padding-top: 15px; - padding-left: 30px; + padding: 0 15px 5px 30px; } .weather-current-icon { - padding: 0 30px; + padding: 0px 30px 10px 30px; } .weather-current-iconbox { - padding: 10px; + padding: 0 20px 0 0; } .weather-icon { @@ -34,11 +32,11 @@ } .weather-forecast-icon { - padding: 0 15px 0 30px; + padding: 0 15px 0px 25px; } .weather-forecast-databox { - padding: 0 30px 0 0; + padding: 5px 30px 5px 0; } .weather-forecast-day { @@ -46,6 +44,10 @@ font-size: 90%; } +.weather-setting-button { + padding-top: 500px; +} + .weather-config { padding-right: 10px; }