Allow placement on left (thanks to Miguel Aguilar Molina).

yahoo_weather
simon04 14 years ago
parent 7f9de73e61
commit b3669179cd
  1. 3
      README.md
  2. 10
      src/extension.js
  3. 3
      src/org.gnome.shell.extensions.weather.gschema.xml.in

@ -81,9 +81,10 @@ Configures whether to show the comment (aka. weather condition text, e.g. "Windy
#### Position in Panel (optional, center by default) #### Position in Panel (optional, center by default)
The position of this GNOME Shell extension in the panel can be configured to either 'center' or 'right' (requires restart of GNOME Shell). 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 center
gsettings set org.gnome.shell.extensions.weather position-in-panel left
gsettings set org.gnome.shell.extensions.weather position-in-panel right gsettings set org.gnome.shell.extensions.weather position-in-panel right
#### Restart GNOME Shell #### Restart GNOME Shell

@ -62,7 +62,8 @@ const WeatherUnits = {
} }
const WeatherPosition = { const WeatherPosition = {
CENTER: 0, CENTER: 0,
RIGHT: 1 RIGHT: 1,
LEFT: 2
} }
function WeatherMenuButton() { function WeatherMenuButton() {
@ -138,12 +139,17 @@ WeatherMenuButton.prototype = {
topBox.add_actor(this._weatherInfo); topBox.add_actor(this._weatherInfo);
this.actor.set_child(topBox); this.actor.set_child(topBox);
let children = null;
switch (this._position_in_panel) { switch (this._position_in_panel) {
case WeatherPosition.LEFT:
children = Main.panel._leftBox.get_children();
Main.panel._leftBox.insert_actor (this.actor, children.length-1);
break;
case WeatherPosition.CENTER: case WeatherPosition.CENTER:
Main.panel._centerBox.add(this.actor, { y_fill: true }); Main.panel._centerBox.add(this.actor, { y_fill: true });
break; break;
case WeatherPosition.RIGHT: case WeatherPosition.RIGHT:
let children = Main.panel._rightBox.get_children(); children = Main.panel._rightBox.get_children();
Main.panel._rightBox.insert_actor(this.actor, children.length-1); Main.panel._rightBox.insert_actor(this.actor, children.length-1);
break; break;
} }

@ -6,6 +6,7 @@
<enum id="org.gnome.shell.extensions.weather.position"> <enum id="org.gnome.shell.extensions.weather.position">
<value nick="center" value="0" /> <value nick="center" value="0" />
<value nick="right" value="1" /> <value nick="right" value="1" />
<value nick="left" value="2" />
</enum> </enum>
<schema id="org.gnome.shell.extensions.weather" path="/org/gnome/shell/extensions/weather/"> <schema id="org.gnome.shell.extensions.weather" path="/org/gnome/shell/extensions/weather/">
<key name="unit" enum="org.gnome.shell.extensions.weather.unit"> <key name="unit" enum="org.gnome.shell.extensions.weather.unit">
@ -46,7 +47,7 @@
<key name="position-in-panel" enum="org.gnome.shell.extensions.weather.position"> <key name="position-in-panel" enum="org.gnome.shell.extensions.weather.position">
<default>'center'</default> <default>'center'</default>
<_summary>Position in panel</_summary> <_summary>Position in panel</_summary>
<_description>Set the position of this GNOME Shell extension in the panel to either 'center' or 'right' (requires restart).</_description> <_description>Set the position of this GNOME Shell extension in the panel to either 'center', 'left' or 'right' (requires restart).</_description>
</key> </key>
</schema> </schema>
</schemalist> </schemalist>

Loading…
Cancel
Save