aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-client')
-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
4 files changed, 62 insertions, 0 deletions
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);