aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/save-calendar/csv-format.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-14 14:54:20 +0800
committerMilan Crha <mcrha@redhat.com>2011-06-14 14:54:20 +0800
commit38790d8478e906a5c59d0c4a5216f297f305bfeb (patch)
tree0f9a96db2765901f2a27b68c84815a491214ecc1 /plugins/save-calendar/csv-format.c
parent08af0d1f81a4e983bb49d8fb8fe74e670adbb8f6 (diff)
downloadgsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar
gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.gz
gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.bz2
gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.lz
gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.xz
gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.zst
gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.zip
Do not use deprecated EBook/ECal API
Diffstat (limited to 'plugins/save-calendar/csv-format.c')
-rw-r--r--plugins/save-calendar/csv-format.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index 15ed83817e..da21588d8c 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -30,8 +30,8 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserverui/e-source-selector.h>
-#include <libecal/e-cal.h>
-#include "calendar/common/authentication.h"
+#include <libedataserverui/e-client-utils.h>
+#include <libecal/e-cal-client.h>
#include <string.h>
#include "format-handler.h"
@@ -300,7 +300,7 @@ userstring_to_systemstring (const gchar *userstring)
static void
do_save_calendar_csv (FormatHandler *handler,
ESourceSelector *selector,
- ECalSourceType type,
+ ECalClientSourceType type,
gchar *dest_uri)
{
@@ -314,9 +314,9 @@ do_save_calendar_csv (FormatHandler *handler,
*/
ESource *primary_source;
- ECal *source_client;
+ ECalClient *source_client;
GError *error = NULL;
- GList *objects=NULL;
+ GSList *objects = NULL;
GOutputStream *stream;
GString *line = NULL;
CsvConfig *config = NULL;
@@ -329,12 +329,16 @@ do_save_calendar_csv (FormatHandler *handler,
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;
}
@@ -354,8 +358,8 @@ do_save_calendar_csv (FormatHandler *handler,
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;
if (config->header) {
@@ -396,7 +400,7 @@ do_save_calendar_csv (FormatHandler *handler,
g_string_free (line, TRUE);
}
- while (objects != NULL) {
+ for (iter = objects; iter; iter = iter->next) {
ECalComponent *comp = objects->data;
gchar *delimiter_temp = NULL;
const gchar *temp_constchar;
@@ -521,11 +525,11 @@ do_save_calendar_csv (FormatHandler *handler,
/* It's written, so we can free it */
g_string_free (line, TRUE);
-
- objects = g_list_next (objects);
}
g_output_stream_close (stream, NULL, NULL);
+
+ e_cal_client_free_ecalcomp_slist (objects);
}
if (stream)