aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/publish-calendar/publish-format-fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/publish-calendar/publish-format-fb.c')
-rw-r--r--plugins/publish-calendar/publish-format-fb.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/publish-calendar/publish-format-fb.c b/plugins/publish-calendar/publish-format-fb.c
index 7b9e3e1660..d6ba7e5c74 100644
--- a/plugins/publish-calendar/publish-format-fb.c
+++ b/plugins/publish-calendar/publish-format-fb.c
@@ -28,11 +28,14 @@
#include <time.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 <libecal/e-cal-time-util.h>
+
+#include <shell/e-shell.h>
+
#include "publish-format-fb.h"
static void
@@ -54,13 +57,14 @@ free_busy_data_cb (ECalClient *client,
static gboolean
write_calendar (const gchar *uid,
- ESourceList *source_list,
GOutputStream *stream,
gint dur_type,
gint dur_value,
GError **error)
{
+ EShell *shell;
ESource *source;
+ ESourceRegistry *registry;
ECalClient *client = NULL;
GSList *objects = NULL;
icaltimezone *utc;
@@ -86,19 +90,20 @@ write_calendar (const gchar *uid,
break;
}
- 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;
@@ -148,19 +153,13 @@ publish_calendar_as_fb (GOutputStream *stream,
GError **error)
{
GSList *l;
- ESourceList *source_list;
-
- if (!e_cal_client_get_sources (&source_list, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, error))
- return;
/* events */
l = uri->events;
while (l) {
gchar *uid = l->data;
- if (!write_calendar (uid, source_list, stream, uri->fb_duration_type, uri->fb_duration_value, error))
+ if (!write_calendar (uid, stream, uri->fb_duration_type, uri->fb_duration_value, error))
break;
l = g_slist_next (l);
}
-
- g_object_unref (source_list);
}