aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2011-06-28 15:32:04 +0100
committerMichael Terry <michael.terry@canonical.com>2011-06-28 15:32:04 +0100
commitf57128cae925df888e1e0cafb9ba988c665ecff8 (patch)
tree2badc6eec3bf64e8e5e650bce5064ed5aec5b095 /src/indicator-datetime.c
parent3c5f6a06ff0e44945f788254c44ede18f4061724 (diff)
downloadayatana-indicator-datetime-f57128cae925df888e1e0cafb9ba988c665ecff8.tar.gz
ayatana-indicator-datetime-f57128cae925df888e1e0cafb9ba988c665ecff8.tar.bz2
ayatana-indicator-datetime-f57128cae925df888e1e0cafb9ba988c665ecff8.zip
update to handle latest gnome-settings-daemon dbus API for setting timezones; be more fool-proof when looking up current timezone in indicator
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 800fa87..cd1fbb9 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;
}