[gnome-weather/gnome-3-8] Move the attribution to the sidebar



commit 5bc3b65e7bf1b75bffa92d6f59ba067cbfabc905
Author: William Jon McCann <william jon mccann gmail com>
Date:   Wed Mar 6 13:12:16 2013 -0500

    Move the attribution to the sidebar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695313

 src/city.js     |   15 +--------------
 src/forecast.js |   26 ++++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 16 deletions(-)
---
diff --git a/src/city.js b/src/city.js
index 25a6850..6bddede 100644
--- a/src/city.js
+++ b/src/city.js
@@ -61,11 +61,6 @@ const WeatherWidget = new Lang.Class({
                                            valign: Gtk.Align.END });
         innerGrid.attach(this._conditions, 1, 1, 1, 1);
 
-        this._attribution = new Gtk.Label({ xalign: 0.0, wrap: true,
-                                            name: 'attribution-label',
-                                            use_markup: true });
-        innerGrid.attach(this._attribution, 1, 2, 1, 1);
-
         alignment.add(innerGrid);
         outerGrid.attach(alignment, 0, 0, 1, 1);
 
@@ -112,14 +107,6 @@ const WeatherWidget = new Lang.Class({
         this._conditions.label = Util.getWeatherConditions(info);
         this._temperature.label = info.get_temp_summary();
 
-        let attr = info.get_attribution();
-        if (attr) {
-            this._attribution.label = attr;
-            this._attribution.show();
-        } else {
-            this._attribution.hide();
-        }
-
         this._icon.icon_name = info.get_symbolic_icon_name();
         let context = this._contentFrame.get_style_context();
         if (this._currentStyle)
@@ -132,7 +119,7 @@ const WeatherWidget = new Lang.Class({
             this._forecasts.update(forecasts);
             this._forecasts.show();
 
-            this._today.update(forecasts);
+            this._today.update(info);
             this._revealButton.show();
             this._revealer.show();
         } else {
diff --git a/src/forecast.js b/src/forecast.js
index 3230dcc..d050aa2 100644
--- a/src/forecast.js
+++ b/src/forecast.js
@@ -149,11 +149,15 @@ const TodaySidebar = new Lang.Class({
 
         this._settings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
 
+        let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
+                                vexpand: true });
+        this.add(box);
+
         this._grid = new Gtk.Grid({ column_spacing: 6,
                                     row_spacing: 12,
                                     margin_left: 12,
                                     margin_right: 12 });
-        this.add(this._grid);
+        box.add(this._grid);
 
         this._headline = new Gtk.Label({ use_markup: true,
                                          xalign: 0.0 });
@@ -163,6 +167,14 @@ const TodaySidebar = new Lang.Class({
                                         xalign: 0.0 });
         this._grid.attach(this._subline, 0, 1, 3, 1);
 
+        this._attribution = new Gtk.Label({ xalign: 0.5,
+                                            wrap: true,
+                                            max_width_chars: 32,
+                                            margin_bottom: 10,
+                                            name: 'attribution-label',
+                                            use_markup: true });
+        box.pack_end(this._attribution, false, false, 0);
+
         this._hasMore = false;
         this._moreButton = new Gtk.Button({ label: _("Moreā€¦"),
                                             margin_top: 4,
@@ -228,7 +240,9 @@ const TodaySidebar = new Lang.Class({
         return ret;
     },
 
-    update: function(infos) {
+    update: function(info) {
+        let infos = info.get_forecast_list();
+
         let [ok, v_first] = infos[0].get_value_update();
 
         let now = GLib.DateTime.new_now_local();
@@ -265,6 +279,14 @@ const TodaySidebar = new Lang.Class({
         }
 
         this._infos = infos;
+
+        let attr = info.get_attribution();
+        if (attr) {
+            this._attribution.label = attr;
+            this._attribution.show();
+        } else {
+            this._attribution.hide();
+        }
     },
 
     _addOneInfo: function(info, row) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]