aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/publish-calendar/publish-format-fb.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-04-25 00:07:32 +0800
committerMilan Crha <mcrha@redhat.com>2009-04-25 00:07:32 +0800
commitf171b15d926480a4199d74f14356b7aa37b16f20 (patch)
tree361a6444a49e70514ccbd3dc6f2b3e7943b46ae3 /plugins/publish-calendar/publish-format-fb.c
parent8b65b542f977e04fb938998309d707c7561d027b (diff)
downloadgsoc2013-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-fb.c')
-rw-r--r--plugins/publish-calendar/publish-format-fb.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/plugins/publish-calendar/publish-format-fb.c b/plugins/publish-calendar/publish-format-fb.c
index 40d0258f8a..5956b0ff8d 100644
--- a/plugins/publish-calendar/publish-format-fb.c
+++ b/plugins/publish-calendar/publish-format-fb.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <time.h>
+#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
#include <libedataserver/e-source.h>
#include <libedataserver/e-source-list.h>
@@ -32,11 +33,10 @@
#include "publish-format-fb.h"
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;
icaltimezone *utc;
time_t start = time(NULL), end;
@@ -53,28 +53,24 @@ 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;
}
- if (e_cal_get_cal_address (client, &email, &error)) {
+ if (e_cal_get_cal_address (client, &email, NULL)) {
if (email && *email)
users = g_list_append (users, email);
}
top_level = e_cal_util_new_top_level ();
- error = NULL;
- if (e_cal_get_free_busy (client, users, start, end, &objects, &error)) {
+ if (e_cal_get_free_busy (client, users, start, end, &objects, error)) {
char *ical_string;
while (objects) {
@@ -85,7 +81,7 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream)
}
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);
}
@@ -96,16 +92,11 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream)
g_free (email);
g_object_unref (client);
- if (error) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
return res;
}
void
-publish_calendar_as_fb (GOutputStream *stream, EPublishUri *uri)
+publish_calendar_as_fb (GOutputStream *stream, EPublishUri *uri, GError **error)
{
GSList *l;
ESourceList *source_list;
@@ -118,7 +109,7 @@ publish_calendar_as_fb (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);
}