aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2004-01-22 02:50:19 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-01-22 02:50:19 +0800
commit5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51 (patch)
treefa829112feb4eeece07eb7e6f8fd7057d9e70fa9
parent4e676f28fcd8bb7e5430c696bb6e6b711e18bf25 (diff)
downloadgsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.tar
gsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.tar.gz
gsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.tar.bz2
gsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.tar.lz
gsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.tar.xz
gsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.tar.zst
gsoc2013-evolution-5f7fc13ef6592a55df8ec0b34c6bbab5fa727d51.zip
check return value from auth_new_cal_from_source(). Connect to
2004-01-21 Rodrigo Moya <rodrigo@ximian.com> * gui/e-tasks.c (e_tasks_add_todo_source): check return value from auth_new_cal_from_source(). Connect to "backend_died" signal on the ECal class. (backend_died_cb): callback for "backend_died" that displays an error message when that happens. * gui/gnome-cal.c (backend_died_cb): use a GtkMessageDialog. svn path=/trunk/; revision=24355
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/e-tasks.c33
-rw-r--r--calendar/gui/gnome-cal.c7
3 files changed, 49 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index f68f74af3a..60505c509a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,15 @@
2004-01-21 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/e-tasks.c (e_tasks_add_todo_source): check return value
+ from auth_new_cal_from_source(). Connect to "backend_died"
+ signal on the ECal class.
+ (backend_died_cb): callback for "backend_died" that displays
+ an error message when that happens.
+
+ * gui/gnome-cal.c (backend_died_cb): use a GtkMessageDialog.
+
+2004-01-21 Rodrigo Moya <rodrigo@ximian.com>
+
* gui/e-tasks.[ch] (e_tasks_add_todo_uri, e_tasks_remove_todo_uri,
e_tasks_get_default_uri): renamed to _source and made them work
with ESource's.
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index d4d88a70eb..3e6a71b808 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -749,6 +749,33 @@ backend_error_cb (ECal *client, const char *message, gpointer data)
g_free (urinopwd);
}
+/* Callback from the calendar client when the backend dies */
+static void
+backend_died_cb (ECal *client, gpointer data)
+{
+ ETasks *tasks;
+ ETasksPrivate *priv;
+ char *message;
+ GtkWidget *dialog;
+
+ tasks = E_TASKS (data);
+ priv = tasks->priv;
+
+ /* FIXME: this doesn't remove the task list from the list or anything */
+ message = g_strdup_printf (_("The task backend for\n%s\n has crashed. "
+ "You will have to restart Evolution in order "
+ "to use it again"),
+ e_cal_get_uri (client));
+ e_calendar_table_set_status_message (E_CALENDAR_TABLE (e_tasks_get_calendar_table (tasks)), NULL);
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))),
+ 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_free (message);
+}
+
void
e_tasks_open_task (ETasks *tasks)
{
@@ -813,11 +840,17 @@ e_tasks_add_todo_source (ETasks *tasks, ESource *source)
set_status_message (tasks, _("Opening tasks at %s"), str_uri);
client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
+ if (!client) {
+ g_free (str_uri);
+ return FALSE;
+ }
+
g_hash_table_insert (priv->clients, str_uri, client);
priv->clients_list = g_list_prepend (priv->clients_list, client);
g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), tasks);
g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), tasks);
+ g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), tasks);
if (!e_cal_open (client, FALSE, &error)) {
GtkWidget *dialog;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 05194a30b3..4a3af0babc 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1897,6 +1897,7 @@ backend_error_cb (ECal *client, const char *message, gpointer data)
static void
backend_died_cb (ECal *client, gpointer data)
{
+ GtkWidget *dialog;
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
char *message;
@@ -1925,7 +1926,11 @@ backend_died_cb (ECal *client, gpointer data)
e_calendar_view_set_status_message (priv->views[i], NULL);
}
- gnome_error_dialog_parented (message, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))),
+ 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
g_free (message);
g_free (uristr);
}