1) added whether to choose: show only temperature in panel, all show comment and temperature

2) moved icon not "too far right"
yahoo_weather
igor Ingultsov 13 years ago committed by simon04
parent 4b6fcf908f
commit 4c253d6cdc
  1. 13
      src/extension.js
  2. 5
      src/org.gnome.shell.extensions.weather.gschema.xml.in

@ -52,6 +52,7 @@ const WEATHER_TRANSLATE_CONDITION_KEY = 'translate-condition';
const WEATHER_USE_SYMBOLIC_ICONS_KEY = 'use-symbolic-icons';
const WEATHER_SHOW_TEXT_IN_PANEL_KEY = 'show-text-in-panel';
const WEATHER_POSITION_IN_PANEL_KEY = 'position-in-panel';
const WEATHER_SHOW_COMMENT_IN_PANEL_KEY = 'show-comment-in-panel';
// Keep enums in sync with GSettings schemas
const WeatherUnits = {
@ -86,6 +87,7 @@ WeatherMenuButton.prototype = {
this._icon_type = this._settings.get_boolean(WEATHER_USE_SYMBOLIC_ICONS_KEY) ? St.IconType.SYMBOLIC : St.IconType.FULLCOLOR;
this._text_in_panel = this._settings.get_boolean(WEATHER_SHOW_TEXT_IN_PANEL_KEY);
this._position_in_panel = this._settings.get_enum(WEATHER_POSITION_IN_PANEL_KEY);
this._comment_in_panel = this._settings.get_boolean(WEATHER_SHOW_COMMENT_IN_PANEL_KEY);
// Watch settings for changes
let load_settings_and_refresh_weather = Lang.bind(this, function() {
@ -138,7 +140,8 @@ WeatherMenuButton.prototype = {
Main.panel._centerBox.add(this.actor, { y_fill: true });
break;
case WeatherPosition.RIGHT:
Main.panel._rightBox.add(this.actor, { y_fill: true });
let children = Main.panel._rightBox.get_children();
Main.panel._rightBox.insert_actor(this.actor, children.length-1);
break;
}
@ -479,7 +482,13 @@ WeatherMenuButton.prototype = {
let iconname = this.get_weather_icon_safely(weather.get_object_member('condition').get_string_member('code'));
this._currentWeatherIcon.icon_name = this._weatherIcon.icon_name = iconname;
this._weatherInfo.text = (comment + ', ' + temperature + ' ' + this.unit_to_unicode());
if(this._comment_in_panel)
this._weatherInfo.text = (comment + ' ' + temperature + ' ' + this.unit_to_unicode());
else
this._weatherInfo.text = (temperature + ' ' + this.unit_to_unicode());
this._currentWeatherSummary.text = comment;
this._currentWeatherLocation.text = location;

@ -38,6 +38,11 @@
<_summary>Whether to show the text in the panel.</_summary>
<_description>Whether to show the weather condition text together with the temperature in the panel (requires restart).</_description>
</key>
<key name="show-comment-in-panel" type="b">
<default>false</default>
<_summary>Whether to show the comment text in the panel (the temperature is still shown).</_summary>
<_description>Whether to show the weather comment text(i.e. Windy, Clear) in the panel (requires restart).</_description>
</key>
<key name="position-in-panel" enum="org.gnome.shell.extensions.weather.position">
<default>'center'</default>
<_summary>Position in panel</_summary>

Loading…
Cancel
Save