aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-02-15 10:23:36 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-02-15 10:23:36 -0600
commit891f491abc15b0ff9a97559fec5ed0c3fc87c149 (patch)
tree4a98ab9c462ef0cae95ca5b35831a51a8eb48e5b
parente89e4271e1c160036668e92f7106ec4c57994e07 (diff)
parentc6a2cec0b2c999bfb1461bb0080b9a10e3aa87d0 (diff)
downloadayatana-indicator-datetime-891f491abc15b0ff9a97559fec5ed0c3fc87c149.tar.gz
ayatana-indicator-datetime-891f491abc15b0ff9a97559fec5ed0c3fc87c149.tar.bz2
ayatana-indicator-datetime-891f491abc15b0ff9a97559fec5ed0c3fc87c149.zip
lp:~jjardon/indicator-datetime/fix-836017
-rw-r--r--src/datetime-service.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 227022f..dfce637 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -479,6 +479,24 @@ show_events_changed (void)
}
}
+static gboolean
+calendar_app_is_usable (void)
+{
+ /* confirm that it's installed... */
+ gchar *evo = g_find_program_in_path("evolution");
+ if (evo == NULL)
+ return FALSE;
+ g_debug ("found calendar app: '%s'", evo);
+ g_free (evo);
+
+ /* confirm that it's got an account set up... */
+ GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
+ const guint n = g_slist_length (accounts_list);
+ g_debug ("found %u evolution accounts", n);
+ g_slist_free (accounts_list);
+ return n > 0;
+}
+
/* Looks for the calendar application and enables the item if
we have one, starts ecal timer if events are turned on */
static gboolean
@@ -488,9 +506,7 @@ check_for_calendar (gpointer user_data)
dbusmenu_menuitem_property_set_bool(date, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
- gchar *evo = g_find_program_in_path("evolution");
- if (!get_greeter_mode () && evo != NULL) {
- g_debug("Found the calendar application: %s", evo);
+ if (!get_greeter_mode () && calendar_app_is_usable()) {
g_signal_connect (G_OBJECT(date), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
G_CALLBACK (activate_cb), "evolution -c calendar");
@@ -519,7 +535,6 @@ check_for_calendar (gpointer user_data)
g_signal_connect(calendar, "event::month-changed", G_CALLBACK(month_changed_cb), NULL);
g_signal_connect(calendar, "event::day-selected", G_CALLBACK(day_selected_cb), NULL);
g_signal_connect(calendar, "event::day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), NULL);
- g_free(evo);
} else {
g_debug("Unable to find calendar app.");
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);