aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-07 16:17:58 -0500
committerTed Gould <ted@gould.cx>2011-07-07 16:17:58 -0500
commitb64854473ee9226bc11f5b27b0057fab82a2f098 (patch)
treea64aabc5e071d3d04671fca285b13356b2c345fd /src/indicator-datetime.c
parent62a1ba2b91d2e916c9bfc99eda0793f67af6e820 (diff)
parent5d36567ca57ebd73e7a759c83542d19b2aa8814d (diff)
downloadayatana-indicator-datetime-b64854473ee9226bc11f5b27b0057fab82a2f098.tar.gz
ayatana-indicator-datetime-b64854473ee9226bc11f5b27b0057fab82a2f098.tar.bz2
ayatana-indicator-datetime-b64854473ee9226bc11f5b27b0057fab82a2f098.zip
Making the preferences a gnome-control-center plugin instead of a stand alone app
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 19f0010..072253b 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -761,11 +761,18 @@ set_label_to_time_in_zone (IndicatorDatetime * self, GtkLabel * label,
GTimeZone * tz, const gchar * format,
GDateTime ** datetime)
{
+ gboolean unref_tz = FALSE;
+ if (tz == NULL) {
+ gchar * zone = read_timezone ();
+ if (zone == NULL)
+ return;
+ tz = g_time_zone_new(zone);
+ unref_tz = TRUE;
+ g_free (zone);
+ }
+
GDateTime * datetime_now;
- if (tz == NULL)
- datetime_now = g_date_time_new_now_local();
- else
- datetime_now = g_date_time_new_now(tz);
+ datetime_now = g_date_time_new_now(tz);
gchar * timestr;
if (format == NULL) {
@@ -793,6 +800,9 @@ set_label_to_time_in_zone (IndicatorDatetime * self, GtkLabel * label,
else
g_date_time_unref(datetime_now);
+ if (unref_tz)
+ g_time_zone_unref(tz);
+
return;
}