[gnome-weather/gnome-3-8] forecast: use GSettings clock-format string instead of hardcoding 24h
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/gnome-3-8] forecast: use GSettings clock-format string instead of hardcoding 24h
- Date: Tue, 5 Mar 2013 22:51:17 +0000 (UTC)
commit 3611f9e9965b226ec194d28165917e23e119a15f
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Mar 5 14:33:31 2013 -0500
forecast: use GSettings clock-format string instead of hardcoding 24h
https://bugzilla.gnome.org/show_bug.cgi?id=695242
src/forecast.js | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/forecast.js b/src/forecast.js
index 0cb0f78..75d53f7 100644
--- a/src/forecast.js
+++ b/src/forecast.js
@@ -135,6 +135,8 @@ const TodaySidebar = new Lang.Class({
params = Params.fill(params, { hscrollbar_policy: Gtk.PolicyType.NEVER });
this.parent(params);
+ this._settings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
+
this._grid = new Gtk.Grid({ column_spacing: 6,
row_spacing: 12,
margin_left: 12,
@@ -257,7 +259,17 @@ const TodaySidebar = new Lang.Class({
let [ok, date] = info.get_value_update();
let datetime = GLib.DateTime.new_from_unix_local(date);
- let label = new Gtk.Label({ label: datetime.format(_("%k∶%M")),
+ let timeSetting = this._settings.get_string('clock-format');
+ let timeFormat = null;
+
+ if (timeSetting == '12h')
+ // Translators: this is a time format without date used for AM/PM
+ timeFormat = _("%l∶%M %p");
+ else
+ // Translators: this is a time format without date used for 24h mode
+ timeFormat = _("%R");
+
+ let label = new Gtk.Label({ label: datetime.format(timeFormat),
visible: true,
xalign: 1.0 });
label.get_style_context().add_class('dim-label');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]