[gnome-weather] city: honor desktop settings for 12/24 clock format



commit f8a7cb1c0f089c739302c731f64556f5686b0f0d
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Apr 26 19:14:02 2015 -0700

    city: honor desktop settings for 12/24 clock format
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741533

 src/app/city.js |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/app/city.js b/src/app/city.js
index d803b69..a48871a 100644
--- a/src/app/city.js
+++ b/src/app/city.js
@@ -16,9 +16,10 @@
 // with Gnome Weather; if not, write to the Free Software Foundation,
 // Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-const Gtk = imports.gi.Gtk;
+const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const Gnome = imports.gi.GnomeDesktop;
+const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 
 const Forecast = imports.app.forecast;
@@ -217,6 +218,8 @@ const WeatherView = new Lang.Class({
 
         this._wallClock = new Gnome.WallClock();
         this._clockHandlerId = 0;
+
+        this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
     },
 
     get info() {
@@ -286,7 +289,10 @@ const WeatherView = new Lang.Class({
             let location = this._info.location;
             let tz = GLib.TimeZone.new(location.get_timezone().get_tzid());
             let dt = GLib.DateTime.new_now(tz);
-            return dt.format(_("%H:%M"));
+
+            return this._wallClock.string_for_datetime (dt,
+                                                        this._desktopSettings.get_enum('clock-format'),
+                                                        false, false, false);
         }
         return null;
     }


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