From 123c91f2412a0937ce1f55c4c7dda96fb0de5f5a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 2 Mar 2012 11:46:51 +0100 Subject: Bug #663745 - Option to create Google Calendar not available --- plugins/google-account-setup/Makefile.am | 1 + .../google-account-setup/google-contacts-source.c | 16 +++++++-------- plugins/google-account-setup/google-source.c | 23 +++++++++------------- 3 files changed, 18 insertions(+), 22 deletions(-) (limited to 'plugins/google-account-setup') diff --git a/plugins/google-account-setup/Makefile.am b/plugins/google-account-setup/Makefile.am index 7380912a40..9842673302 100644 --- a/plugins/google-account-setup/Makefile.am +++ b/plugins/google-account-setup/Makefile.am @@ -22,6 +22,7 @@ liborg_gnome_evolution_google_la_SOURCES = \ liborg_gnome_evolution_google_la_LIBADD = \ $(top_builddir)/calendar/gui/libevolution-calendar.la \ $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/shell/libeshell.la \ $(EVOLUTION_DATA_SERVER_LIBS) \ $(GNOME_PLATFORM_LIBS) \ $(GDATA_LIBS) diff --git a/plugins/google-account-setup/google-contacts-source.c b/plugins/google-account-setup/google-contacts-source.c index 5653881899..9345deba57 100644 --- a/plugins/google-account-setup/google-contacts-source.c +++ b/plugins/google-account-setup/google-contacts-source.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -42,17 +43,16 @@ void ensure_google_contacts_source_group (void) { - ESourceList *source_list; - const gchar *key; + EShellBackend *backend; + ESourceList *source_list = NULL; - key = "/apps/evolution/addressbook/sources"; - source_list = e_source_list_new_for_gconf_default (key); + backend = e_shell_get_backend_by_name (e_shell_get_default (), "contacts"); + g_return_if_fail (backend != NULL); - if (source_list == NULL) - return; + g_object_get (G_OBJECT (backend), "source-list", &source_list, NULL); + g_return_if_fail (source_list != NULL); - e_source_list_ensure_group ( - source_list, _("Google"), "google://", FALSE); + e_source_list_ensure_group (source_list, _("Google"), "google://", FALSE); g_object_unref (source_list); } diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index 76dd8ae2c4..b6dde02bd5 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -70,29 +71,23 @@ void e_calendar_google_migrate (EPlugin *epl, ECalEventTargetBackend *data); static void ensure_google_source_group (void) { - ESourceList *slist; - GError *error = NULL; + EShellBackend *backend; + ESourceList *source_list = NULL; - e_cal_client_get_sources ( - &slist, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &error); + backend = e_shell_get_backend_by_name (e_shell_get_default (), "calendar"); + g_return_if_fail (backend != NULL); - if (error != NULL) { - g_warning ( - "%s: Could not get calendar source list: %s", - G_STRFUNC, error->message); - g_error_free (error); - return; - } + g_object_get (G_OBJECT (backend), "source-list", &source_list, NULL); + g_return_if_fail (source_list != NULL); - e_source_list_ensure_group (slist, _("Google"), GOOGLE_BASE_URI, FALSE); - g_object_unref (slist); + e_source_list_ensure_group (source_list, _("Google"), GOOGLE_BASE_URI, FALSE); + g_object_unref (source_list); } gint e_plugin_lib_enable (EPlugin *ep, gint enable) { - if (enable) { d(printf ("\n Google Eplugin starting up ...\n")); ensure_google_source_group (); -- cgit v1.2.3