diff options
author | Ted Gould <ted@gould.cx> | 2010-07-12 14:57:25 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-07-12 14:57:25 -0500 |
commit | 03e448f0dfaf9c3a268b1b089563b7fd65252b09 (patch) | |
tree | bcad26646dd6880c9256b3a49e102dcffecf682c | |
parent | f18df8357982711d1f3b1f9d766405592a6f6a16 (diff) | |
download | ayatana-indicator-datetime-03e448f0dfaf9c3a268b1b089563b7fd65252b09.tar.gz ayatana-indicator-datetime-03e448f0dfaf9c3a268b1b089563b7fd65252b09.tar.bz2 ayatana-indicator-datetime-03e448f0dfaf9c3a268b1b089563b7fd65252b09.zip |
Adding in a check for the calendar application.
-rw-r--r-- | src/datetime-service.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index ad64417..6cbaf93 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -31,6 +31,25 @@ activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command) } } +/* Looks for the calendar application and enables the item if + we have one */ +static gboolean +check_for_calendar (gpointer user_data) +{ + g_return_val_if_fail (calendar != NULL, FALSE); + + gchar *evo = g_find_program_in_path("evolution"); + if (evo != NULL) { + dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); + dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + g_free(evo); + } else { + dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_VISIBLE, 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. */ @@ -50,8 +69,11 @@ build_menus (DbusmenuMenuitem * root) dbusmenu_menuitem_property_set (calendar, DBUSMENU_MENUITEM_PROP_LABEL, _("Open Calendar")); /* insensitive until we check for available apps */ dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + g_signal_connect (G_OBJECT(calendar), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (activate_cb), "evolution -c calendar"); dbusmenu_menuitem_child_append(root, calendar); - // queue checking for apps + + g_idle_add(check_for_calendar, NULL); } DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); |