From bf4edf2bc976a6ac8459d7f8583269c6a3ca6f2a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 3 Oct 2012 17:51:58 -0500 Subject: don't use gconf to see if evolution accounts are installed -- we can have calendars even if gconf returns empty --- src/datetime-service.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/datetime-service.c') diff --git a/src/datetime-service.c b/src/datetime-service.c index 441cbf0..0064519 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -29,7 +29,6 @@ with this program. If not, see . #include #include #include -#include #include #include @@ -91,7 +90,6 @@ static GList * comp_instances = NULL; static gboolean updating_appointments = FALSE; static time_t start_time_appointments = (time_t) 0; static GSettings * conf = NULL; -static GConfClient * gconf = NULL; /* Geoclue trackers */ @@ -537,12 +535,20 @@ calendar_app_is_usable (void) 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_full (accounts_list, g_free); - return n > 0; + /* see if there are any enabled calendars */ + gboolean has_enabled_calendar_source = FALSE; + ESourceRegistry * registry = e_source_registry_new_sync (NULL, NULL); + if (registry != NULL) { + GList * l = NULL; + GList * sources = NULL; + sources = e_source_registry_list_sources (registry, E_SOURCE_EXTENSION_CALENDAR); + for (l=sources; !has_enabled_calendar_source && l!=NULL; l=l->next) + has_enabled_calendar_source = e_source_get_enabled (E_SOURCE(l->data)); + g_list_free_full (sources, g_object_unref); + g_object_unref (registry); + } + + return has_enabled_calendar_source; } /* Looks for the calendar application and enables the item if @@ -1410,8 +1416,6 @@ main (int argc, char ** argv) /* Set up GSettings */ conf = g_settings_new(SETTINGS_INTERFACE); - /* Set up gconf for getting evolution enabled calendars */ - gconf = gconf_client_get_default(); // TODO Add a signal handler to catch gsettings changes and respond to them /* Building the base menu */ -- cgit v1.2.3