diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-tasks.c | 19 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 22 |
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", |