diff options
author | Milan Crha <mcrha@redhat.com> | 2009-04-25 00:07:32 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-04-25 00:07:32 +0800 |
commit | f171b15d926480a4199d74f14356b7aa37b16f20 (patch) | |
tree | 361a6444a49e70514ccbd3dc6f2b3e7943b46ae3 /plugins/publish-calendar/publish-format-ical.c | |
parent | 8b65b542f977e04fb938998309d707c7561d027b (diff) | |
download | gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.tar gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.tar.gz gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.tar.bz2 gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.tar.lz gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.tar.xz gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.tar.zst gsoc2013-evolution-f171b15d926480a4199d74f14356b7aa37b16f20.zip |
Show error or success to user with publish-calendar plugin
** Fix for bug #340783
* publish-format-fb.h: (publish_calendar_as_fb):
* publish-format-fb.c: (write_calendar), (publish_calendar_as_fb):
* publish-format-ical.h: (publish_calendar_as_ical):
* publish-format-ical.c: (write_calendar), (publish_calendar_as_ical):
* publish-calendar.c: (publish), (publish_no_succ_info),
(publish_uri_async), (publish_online), (mount_ready_cb),
(mount_first), (add_timeout), (add_offset_timeout),
(online_state_changed), (publish_urls), (action_publish),
(error_queue_show_idle), (error_queue_add):
Show error or success to user in a UI.
Diffstat (limited to 'plugins/publish-calendar/publish-format-ical.c')
-rw-r--r-- | plugins/publish-calendar/publish-format-ical.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/plugins/publish-calendar/publish-format-ical.c b/plugins/publish-calendar/publish-format-ical.c index f6dcc461c9..13962fc849 100644 --- a/plugins/publish-calendar/publish-format-ical.c +++ b/plugins/publish-calendar/publish-format-ical.c @@ -21,6 +21,7 @@ */ #include <string.h> +#include <glib/gi18n.h> #include <gconf/gconf-client.h> #include <libedataserver/e-source.h> #include <libedataserver/e-source-list.h> @@ -65,11 +66,10 @@ append_tz_to_comp (gpointer key, gpointer value, icalcomponent *toplevel) } static gboolean -write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream) +write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, GError **error) { ESource *source; ECal *client = NULL; - GError *error = NULL; GList *objects; icalcomponent *top_level; gboolean res = FALSE; @@ -78,23 +78,19 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream) if (source) client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); if (!client) { - g_warning (G_STRLOC ": Could not publish calendar: Calendar backend no longer exists"); + if (error) + *error = g_error_new (e_calendar_error_quark (), E_CALENDAR_STATUS_NO_SUCH_CALENDAR, _("Could not publish calendar: Calendar backend no longer exists")); return FALSE; } - if (!e_cal_open (client, TRUE, &error)) { - if (error) { - g_warning ("%s", error->message); - g_error_free (error); - } + if (!e_cal_open (client, TRUE, error)) { g_object_unref (client); return FALSE; } top_level = e_cal_util_new_top_level (); - error = NULL; - if (e_cal_get_object_list (client, "#t", &objects, &error)) { + if (e_cal_get_object_list (client, "#t", &objects, error)) { char *ical_string; CompTzData tdata; @@ -114,22 +110,17 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream) tdata.zones = NULL; ical_string = icalcomponent_as_ical_string_r (top_level); - res = g_output_stream_write_all (stream, ical_string, strlen (ical_string), NULL, NULL, &error); + res = g_output_stream_write_all (stream, ical_string, strlen (ical_string), NULL, NULL, error); g_free (ical_string); } g_object_unref (client); - if (error) { - g_warning ("%s", error->message); - g_error_free (error); - } - return res; } void -publish_calendar_as_ical (GOutputStream *stream, EPublishUri *uri) +publish_calendar_as_ical (GOutputStream *stream, EPublishUri *uri, GError **error) { GSList *l; ESourceList *source_list; @@ -142,7 +133,7 @@ publish_calendar_as_ical (GOutputStream *stream, EPublishUri *uri) l = uri->events; while (l) { gchar *uid = l->data; - if (!write_calendar (uid, source_list, stream)) + if (!write_calendar (uid, source_list, stream, error)) break; l = g_slist_next (l); } |