aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
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 /calendar/gui
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
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-tasks.c19
-rw-r--r--calendar/gui/gnome-cal.c22
2 files changed, 40 insertions, 1 deletions
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",