aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-10-07 14:11:36 -0600
committerTed Gould <ted@gould.cx>2010-10-07 14:11:36 -0600
commit27bd0190002c6facbd662c19ffb4be5b1d995441 (patch)
tree8e71946d9b596f7482eda9bb769f2d1d2062f1dd /src/datetime-service.c
parenta60a4a596ba5acacf766ea63837a6334cb66dbf5 (diff)
downloadayatana-indicator-datetime-27bd0190002c6facbd662c19ffb4be5b1d995441.tar.gz
ayatana-indicator-datetime-27bd0190002c6facbd662c19ffb4be5b1d995441.tar.bz2
ayatana-indicator-datetime-27bd0190002c6facbd662c19ffb4be5b1d995441.zip
Create a way for to see if the timezones are the same.
Diffstat (limited to 'src/datetime-service.c')
-rw-r--r--src/datetime-service.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 7f37ac2..e821dfc 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -56,6 +56,39 @@ static GeoclueMasterClient * geo_master = NULL;
static GeoclueAddress * geo_address = NULL;
static gchar * geo_timezone = NULL;
+/* Check to see if our timezones are the same */
+static void
+check_timezone_sync (void) {
+ gboolean in_sync = FALSE;
+
+ if (geo_timezone == NULL) {
+ in_sync = TRUE;
+ }
+
+ if (current_timezone == NULL) {
+ in_sync = TRUE;
+ }
+
+ if (!in_sync && g_strcmp0(geo_timezone, current_timezone) == 0) {
+ in_sync = TRUE;
+ }
+
+ if (in_sync) {
+ g_debug("Timezones in sync");
+ dbusmenu_menuitem_property_set_bool(tzchange, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ } else {
+ g_debug("Timezones are different");
+ gchar * label = g_strdup_printf(_("Change timezone to: %s"), geo_timezone);
+
+ dbusmenu_menuitem_property_set(tzchange, DBUSMENU_MENUITEM_PROP_LABEL, label);
+ dbusmenu_menuitem_property_set_bool(tzchange, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+
+ g_free(label);
+ }
+
+ return;
+}
+
/* Update the current timezone */
static void
update_current_timezone (void) {
@@ -85,6 +118,8 @@ update_current_timezone (void) {
g_debug("System timezone is: %s", current_timezone);
+ check_timezone_sync();
+
return;
}
@@ -302,6 +337,8 @@ geo_address_cb (GeoclueAddress * address, int timestamp, GHashTable * addy_data,
geo_timezone = g_strdup((gchar *)tz_hash);
}
+ check_timezone_sync();
+
return;
}