diff options
author | Milan Crha <mcrha@redhat.com> | 2010-07-09 20:29:51 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-07-09 20:29:51 +0800 |
commit | 03d626856b294bc98919ac244e04e9b8821a681d (patch) | |
tree | 62433e158f1791aa6b9222ecbe05d164c4703f6c /plugins/itip-formatter | |
parent | 6d4ce8571ff62a3e489999d2feeac1691e06c59a (diff) | |
download | gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.gz gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.bz2 gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.lz gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.xz gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.tar.zst gsoc2013-evolution-03d626856b294bc98919ac244e04e9b8821a681d.zip |
Bug #623204 - Be able to report detailed errors from backends
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index cbefc53bc4..c0d4e1034e 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -145,7 +145,7 @@ typedef struct { gint count; } FormatItipFindData; -typedef void (* FormatItipOpenFunc) (ECal *ecal, ECalendarStatus status, gpointer data); +typedef void (* FormatItipOpenFunc) (ECal *ecal, const GError *error, gpointer data); static gboolean check_is_instance (icalcomponent *icalcomp); @@ -472,24 +472,25 @@ set_buttons_sensitive (struct _itip_puri *pitip) } static void -add_failed_to_load_msg (ItipView *view, ESource *source, ECalendarStatus status) +add_failed_to_load_msg (ItipView *view, ESource *source, const GError *error) { - gchar *msg, *msg_full; + gchar *msg; g_return_if_fail (view != NULL); g_return_if_fail (source != NULL); + g_return_if_fail (error != NULL); - msg = g_strdup_printf (_("Failed to load the calendar '%s'"), e_source_peek_name (source)); - msg_full = g_strconcat (msg, " (", e_cal_get_error_message (status), ")", NULL); + /* Translators: The first '%s' is replaced with a calendar name, + the second '%s' with an error message */ + msg = g_strdup_printf (_("Failed to load the calendar '%s' (%s)"), e_source_peek_name (source), error->message); - itip_view_add_lower_info_item (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, msg_full); + itip_view_add_lower_info_item (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, msg); - g_free (msg_full); g_free (msg); } static void -cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) +cal_opened_cb (ECal *ecal, const GError *error, gpointer data) { struct _itip_puri *pitip = data; ESource *source; @@ -500,10 +501,10 @@ cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, cal_opened_cb, NULL); - if (status != E_CALENDAR_STATUS_OK) { + if (error) { d(printf ("Failed opening itip formatter calendar '%s' during non-search opening\n", e_source_peek_name (source))); - add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, status); + add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error); if (pitip->current_ecal == ecal) { pitip->current_ecal = NULL; @@ -561,7 +562,7 @@ start_calendar_server (struct _itip_puri *pitip, ESource *source, ECalSourceType if (!ecal) return NULL; - g_signal_connect (G_OBJECT (ecal), "cal_opened", G_CALLBACK (func), data); + g_signal_connect (G_OBJECT (ecal), "cal_opened_ex", G_CALLBACK (func), data); g_hash_table_insert (pitip->ecals[type], g_strdup (e_source_peek_uid (source)), ecal); @@ -604,7 +605,7 @@ source_selected_cb (ItipView *view, ESource *source, gpointer data) } static void -find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) +find_cal_opened_cb (ECal *ecal, const GError *error, gpointer data) { FormatItipFindData *fd = data; struct _itip_puri *pitip = fd->puri; @@ -620,12 +621,12 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, find_cal_opened_cb, NULL); - if (status != E_CALENDAR_STATUS_OK) { + if (error) { /* FIXME Do we really want to warn here? If we fail * to find the item, this won't be cleared but the * selector might be shown */ d(printf ("Failed opening itip formatter calendar '%s' during search opening... ", e_source_peek_name (source))); - add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, status); + add_failed_to_load_msg (ITIP_VIEW (pitip->view), source, error); if (pitip->current_ecal == ecal) { pitip->current_ecal = NULL; |