From c18ae6b751a004416e1f33468ffdbceb24aadcf6 Mon Sep 17 00:00:00 2001 From: simon04 Date: Sat, 4 Jun 2011 22:11:52 +0200 Subject: [PATCH] Use full-colored icons by default, symbolic icons configurable. --- README.md | 17 +++++++++++++---- src/extension.js | 8 +++++--- ...nome.shell.extensions.weather.gschema.xml.in | 5 +++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2f98a86..5c4c14d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ You can specify your location buy using this command: gsettings set org.gnome.shell.extensions.weather woeid your_woeid ``` -#### Temperature units (optional, celsius by default) +#### Temperature Units (optional, celsius by default) You can modify the temperature unit with one of the following commands: @@ -51,7 +51,7 @@ gsettings set org.gnome.shell.extensions.weather unit celsius gsettings set org.gnome.shell.extensions.weather unit fahrenheit ``` -#### Displayed location (optional) +#### Displayed Location (optional) Sometimes your WOEID location isn't quite right (it's the next major city around). To customise the displayed city you can type: @@ -59,7 +59,7 @@ Sometimes your WOEID location isn't quite right (it's the next major city around gsettings set org.gnome.shell.extensions.weather city your_city ``` -#### Translate weather conditions (optional, true by default) +#### 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. @@ -68,7 +68,16 @@ gsettings set org.gnome.shell.extensions.weather translate-condition true gsettings set org.gnome.shell.extensions.weather translate-condition false ``` -#### Restart Gnome-Shell +#### Use Symbolic Icons (optional, false by default) + +If desired, you can enable the usage of symbolic icons to display the weather condition (instead of full-colored icons). + +```bash +gsettings set org.gnome.shell.extensions.weather use-symbolic-icons false +gsettings set org.gnome.shell.extensions.weather use-symbolic-icons true +``` + +#### Restart GNOME Shell Don't forget to restart GNOME Shell: diff --git a/src/extension.js b/src/extension.js index de31427..b08f62f 100644 --- a/src/extension.js +++ b/src/extension.js @@ -52,6 +52,7 @@ const WEATHER_UNIT_KEY = 'unit'; const WEATHER_CITY_KEY = 'city'; const WEATHER_WOEID_KEY = 'woeid'; const WEATHER_TRANSLATE_CONDITION_KEY = 'translate-condition'; +const WEATHER_SYMBOLIC_ICONS = 'use-symbolic-icons'; // Keep enums in sync with GSettings schemas const WeatherUnits = { @@ -79,10 +80,11 @@ WeatherMenuButton.prototype = { this._city = this._settings.get_string(WEATHER_CITY_KEY); this._woeid = this._settings.get_string(WEATHER_WOEID_KEY); this._translate_condition = this._settings.get_boolean(WEATHER_TRANSLATE_CONDITION_KEY); + this._icontype = this._settings.get_boolean(WEATHER_SYMBOLIC_ICONS) ? St.IconType.SYMBOLIC : St.IconType.FULLCOLOR; // Panel icon this._weatherIcon = new St.Icon({ - icon_type: St.IconType.SYMBOLIC, + icon_type: this._icontype, icon_size: Main.panel.button.get_child().height, icon_name: 'view-refresh-symbolic', style_class: 'weather-icon' + (Main.panel.actor.get_direction() == St.TextDirection.RTL ? '-rtl' : '') @@ -487,7 +489,7 @@ WeatherMenuButton.prototype = { // This will hold the icon for the current weather this._currentWeatherIcon = new St.Icon({ - icon_type: St.IconType.SYMBOLIC, + icon_type: this._icontype, icon_size: 64, icon_name: 'view-refresh-symbolic', style_class: 'weather-current-icon' @@ -560,7 +562,7 @@ WeatherMenuButton.prototype = { let forecastWeather = {}; forecastWeather.Icon = new St.Icon({ - icon_type: St.IconType.SYMBOLIC, + icon_type: this._icontype, icon_size: 48, icon_name: 'view-refresh-symbolic', style_class: 'weather-forecast-icon' diff --git a/src/org.gnome.shell.extensions.weather.gschema.xml.in b/src/org.gnome.shell.extensions.weather.gschema.xml.in index 5352cee..eaae920 100644 --- a/src/org.gnome.shell.extensions.weather.gschema.xml.in +++ b/src/org.gnome.shell.extensions.weather.gschema.xml.in @@ -24,5 +24,10 @@ <_summary>Whether to translate the weather condition <_description>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. + + false + <_summary>Whether to use symbolic icons + <_description>Whether to use symbolic icons instead of full-colored icons. +