[gnome-weather/wip/new-ui: 2/2] wip fixes



commit f617409fe423d4cee79c51d6f74e3b6e7229f2d4
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Jul 30 10:02:28 2014 +0200

    wip fixes

 data/city.ui                         |   25 ++++++++++++++-----------
 src/app/currentLocationController.js |   16 +++++++---------
 src/app/forecast.js                  |    2 +-
 src/app/main.js                      |   18 ++++++++++++++----
 src/app/weeklyForecast.js            |    6 +++---
 src/shared/world.js                  |   11 ++++++-----
 6 files changed, 45 insertions(+), 33 deletions(-)
---
diff --git a/data/city.ui b/data/city.ui
index cbef771..ab4db9f 100644
--- a/data/city.ui
+++ b/data/city.ui
@@ -24,8 +24,8 @@
                 <property name="valign">center</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <property name="margin_left">50</property>
-                <property name="margin_right">20</property>
+                <property name="margin-start">50</property>
+                <property name="margin-end">20</property>
                 <property name="row_spacing">11</property>
                 <child>
                   <object class="GtkGrid" id="inner-grid">
@@ -60,7 +60,7 @@
                         <property name="can_focus">False</property>
                         <property name="valign">end</property>
                         <property name="vexpand">True</property>
-                        <property name="xalign">0</property>
+                        <property name="halign">start</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -75,7 +75,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="valign">end</property>
-                        <property name="xalign">0</property>
+                        <property name="halign">start</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -179,7 +179,7 @@
                           <object class="GtkImage" id="left-image">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-go-back</property>
+                            <property name="icon-name">go-previous-symbolic</property>
                             <property name="icon_size">1</property>
                           </object>
                         </child>
@@ -199,7 +199,7 @@
                           <object class="GtkImage" id="right-image">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-go-forward</property>
+                            <property name="icon-name">go-next-symbolic</property>
                           </object>
                         </child>
                       </object>
@@ -227,14 +227,16 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="halign">end</property>
-                <property name="margin_right">20</property>
+                <property name="margin-end">20</property>
                 <child>
                   <object class="GtkImage" id="clock-image">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
-                    <property name="xpad">10</property>
-                    <property name="ypad">15</property>
+                    <property name="halign">start</property>
+                    <property name="margin-start">10</property>
+                    <property name="margin-end">10</property>
+                    <property name="margin-top">15</property>
+                    <property name="margin-bottom">15</property>
                     <property name="icon_name">document-open-recent-symbolic</property>
                   </object>
                   <packing>
@@ -248,7 +250,8 @@
                   <object class="GtkLabel" id="time-label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="ypad">15</property>
+                    <property name="margin-top">15</property>
+                    <property name="margin-bottom">15</property>
                     <property name="label">label</property>
                   </object>
                   <packing>
diff --git a/src/app/currentLocationController.js b/src/app/currentLocationController.js
index 9682a73..83e8cc8 100644
--- a/src/app/currentLocationController.js
+++ b/src/app/currentLocationController.js
@@ -111,14 +111,12 @@ const CurrentLocationController = new Lang.Class({
             this._clientProxy.connectSignal("LocationUpdated",
                                             this._getCurrentLocation.bind(this));
 
-        this._clientProxy.StartRemote(Lang.bind(this, this._callback, this._world));
-    },
-
-    _callback: function(result, e, world) {
-        if (e) {
-            log ("Failed to connect to GeoClue2 service: " + e.message);
-            world.currentLocationChanged(null);
-        }
+        this._clientProxy.StartRemote(Lang.bind(this, function(result, e) {
+            if (e) {
+                log ("Failed to connect to GeoClue2 service: " + e.message);
+                this._world.currentLocationChanged(null);
+            }
+        }));
     },
 
     _getCurrentLocation: function(proxy, sender, [oldPath, newPath]) {
@@ -146,7 +144,7 @@ const CurrentLocationController = new Lang.Class({
             } else {
                 this._locationUpdatedId =
                     this._clientProxy.connectSignal("LocationUpdated",
-                                                    this._getCurrentLocation.bind(this));
+                                                    Lang.bind(this, this._getCurrentLocation));
             }
         } else {
             this._clientProxy.disconnectSignal(this._locationUpdatedId);
diff --git a/src/app/forecast.js b/src/app/forecast.js
index 03fec52..786432f 100644
--- a/src/app/forecast.js
+++ b/src/app/forecast.js
@@ -37,7 +37,7 @@ const ForecastBox = new Lang.Class({
         this.parent(params);
         this.get_accessible().accessible_name = _("Forecast");
 
-        this._settings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
+        this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
 
         this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
                                     column_spacing: 24,
diff --git a/src/app/main.js b/src/app/main.js
index 89b6029..0a87ca8 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -115,7 +115,7 @@ const Application = new Lang.Class({
                           { name: 'new-location',
                             activate: this._onNewLocation }]);
 
-        let gwSettings = new Gio.Settings({ schema: 'org.gnome.GWeather' });
+        let gwSettings = new Gio.Settings({ schema_id: 'org.gnome.GWeather' });
         this.add_action(gwSettings.create_action('temperature-unit'));
 
         this._initAppMenu();
@@ -140,6 +140,9 @@ const Application = new Lang.Class({
                     return false;
                 });
                 notifyId = this.model.connect('notify::loading', function(model) {
+                    if (model.loading)
+                        return;
+
                     model.disconnect(notifyId);
                     GLib.source_remove(timeoutId);
                     win.show();
@@ -148,10 +151,17 @@ const Application = new Lang.Class({
                 win.show();
             }
         } else {
-            notifyId = this.model.connect('notify::loading', Lang.bind(this, function(model) {
-                model.disconnect(notifyId);
+            if (this.model.loading) {
+                notifyId = this.model.connect('notify::loading', Lang.bind(this, function(model) {
+                    if (model.loading)
+                        return;
+
+                    model.disconnect(notifyId);
+                    win.show();
+                }));
+            } else {
                 win.show();
-            }));
+            }
         }
 
         return win;
diff --git a/src/app/weeklyForecast.js b/src/app/weeklyForecast.js
index a05ddca..4da3597 100644
--- a/src/app/weeklyForecast.js
+++ b/src/app/weeklyForecast.js
@@ -35,13 +35,13 @@ const WeeklyForecastFrame = new Lang.Class({
         this.parent(params);
         this.get_accessible().accessible_name = _("WeeklyForecast");
 
-        this._settings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
+        this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
 
         this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
                                     margin_top: 10,
                                     margin_bottom: 30,
-                                    margin_left: 50,
-                                    margin_right: 50,
+                                    margin_start: 50,
+                                    margin_end: 50,
                                     valign: Gtk.Align.CENTER,
                                     halign: Gtk.Align.START,
                                     row_spacing: 25,
diff --git a/src/shared/world.js b/src/shared/world.js
index d7fbc9b..84c5b27 100644
--- a/src/shared/world.js
+++ b/src/shared/world.js
@@ -21,13 +21,13 @@ const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const GWeather = imports.gi.GWeather;
 const Lang = imports.lang;
-const Signals = imports.signals;
 
 const Params = imports.misc.params;
 const Util = imports.misc.util;
 
 const WorldModel = new Lang.Class({
     Name: 'WorldModel',
+    Extends: GObject.Object,
     Signals: {
         'updated': { param_types: [ GWeather.Info ] },
         'no-cityview': { param_types: [] },
@@ -40,6 +40,8 @@ const WorldModel = new Lang.Class({
     },
 
     _init: function(world, enableGtk) {
+        this.parent();
+
         this._world = world;
 
         this._settings = Util.getSettings('org.gnome.Weather.Application');
@@ -62,7 +64,7 @@ const WorldModel = new Lang.Class({
     currentLocationChanged: function(location) {
         if (location) {
             this._newCurrentLocationInfo = new GWeather.Info({ location: location,
-                                                            enabled_providers: this._providers });
+                                                               enabled_providers: this._providers });
             if (this._currentLocationInfo) {
                 if (!this._currentLocationInfo.location.equal(location)) {
                     this._newCurrentLocationInfo.connect('updated', Lang.bind(this, function(info) {
@@ -81,7 +83,7 @@ const WorldModel = new Lang.Class({
                 this._currentLocationInfo = this._newCurrentLocationInfo;
             }
         }
-        this.emit('notify::loading');
+
         this.emit('current-location-changed', location);
     },
 
@@ -141,7 +143,7 @@ const WorldModel = new Lang.Class({
         let isLoading = this._loadingCount > 0;
 
         if (wasLoading != isLoading)
-            this.emit('notify::loading');
+            this.notify('loading');
     },
 
     updateInfo: function(info) {
@@ -390,4 +392,3 @@ const WorldContentView = new Lang.Class({
         }
     }
 });
-Signals.addSignalMethods(WorldModel.prototype);


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