From b3669179cdeb112a38d5e8662873b3cf9d030e4c Mon Sep 17 00:00:00 2001 From: simon04 Date: Tue, 14 Jun 2011 07:37:35 +0200 Subject: [PATCH] Allow placement on left (thanks to Miguel Aguilar Molina). --- README.md | 7 ++++--- src/extension.js | 14 ++++++++++---- ...g.gnome.shell.extensions.weather.gschema.xml.in | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6234378..28883fa 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Currently, the weather report including forecast for today and tomorrow is fetch ![Screenshot](gnome-shell-extension-weather/raw/master/data/screenshot.png) -And with French translation: +And with French translation: ![Screenshot](gnome-shell-extension-weather/raw/master/data/screenshot2.png) @@ -23,7 +23,7 @@ For installation, run the following commands: ./autogen.sh --prefix=/usr make sudo make install - + That's it! ---- @@ -81,9 +81,10 @@ Configures whether to show the comment (aka. weather condition text, e.g. "Windy #### 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 left gsettings set org.gnome.shell.extensions.weather position-in-panel right #### Restart GNOME Shell diff --git a/src/extension.js b/src/extension.js index dc297cd..713ae7b 100644 --- a/src/extension.js +++ b/src/extension.js @@ -62,7 +62,8 @@ const WeatherUnits = { } const WeatherPosition = { CENTER: 0, - RIGHT: 1 + RIGHT: 1, + LEFT: 2 } function WeatherMenuButton() { @@ -137,13 +138,18 @@ WeatherMenuButton.prototype = { if (this._text_in_panel) topBox.add_actor(this._weatherInfo); this.actor.set_child(topBox); - + + let children = null; switch (this._position_in_panel) { - case WeatherPosition.CENTER: + case WeatherPosition.LEFT: + children = Main.panel._leftBox.get_children(); + Main.panel._leftBox.insert_actor (this.actor, children.length-1); + break; + case WeatherPosition.CENTER: Main.panel._centerBox.add(this.actor, { y_fill: true }); break; 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); break; } diff --git a/src/org.gnome.shell.extensions.weather.gschema.xml.in b/src/org.gnome.shell.extensions.weather.gschema.xml.in index 6d36e18..95e9c9f 100644 --- a/src/org.gnome.shell.extensions.weather.gschema.xml.in +++ b/src/org.gnome.shell.extensions.weather.gschema.xml.in @@ -6,6 +6,7 @@ + @@ -46,7 +47,7 @@ 'center' <_summary>Position in panel - <_description>Set the position of this GNOME Shell extension in the panel to either 'center' or 'right' (requires restart). + <_description>Set the position of this GNOME Shell extension in the panel to either 'center', 'left' or 'right' (requires restart).