aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}