diff options
author | Ted Gould <ted@gould.cx> | 2010-10-07 14:15:03 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-10-07 14:15:03 -0600 |
commit | ab293db1e9f909b47b867f86ea2c222ad343c497 (patch) | |
tree | e983a428459d0abc6987c6df39e0ebe652c56247 | |
parent | 27bd0190002c6facbd662c19ffb4be5b1d995441 (diff) | |
download | ayatana-indicator-datetime-ab293db1e9f909b47b867f86ea2c222ad343c497.tar.gz ayatana-indicator-datetime-ab293db1e9f909b47b867f86ea2c222ad343c497.tar.bz2 ayatana-indicator-datetime-ab293db1e9f909b47b867f86ea2c222ad343c497.zip |
Make it so that we don't hcange the menuitem if we don't have one, but also, after it's built check it's state.
-rw-r--r-- | src/datetime-service.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index e821dfc..c24b223 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -75,15 +75,21 @@ check_timezone_sync (void) { 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); + } + + if (tzchange != NULL) { + if (in_sync) { + dbusmenu_menuitem_property_set_bool(tzchange, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + } else { + 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); + dbusmenu_menuitem_property_set(tzchange, DBUSMENU_MENUITEM_PROP_LABEL, label); + dbusmenu_menuitem_property_set_bool(tzchange, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - g_free(label); + g_free(label); + } } return; @@ -241,6 +247,7 @@ build_menus (DbusmenuMenuitem * root) dbusmenu_menuitem_property_set(tzchange, DBUSMENU_MENUITEM_PROP_LABEL, "Set specific timezone"); dbusmenu_menuitem_property_set_bool(tzchange, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); dbusmenu_menuitem_child_append(root, tzchange); + check_timezone_sync(); settings = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings...")); |