diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-03-28 22:16:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-03 11:00:43 +0800 |
commit | d502cc9f842d4530d11645c1c3bf5f47db7eb9db (patch) | |
tree | afff9cb8f5b44c0af9eaaac53c6ca5b7bf05790b /plugins/publish-calendar/publish-format-ical.c | |
parent | aa081cc6e87096434eb14e639787bc0a2942d366 (diff) | |
download | gsoc2013-evolution-d502cc9f842d4530d11645c1c3bf5f47db7eb9db.tar.gz gsoc2013-evolution-d502cc9f842d4530d11645c1c3bf5f47db7eb9db.tar.zst gsoc2013-evolution-d502cc9f842d4530d11645c1c3bf5f47db7eb9db.zip |
Adapt publish-calendar plugin to the new ESource API.
Diffstat (limited to 'plugins/publish-calendar/publish-format-ical.c')
-rw-r--r-- | plugins/publish-calendar/publish-format-ical.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/publish-calendar/publish-format-ical.c b/plugins/publish-calendar/publish-format-ical.c index 171fd6c1c0..8ff029301a 100644 --- a/plugins/publish-calendar/publish-format-ical.c +++ b/plugins/publish-calendar/publish-format-ical.c @@ -27,10 +27,13 @@ #include <string.h> #include <glib/gi18n.h> #include <libedataserver/e-source.h> -#include <libedataserver/e-source-list.h> +#include <libedataserver/e-source-registry.h> #include <libedataserverui/e-client-utils.h> #include <libecal/e-cal-client.h> #include <libecal/e-cal-util.h> + +#include <shell/e-shell.h> + #include "publish-format-ical.h" typedef struct { @@ -73,29 +76,31 @@ append_tz_to_comp (gpointer key, static gboolean write_calendar (const gchar *uid, - ESourceList *source_list, GOutputStream *stream, GError **error) { + EShell *shell; ESource *source; + ESourceRegistry *registry; ECalClient *client = NULL; GSList *objects; icalcomponent *top_level; gboolean res = FALSE; - source = e_source_list_peek_source_by_uid (source_list, uid); - if (source) + shell = e_shell_get_default (); + registry = e_shell_get_registry (shell); + source = e_source_registry_ref_source (registry, uid); + + if (source != NULL) { client = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error); + g_object_unref (source); + } if (!client) { if (error && !error) *error = g_error_new (E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR, _("Could not publish calendar: Calendar backend no longer exists")); return FALSE; } - g_signal_connect ( - client, "authenticate", - G_CALLBACK (e_client_utils_authenticate_handler), NULL); - if (!e_client_open_sync (E_CLIENT (client), TRUE, NULL, error)) { g_object_unref (client); return FALSE; @@ -140,19 +145,13 @@ publish_calendar_as_ical (GOutputStream *stream, GError **error) { GSList *l; - ESourceList *source_list; /* events */ - if (!e_cal_client_get_sources (&source_list, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error)) - return; - l = uri->events; while (l) { gchar *uid = l->data; - if (!write_calendar (uid, source_list, stream, error)) + if (!write_calendar (uid, stream, error)) break; l = g_slist_next (l); } - - g_object_unref (source_list); } |