From 84339b3be5a771406fcd5898bbd21dc1c5b98c82 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 14 Jun 2011 08:54:20 +0200 Subject: Do not use deprecated EBook/ECal API --- plugins/save-calendar/rdf-format.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'plugins/save-calendar/rdf-format.c') diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c index 084250e70c..c64b31f055 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -27,8 +27,9 @@ #include #include #include +#include #include -#include +#include #include #include #include @@ -38,7 +39,6 @@ #include #include -#include "calendar/common/authentication.c" #include "format-handler.h" static void @@ -169,7 +169,7 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value) } static void -do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri) +do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri) { /* @@ -182,9 +182,9 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou */ ESource *primary_source; - ECal *source_client; + ECalClient *source_client; GError *error = NULL; - GList *objects=NULL; + GSList *objects = NULL; gchar *temp = NULL; GOutputStream *stream; @@ -194,17 +194,23 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou primary_source = e_source_selector_get_primary_selection (selector); /* open source client */ - source_client = e_auth_new_cal_from_source (primary_source, type); - if (!e_cal_open (source_client, TRUE, &error)) { + source_client = e_cal_client_new (primary_source, type, &error); + if (source_client) + g_signal_connect (source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + + if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error); - g_object_unref (source_client); + if (source_client) + g_object_unref (source_client); g_error_free (error); return; } stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error); - if (stream && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) { + if (stream && e_cal_client_get_object_list_as_comps_sync (source_client, "#t", &objects, NULL, NULL)) { + GSList *iter; + xmlBufferPtr buffer=xmlBufferCreate (); xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0"); xmlNodePtr fnode; @@ -238,7 +244,7 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou /* Version of this RDF-format */ xmlNewChild (fnode, NULL, (const guchar *)"version", (const guchar *)"2.0"); - while (objects != NULL) { + for (iter = objects; iter; iter = iter->next) { ECalComponent *comp = objects->data; const gchar *temp_constchar; gchar *tmp_str = NULL; @@ -334,8 +340,6 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou * http://www.gnome.org/projects/evolution/developer-doc/libecal/ECalComponent.html * #e-cal-component-get-last-modified */ - - objects = g_list_next (objects); } /* I used a buffer rather than xmlDocDump: I want gio support */ @@ -344,6 +348,8 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou g_output_stream_write_all (stream, xmlBufferContent (buffer), xmlBufferLength (buffer), NULL, NULL, &error); g_output_stream_close (stream, NULL, NULL); + e_cal_client_free_ecalcomp_slist (objects); + xmlBufferFree (buffer); xmlFreeDoc (doc); } -- cgit v1.2.3