From ab293db1e9f909b47b867f86ea2c222ad343c497 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Oct 2010 14:15:03 -0600 Subject: 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. --- src/datetime-service.c | 17 ++++++++++++----- 1 file 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...")); -- cgit v1.2.3