From 7d20b8fd5fd28a90852c737f35cef7ba03a2c116 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Nov 2010 14:44:23 -0400 Subject: Utilize the new ESourceSelector:primary-selection property. --- plugins/save-calendar/rdf-format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 8014fe9ddf..462f4f2a31 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -191,7 +191,7 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSou if (!dest_uri) return; - primary_source = e_source_selector_peek_primary_selection (selector); + primary_source = e_source_selector_get_primary_selection (selector); /* open source client */ source_client = e_auth_new_cal_from_source (primary_source, type); -- cgit v1.2.3 From 8a186c3588d3598857c36e2122fa68d01eba30fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 May 2011 13:24:42 -0400 Subject: Coding style cleanups. --- plugins/save-calendar/rdf-format.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 462f4f2a31..084250e70c 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -101,10 +101,10 @@ add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type) switch (type) { case ECALCOMPONENTATTENDEE: - str = ((ECalComponentAttendee*)list->data)->value; + str = ((ECalComponentAttendee*) list->data)->value; break; case ECALCOMPONENTTEXT: - str = ((ECalComponentText*)list->data)->value; + str = ((ECalComponentText*) list->data)->value; break; case CONSTCHAR: default: @@ -124,7 +124,7 @@ add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric) { if (nummeric) { gchar *value = g_strdup_printf ("%d", *nummeric); - xmlNodePtr cur_node = xmlNewChild (node, NULL, (guchar *)tag, (guchar *)value); + xmlNodePtr cur_node = xmlNewChild (node, NULL, (guchar *) tag, (guchar *) value); xmlSetProp (cur_node, (const guchar *)"rdf:datatype", (const guchar *)"http://www.w3.org/2001/XMLSchema#integer"); g_free (value); } @@ -146,7 +146,7 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) * */ e_utf8_strftime (str, 200, _("%FT%T"), &mytm); - cur_node = xmlNewChild (node, NULL, (guchar *)tag, (guchar *)str); + cur_node = xmlNewChild (node, NULL, (guchar *) tag, (guchar *) str); /* Not sure about this property */ timezone = calendar_config_get_timezone (); @@ -163,7 +163,7 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value) { if (value) { xmlNodePtr cur_node = NULL; - cur_node = xmlNewChild (node, NULL, (guchar *)tag, (guchar *)value); + cur_node = xmlNewChild (node, NULL, (guchar *) tag, (guchar *) value); xmlSetProp (cur_node, (const guchar *)"rdf:datatype", (const guchar *)"http://www.w3.org/2001/XMLSchema#string"); } } -- cgit v1.2.3 From 38790d8478e906a5c59d0c4a5216f297f305bfeb 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 From 749d08d537b5de44ab852658276a165ea351b49b Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Wed, 27 Jul 2011 14:50:20 +0200 Subject: Drop the duplicated 'Format' from filetype descriptionsto also sync strings with the ones used in shell/e-shell-utils.c --- plugins/save-calendar/rdf-format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 c64b31f055..37a936c132 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -372,7 +372,7 @@ FormatHandler *rdf_format_handler_new (void) FormatHandler *handler = g_new (FormatHandler, 1); handler->isdefault = FALSE; - handler->combo_label = _("RDF format (.rdf)"); + handler->combo_label = _("RDF (.rdf)"); handler->filename_ext = ".rdf"; handler->options_widget = NULL; handler->save = do_save_calendar_rdf; -- cgit v1.2.3 From fcbbdfbd18e15b4ee8322a0217cf03a689a5e033 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- plugins/save-calendar/rdf-format.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 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 37a936c132..c93eb1fb59 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -41,8 +41,9 @@ #include "format-handler.h" -static void -add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value); +static void add_string_to_rdf (xmlNodePtr node, + const gchar *tag, + const gchar *value); /* Use { */ @@ -79,7 +80,8 @@ enum { /* XML helper enum */ }; static void -display_error_message (GtkWidget *parent, GError *error) +display_error_message (GtkWidget *parent, + GError *error) { GtkWidget *dialog; @@ -91,7 +93,10 @@ display_error_message (GtkWidget *parent, GError *error) /* Some helpers for the xml stuff */ static void -add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type) +add_list_to_rdf (xmlNodePtr node, + const gchar *tag, + GSList *list_in, + gint type) { if (list_in) { GSList *list = list_in; @@ -101,10 +106,10 @@ add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type) switch (type) { case ECALCOMPONENTATTENDEE: - str = ((ECalComponentAttendee*) list->data)->value; + str = ((ECalComponentAttendee *) list->data)->value; break; case ECALCOMPONENTTEXT: - str = ((ECalComponentText*) list->data)->value; + str = ((ECalComponentText *) list->data)->value; break; case CONSTCHAR: default: @@ -120,7 +125,9 @@ add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type) } static void -add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric) +add_nummeric_to_rdf (xmlNodePtr node, + const gchar *tag, + gint *nummeric) { if (nummeric) { gchar *value = g_strdup_printf ("%d", *nummeric); @@ -131,7 +138,9 @@ add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric) } static void -add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) +add_time_to_rdf (xmlNodePtr node, + const gchar *tag, + icaltimetype *time) { if (time) { xmlNodePtr cur_node = NULL; @@ -159,7 +168,9 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) } static void -add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value) +add_string_to_rdf (xmlNodePtr node, + const gchar *tag, + const gchar *value) { if (value) { xmlNodePtr cur_node = NULL; @@ -169,7 +180,10 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value) } static void -do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalClientSourceType type, gchar *dest_uri) +do_save_calendar_rdf (FormatHandler *handler, + ESourceSelector *selector, + ECalClientSourceType type, + gchar *dest_uri) { /* @@ -211,7 +225,7 @@ do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalCli if (stream && e_cal_client_get_object_list_as_comps_sync (source_client, "#t", &objects, NULL, NULL)) { GSList *iter; - xmlBufferPtr buffer=xmlBufferCreate (); + xmlBufferPtr buffer = xmlBufferCreate (); xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0"); xmlNodePtr fnode; -- cgit v1.2.3