aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-12 15:28:16 -0500
committerTed Gould <ted@gould.cx>2010-07-12 15:28:16 -0500
commit16a8df4b6d59fe642984ccae311f424017c8c0bc (patch)
tree90c5755be69be5b391549fb7a9020d58f54c9bda /src
parentf257b20a08c111c630e72f31d0e1431eb238253e (diff)
downloadayatana-indicator-datetime-16a8df4b6d59fe642984ccae311f424017c8c0bc.tar.gz
ayatana-indicator-datetime-16a8df4b6d59fe642984ccae311f424017c8c0bc.tar.bz2
ayatana-indicator-datetime-16a8df4b6d59fe642984ccae311f424017c8c0bc.zip
Setting up checking for time-admin as well.
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 37e5af4..a701453 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -18,6 +18,7 @@ static DbusmenuMenuitem * root = NULL;
/* Global Items */
static DbusmenuMenuitem * date = NULL;
static DbusmenuMenuitem * calendar = NULL;
+static DbusmenuMenuitem * settings = NULL;
/* Updates the label in the date menuitem */
static gboolean
@@ -81,6 +82,26 @@ check_for_calendar (gpointer user_data)
return FALSE;
}
+/* Looks for the time and date admin application and enables the
+ item we have one */
+static gboolean
+check_for_timeadmin (gpointer user_data)
+{
+ g_return_val_if_fail (settings != NULL, FALSE);
+
+ gchar * timeadmin = g_find_program_in_path("time-admin");
+ if (timeadmin != NULL) {
+ g_debug("Found the time-admin application: %s", timeadmin);
+ dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ g_free(timeadmin);
+ } else {
+ g_debug("Unable to find time-admin app.");
+ dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
+ }
+
+ return FALSE;
+}
+
/* Does the work to build the default menu, really calls out
to other functions but this is the core to clean up the
main function. */
@@ -114,12 +135,13 @@ build_menus (DbusmenuMenuitem * root)
dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_append(root, separator);
- DbusmenuMenuitem * settings = dbusmenu_menuitem_new();
+ settings = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Set Time and Date..."));
/* insensitive until we check for available apps */
dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "time-admin");
dbusmenu_menuitem_child_append(root, settings);
+ g_idle_add(check_for_timeadmin, NULL);
return;
}