From c098c90ebb80d4072ac1ebabc26204fd0067a4b1 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 7 Oct 2002 09:20:44 +0000 Subject: Fixes #15892 2002-10-04 Rodrigo Moya Fixes #15892 * idl/evolution-calendar.idl: added notifyErrorOccurred method to the Listener interface, so that backends can notify clients of errors that can't be reported otherwise. * pcs/cal.[ch] (cal_notify_error): new function. * pcs/cal-backend-file.c (save): made to save to temporary file and then moved to the correct file, so that we don't lose any data if there's a problem while saving. (notify_error): new function for notifying error messages to clients. * cal-client/cal-listener.[ch]: added new callback function for getting error messages from backends. (impl_notifyErrorOccurred): new method implementation. (cal_listener_class_init): initialize new epv member. (cal_listener_init, cal_listener_destroy, cal_listener_construct, cal_listener_new): initialize new function pointer. * cal-client/cal-client.[ch]: adapted to changes in CalListener class. (cal_client_class_init): added "backend_error" signal to CalClient class. (backend_error_cb): callback for "error_occurred" signal on the CalListener, which just emits the "backend_error" signal of CalClient. * gui/gnome-cal.c (gnome_calendar_construct): connect to "backend_error" signal on the CalClient's we create. (backend_error_cb): display error message on error from backend. * gui/e-tasks.c: likewise. svn path=/trunk/; revision=18329 --- calendar/cal-client/cal-client.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'calendar/cal-client/cal-client.c') diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index ae4ab40c94..ec5401fb0f 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -86,6 +86,7 @@ enum { CAL_SET_MODE, OBJ_UPDATED, OBJ_REMOVED, + BACKEND_ERROR, CATEGORIES_CHANGED, FORGET_PASSWORD, BACKEND_DIED, @@ -188,6 +189,14 @@ cal_client_class_init (CalClientClass *class) gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + cal_client_signals[BACKEND_ERROR] = + gtk_signal_new ("backend_error", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, backend_error), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); cal_client_signals[CATEGORIES_CHANGED] = gtk_signal_new ("categories_changed", GTK_RUN_FIRST, @@ -561,6 +570,16 @@ obj_removed_cb (CalListener *listener, const GNOME_Evolution_Calendar_CalObjUID gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_REMOVED], uid); } +/* Handle the error_occurred signal from the listener */ +static void +backend_error_cb (CalListener *listener, const char *message, gpointer data) +{ + CalClient *client; + + client = CAL_CLIENT (data); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[BACKEND_ERROR], message); +} + /* Handle the categories_changed signal from the listener */ static void categories_changed_cb (CalListener *listener, const GNOME_Evolution_Calendar_StringSeq *categories, @@ -752,6 +771,7 @@ real_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exi cal_set_mode_cb, obj_updated_cb, obj_removed_cb, + backend_error_cb, categories_changed_cb, client); if (!priv->listener) { -- cgit v1.2.3