aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-10-07 17:20:44 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-10-07 17:20:44 +0800
commitc098c90ebb80d4072ac1ebabc26204fd0067a4b1 (patch)
tree62d86773b852cd4d9d0ebeb49df3c80ad0226ca2
parentfa5928750cff1b72d67102cd8a64e557b87479bf (diff)
downloadgsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.tar
gsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.tar.gz
gsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.tar.bz2
gsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.tar.lz
gsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.tar.xz
gsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.tar.zst
gsoc2013-evolution-c098c90ebb80d4072ac1ebabc26204fd0067a4b1.zip
Fixes #15892
2002-10-04 Rodrigo Moya <rodrigo@ximian.com> 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
-rw-r--r--calendar/ChangeLog33
-rw-r--r--calendar/cal-client/cal-client.c20
-rw-r--r--calendar/cal-client/cal-client.h2
-rw-r--r--calendar/cal-client/cal-listener.c34
-rw-r--r--calendar/cal-client/cal-listener.h6
-rw-r--r--calendar/gui/e-tasks.c19
-rw-r--r--calendar/gui/gnome-cal.c22
-rw-r--r--calendar/idl/evolution-calendar.idl3
-rw-r--r--calendar/pcs/cal-backend-file.c78
-rw-r--r--calendar/pcs/cal.c30
-rw-r--r--calendar/pcs/cal.h1
11 files changed, 222 insertions, 26 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 4c5fc899f7..330373f4ed 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,36 @@
+2002-10-04 Rodrigo Moya <rodrigo@ximian.com>
+
+ 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.
+
2002-10-02 Rodrigo Moya <rodrigo@ximian.com>
* gui/alarm-notify/notify-main.c (alarm_notify_factory_fn): removed
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) {
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index e7a1649a0c..bb1a02e8e6 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -107,6 +107,8 @@ struct _CalClientClass {
void (* obj_updated) (CalClient *client, const char *uid);
void (* obj_removed) (CalClient *client, const char *uid);
+ void (* backend_error) (CalClient *client, const char *message);
+
void (* categories_changed) (CalClient *client, GPtrArray *categories);
void (* forget_password) (CalClient *client, const char *key);
diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c
index c3fe31e60d..b96f0848fe 100644
--- a/calendar/cal-client/cal-listener.c
+++ b/calendar/cal-client/cal-listener.c
@@ -30,6 +30,7 @@ struct CalListenerPrivate {
CalListenerCalSetModeFn cal_set_mode_fn;
CalListenerObjUpdatedFn obj_updated_fn;
CalListenerObjRemovedFn obj_removed_fn;
+ CalListenerErrorOccurredFn error_occurred_fn;
CalListenerCategoriesChangedFn categories_changed_fn;
gpointer fn_data;
@@ -57,6 +58,9 @@ static void impl_notifyObjUpdated (PortableServer_Servant servant,
static void impl_notifyObjRemoved (PortableServer_Servant servant,
GNOME_Evolution_Calendar_CalObjUID uid,
CORBA_Environment *ev);
+static void impl_notifyErrorOccurred (PortableServer_Servant servant,
+ const CORBA_char *message,
+ CORBA_Environment *ev);
static void impl_notifyCategoriesChanged (PortableServer_Servant servant,
const GNOME_Evolution_Calendar_StringSeq *categories,
CORBA_Environment *ev);
@@ -84,6 +88,7 @@ cal_listener_class_init (CalListenerClass *class)
class->epv.notifyCalSetMode = impl_notifyCalSetMode;
class->epv.notifyObjUpdated = impl_notifyObjUpdated;
class->epv.notifyObjRemoved = impl_notifyObjRemoved;
+ class->epv.notifyErrorOccurred = impl_notifyErrorOccurred;
class->epv.notifyCategoriesChanged = impl_notifyCategoriesChanged;
object_class->destroy = cal_listener_destroy;
@@ -101,6 +106,7 @@ cal_listener_init (CalListener *listener)
priv->cal_opened_fn = NULL;
priv->obj_updated_fn = NULL;
priv->obj_removed_fn = NULL;
+ priv->error_occurred_fn = NULL;
priv->categories_changed_fn = NULL;
priv->notify = TRUE;
@@ -122,6 +128,7 @@ cal_listener_destroy (GtkObject *object)
priv->cal_opened_fn = NULL;
priv->obj_updated_fn = NULL;
priv->obj_removed_fn = NULL;
+ priv->error_occurred_fn = NULL;
priv->categories_changed_fn = NULL;
priv->fn_data = NULL;
@@ -228,6 +235,25 @@ impl_notifyObjRemoved (PortableServer_Servant servant,
(* priv->obj_removed_fn) (listener, uid, priv->fn_data);
}
+/* ::notifyErrorOccurred method */
+static void
+impl_notifyErrorOccurred (PortableServer_Servant servant,
+ const CORBA_char *message,
+ CORBA_Environment *ev)
+{
+ CalListener *listener;
+ CalListenerPrivate *priv;
+
+ listener = CAL_LISTENER (bonobo_object_from_servant (servant));
+ priv = listener->priv;
+
+ if (!priv->notify)
+ return;
+
+ g_assert (priv->error_occurred_fn != NULL);
+ (* priv->error_occurred_fn) (listener, message, priv->fn_data);
+}
+
/* ::notifyCategoriesChanged method */
static void
impl_notifyCategoriesChanged (PortableServer_Servant servant,
@@ -258,6 +284,7 @@ impl_notifyCategoriesChanged (PortableServer_Servant servant,
* calendar was updated.
* @obj_removed_fn: Function that will be called to notify that an object in the
* calendar was removed.
+ * @error_occurred_fn: Function that will be called to notify errors.
* @categories_changed_fn: Function that will be called to notify that the list
* of categories that are present in the calendar's objects has changed.
* @fn_data: Closure data pointer that will be passed to the notification
@@ -274,6 +301,7 @@ cal_listener_construct (CalListener *listener,
CalListenerCalSetModeFn cal_set_mode_fn,
CalListenerObjUpdatedFn obj_updated_fn,
CalListenerObjRemovedFn obj_removed_fn,
+ CalListenerErrorOccurredFn error_occurred_fn,
CalListenerCategoriesChangedFn categories_changed_fn,
gpointer fn_data)
{
@@ -285,6 +313,7 @@ cal_listener_construct (CalListener *listener,
g_return_val_if_fail (cal_set_mode_fn != NULL, NULL);
g_return_val_if_fail (obj_updated_fn != NULL, NULL);
g_return_val_if_fail (obj_removed_fn != NULL, NULL);
+ g_return_val_if_fail (error_occurred_fn != NULL, NULL);
g_return_val_if_fail (categories_changed_fn != NULL, NULL);
priv = listener->priv;
@@ -293,6 +322,7 @@ cal_listener_construct (CalListener *listener,
priv->cal_set_mode_fn = cal_set_mode_fn;
priv->obj_updated_fn = obj_updated_fn;
priv->obj_removed_fn = obj_removed_fn;
+ priv->error_occurred_fn = error_occurred_fn;
priv->categories_changed_fn = categories_changed_fn;
priv->fn_data = fn_data;
@@ -307,6 +337,7 @@ cal_listener_construct (CalListener *listener,
* calendar was updated.
* @obj_removed_fn: Function that will be called to notify that an object in the
* calendar was removed.
+ * @error_occurred_fn: Function that will be called to notify errors.
* @categories_changed_fn: Function that will be called to notify that the list
* of categories that are present in the calendar's objects has changed.
* @fn_data: Closure data pointer that will be passed to the notification
@@ -321,6 +352,7 @@ cal_listener_new (CalListenerCalOpenedFn cal_opened_fn,
CalListenerCalSetModeFn cal_set_mode_fn,
CalListenerObjUpdatedFn obj_updated_fn,
CalListenerObjRemovedFn obj_removed_fn,
+ CalListenerErrorOccurredFn error_occurred_fn,
CalListenerCategoriesChangedFn categories_changed_fn,
gpointer fn_data)
{
@@ -329,6 +361,7 @@ cal_listener_new (CalListenerCalOpenedFn cal_opened_fn,
g_return_val_if_fail (cal_opened_fn != NULL, NULL);
g_return_val_if_fail (obj_updated_fn != NULL, NULL);
g_return_val_if_fail (obj_removed_fn != NULL, NULL);
+ g_return_val_if_fail (error_occurred_fn != NULL, NULL);
g_return_val_if_fail (categories_changed_fn != NULL, NULL);
listener = gtk_type_new (CAL_LISTENER_TYPE);
@@ -337,6 +370,7 @@ cal_listener_new (CalListenerCalOpenedFn cal_opened_fn,
cal_set_mode_fn,
obj_updated_fn,
obj_removed_fn,
+ error_occurred_fn,
categories_changed_fn,
fn_data);
}
diff --git a/calendar/cal-client/cal-listener.h b/calendar/cal-client/cal-listener.h
index c7488e6e97..4d557a1fbc 100644
--- a/calendar/cal-client/cal-listener.h
+++ b/calendar/cal-client/cal-listener.h
@@ -69,6 +69,10 @@ typedef void (* CalListenerObjRemovedFn) (CalListener *listener,
const GNOME_Evolution_Calendar_CalObjUID uid,
gpointer data);
+typedef void (* CalListenerErrorOccurredFn) (CalListener *listener,
+ const char *message,
+ gpointer data);
+
typedef void (* CalListenerCategoriesChangedFn) (CalListener *listener,
const GNOME_Evolution_Calendar_StringSeq *categories,
gpointer data);
@@ -81,6 +85,7 @@ CalListener *cal_listener_construct (CalListener *listener,
CalListenerCalSetModeFn cal_set_mode_fn,
CalListenerObjUpdatedFn obj_updated_fn,
CalListenerObjRemovedFn obj_removed_fn,
+ CalListenerErrorOccurredFn error_occurred_fn,
CalListenerCategoriesChangedFn categories_changed_fn,
gpointer fn_data);
@@ -88,6 +93,7 @@ CalListener *cal_listener_new (CalListenerCalOpenedFn cal_opened_fn,
CalListenerCalSetModeFn cal_set_mode_fn,
CalListenerObjUpdatedFn obj_updated_fn,
CalListenerObjRemovedFn obj_removed_fn,
+ CalListenerErrorOccurredFn error_occurred_fn,
CalListenerCategoriesChangedFn categories_changed_fn,
gpointer fn_data);
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index d0097cc015..17cce37bd2 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -67,6 +67,7 @@ static void setup_widgets (ETasks *tasks);
static void e_tasks_destroy (GtkObject *object);
static void cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data);
+static void backend_error_cb (CalClient *client, const char *message, gpointer data);
/* Signal IDs */
enum {
@@ -248,6 +249,8 @@ e_tasks_construct (ETasks *tasks)
gtk_signal_connect (GTK_OBJECT (priv->client), "cal_opened",
GTK_SIGNAL_FUNC (cal_opened_cb), tasks);
+ gtk_signal_connect (GTK_OBJECT (priv->client), "backend_error",
+ GTK_SIGNAL_FUNC (backend_error_cb), tasks);
gtk_signal_connect (GTK_OBJECT (priv->client), "categories_changed",
GTK_SIGNAL_FUNC (client_categories_changed_cb), tasks);
@@ -452,6 +455,22 @@ cal_opened_cb (CalClient *client,
}
}
+/* Callback from the calendar client when an error occurs in the backend */
+static void
+backend_error_cb (CalClient *client, const char *message, gpointer data)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+ char *errmsg;
+
+ tasks = E_TASKS (data);
+ priv = tasks->priv;
+
+ errmsg = g_strdup_printf (_("Error on %s:\n %s"), cal_client_get_uri (client), message);
+ gnome_error_dialog_parented (errmsg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))));
+ g_free (errmsg);
+}
+
/**
* e_tasks_get_cal_client:
* @tasks: An #ETasks.
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 32f6cd15ed..5885185e73 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1730,6 +1730,22 @@ client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer
free_categories (merged);
}
+/* Callback when we get an error message from the backend */
+static void
+backend_error_cb (CalClient *client, const char *message, gpointer data)
+{
+ GnomeCalendar *gcal;
+ GnomeCalendarPrivate *priv;
+ char *errmsg;
+
+ gcal = GNOME_CALENDAR (data);
+ priv = gcal->priv;
+
+ errmsg = g_strdup_printf (_("Error on %s:\n %s"), cal_client_get_uri (client), message);
+ gnome_error_dialog_parented (errmsg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
+ g_free (errmsg);
+}
+
/* Callback when the backend dies */
static void
backend_died_cb (CalClient *client, gpointer data)
@@ -1779,6 +1795,8 @@ gnome_calendar_construct (GnomeCalendar *gcal)
gtk_signal_connect (GTK_OBJECT (priv->client), "cal_opened",
GTK_SIGNAL_FUNC (client_cal_opened_cb), gcal);
+ gtk_signal_connect (GTK_OBJECT (priv->client), "backend_error",
+ GTK_SIGNAL_FUNC (backend_error_cb), gcal);
gtk_signal_connect (GTK_OBJECT (priv->client), "categories_changed",
GTK_SIGNAL_FUNC (client_categories_changed_cb), gcal);
gtk_signal_connect (GTK_OBJECT (priv->client), "backend_died",
@@ -1801,7 +1819,9 @@ gnome_calendar_construct (GnomeCalendar *gcal)
return NULL;
gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "cal_opened",
- GTK_SIGNAL_FUNC (client_cal_opened_cb), gcal);
+ GTK_SIGNAL_FUNC (client_cal_opened_cb), gcal);
+ gtk_signal_connect (GTK_OBJECT (priv->client), "backend_error",
+ GTK_SIGNAL_FUNC (backend_error_cb), gcal);
gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "categories_changed",
GTK_SIGNAL_FUNC (client_categories_changed_cb), gcal);
gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "backend_died",
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index 78fe0ba07a..c7abc2ca7e 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -263,6 +263,9 @@ module Calendar {
/* Called from a Calendar when the list of categories changes */
void notifyCategoriesChanged (in StringSeq categories);
+
+ /* Called from a Calendar when there is an error not notified otherwise */
+ void notifyErrorOccurred (in string message);
};
/* Handle to a live query on a calendar */
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 4fd65904cc..2def3bb57b 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -282,11 +282,11 @@ static void
save (CalBackendFile *cbfile)
{
CalBackendFilePrivate *priv;
- GnomeVFSURI *uri;
+ GnomeVFSURI *uri, *backup_uri;
GnomeVFSHandle *handle = NULL;
GnomeVFSResult result;
GnomeVFSFileSize out;
- gchar *tmp;
+ gchar *tmp, *backup_uristr;
char *buf;
priv = cbfile->priv;
@@ -297,43 +297,54 @@ save (CalBackendFile *cbfile)
if (!uri)
goto error;
- /* Make a backup copy of the file if it exists */
+ /* save calendar to backup file */
tmp = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- if (tmp) {
- GnomeVFSURI *backup_uri;
- gchar *backup_uristr;
-
- backup_uristr = g_strconcat (tmp, "~", NULL);
- backup_uri = gnome_vfs_uri_new (backup_uristr);
-
- result = gnome_vfs_move_uri (uri, backup_uri, TRUE);
- gnome_vfs_uri_unref (backup_uri);
+ if (!tmp) {
+ gnome_vfs_uri_unref (uri);
+ goto error;
+ }
- g_free (tmp);
- g_free (backup_uristr);
+ backup_uristr = g_strconcat (tmp, "~", NULL);
+ backup_uri = gnome_vfs_uri_new (backup_uristr);
+
+ g_free (tmp);
+ g_free (backup_uristr);
+
+ if (!backup_uri) {
+ gnome_vfs_uri_unref (uri);
+ goto error;
}
- /* Now write the new file out */
- result = gnome_vfs_create_uri (&handle, uri,
- GNOME_VFS_OPEN_WRITE,
- FALSE, 0666);
-
- if (result != GNOME_VFS_OK)
+ result = gnome_vfs_create_uri (&handle, backup_uri,
+ GNOME_VFS_OPEN_WRITE,
+ FALSE, 0666);
+ if (result != GNOME_VFS_OK) {
+ gnome_vfs_uri_unref (uri);
+ gnome_vfs_uri_unref (backup_uri);
goto error;
-
+ }
+
buf = icalcomponent_as_ical_string (priv->icalcomp);
result = gnome_vfs_write (handle, buf, strlen (buf) * sizeof (char), &out);
-
- if (result != GNOME_VFS_OK)
+ gnome_vfs_close (handle);
+ if (result != GNOME_VFS_OK) {
+ gnome_vfs_uri_unref (uri);
+ gnome_vfs_uri_unref (backup_uri);
goto error;
+ }
+
+ /* now copy the temporary file to the real file */
+ result = gnome_vfs_move_uri (backup_uri, uri, TRUE);
- gnome_vfs_close (handle);
gnome_vfs_uri_unref (uri);
+ gnome_vfs_uri_unref (backup_uri);
+ if (result != GNOME_VFS_OK)
+ goto error;
return;
error:
- g_warning ("Error writing calendar file.");
+ notify_error (cbfile, gnome_vfs_result_to_string (result));
return;
}
@@ -1713,6 +1724,23 @@ notify_remove (CalBackendFile *cbfile, const char *uid)
}
}
+/* Notifies a backend's clients that an error has occurred */
+static void
+notify_error (CalBackendFile *cbfile, const char *message)
+{
+ CalBackendFilePrivate *priv;
+ GList *l;
+
+ priv = cbfile->priv;
+
+ for (l = CAL_BACKEND (cbfile)->clients; l; l = l->next) {
+ Cal *cal;
+
+ cal = CAL (l->data);
+ cal_notify_error (cal, message);
+ }
+}
+
/* Used from g_hash_table_foreach_remove(); removes and frees a category */
static gboolean
remove_category_cb (gpointer key, gpointer value, gpointer data)
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 60fcdc59ad..861cc47c89 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -874,6 +874,36 @@ cal_notify_remove (Cal *cal, const char *uid)
}
/**
+ * cal_notify_error
+ * @cal: A calendar client interface.
+ * @message: Error message.
+ *
+ * Notify a calendar client of an error occurred in the backend.
+ */
+void
+cal_notify_error (Cal *cal, const char *message)
+{
+ CalPrivate *priv;
+ CORBA_Environment ev;
+
+ g_return_if_fail (cal != NULL);
+ g_return_if_fail (IS_CAL (cal));
+ g_return_if_fail (message != NULL);
+
+ priv = cal->priv;
+ g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Calendar_Listener_notifyErrorOccurred (priv->listener, (char *) message, &ev);
+
+ if (BONOBO_EX (&ev))
+ g_message ("cal_notify_remove(): could not notify the listener "
+ "about a removed object");
+
+ CORBA_exception_free (&ev);
+}
+
+/**
* cal_notify_categories_changed:
* @cal: A calendar client interface.
* @categories: List of categories.
diff --git a/calendar/pcs/cal.h b/calendar/pcs/cal.h
index 9b6636b9d0..52889b4f9a 100644
--- a/calendar/pcs/cal.h
+++ b/calendar/pcs/cal.h
@@ -66,6 +66,7 @@ void cal_notify_mode (Cal *cal,
GNOME_Evolution_Calendar_CalMode mode);
void cal_notify_update (Cal *cal, const char *uid);
void cal_notify_remove (Cal *cal, const char *uid);
+void cal_notify_error (Cal *cal, const char *message);
void cal_notify_categories_changed (Cal *cal, GNOME_Evolution_Calendar_StringSeq *categories);