From e1e8526ea808a8d30251b7c871ffcd820b7c223d Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Sat, 24 Jan 2004 22:45:53 +0000 Subject: new function. 2004-01-24 Rodrigo Moya * gui/calendar-component.[ch] (calendar_component_peek_source_selector): new function. * gui/tasks-component.[ch] (tasks_component_peek_source_selector): new function. * gui/e-tasks.c (backend_died_cb): * gui/gnome-cal.c (backend_died_cb): don't tell the user to restart Evolution, there is no need now, just unselecting and selecting back the calendar loads it again. Also, remove the crashed client from the list of loaded clients. Also, unselect the source on the source selector. svn path=/trunk/; revision=24417 --- calendar/gui/calendar-component.c | 6 ++++++ calendar/gui/calendar-component.h | 2 ++ calendar/gui/e-tasks.c | 13 +++++++++---- calendar/gui/gnome-cal.c | 22 +++++++++++++--------- calendar/gui/tasks-component.c | 6 ++++++ calendar/gui/tasks-component.h | 2 ++ 6 files changed, 38 insertions(+), 13 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 47d2711f48..7efcafc8ae 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -853,6 +853,12 @@ calendar_component_peek_source_list (CalendarComponent *component) return component->priv->source_list; } +ESourceSelector * +calendar_component_peek_source_selector (CalendarComponent *component) +{ + return component->priv->source_selector; +} + EActivityHandler * calendar_component_peek_activity_handler (CalendarComponent *component) { diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h index 1ddadf6857..04672c1122 100644 --- a/calendar/gui/calendar-component.h +++ b/calendar/gui/calendar-component.h @@ -27,6 +27,7 @@ #include #include +#include "widgets/misc/e-source-selector.h" #include "e-activity-handler.h" #include "Evolution.h" @@ -62,6 +63,7 @@ CalendarComponent *calendar_component_peek (void); const char *calendar_component_peek_base_directory (CalendarComponent *component); const char *calendar_component_peek_config_directory (CalendarComponent *component); ESourceList *calendar_component_peek_source_list (CalendarComponent *component); +ESourceSelector *calendar_component_peek_source_selector (CalendarComponent *component); EActivityHandler *calendar_component_peek_activity_handler (CalendarComponent *component); diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index caba394248..bd4162c617 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -763,10 +763,7 @@ backend_died_cb (ECal *client, gpointer 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)); + message = g_strdup_printf (_("The task backend for\n%s\n has crashed."), 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))), @@ -775,6 +772,14 @@ backend_died_cb (ECal *client, gpointer data) gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); g_free (message); + + e_source_selector_unselect_source ( + tasks_component_peek_source_selector (tasks_component_peek ()), + e_cal_get_source (client)); + + g_hash_table_remove (priv->clients, e_cal_get_uri (client)); + priv->clients_list = g_list_remove (priv->clients_list, client); + g_object_unref (client); } void diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 22eab34e2a..c703a188c0 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1908,24 +1908,28 @@ backend_died_cb (ECal *client, gpointer data) gcal = GNOME_CALENDAR (data); priv = gcal->priv; - /* FIXME This doesn't remove the calendar from the list or anything */ uristr = get_uri_without_password (e_cal_get_uri (client)); if (client == priv->task_pad_client) { - 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"), - uristr); + message = g_strdup_printf (_("The task backend for\n%s\n has crashed."), uristr); e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL); + + g_object_unref (priv->task_pad_client); + priv->task_pad_client = NULL; } else { int i; - message = g_strdup_printf (_("The calendar backend for\n%s\n has crashed. " - "You will have to restart Evolution in order " - "to use it again"), - uristr); + message = g_strdup_printf (_("The calendar backend for\n%s\n has crashed."), uristr); for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) e_calendar_view_set_status_message (priv->views[i], NULL); + + e_source_selector_unselect_source ( + calendar_component_peek_source_selector (calendar_component_peek ()), + e_cal_get_source (client)); + + g_hash_table_remove (priv->clients, e_cal_get_uri (client)); + priv->clients_list = g_list_remove (priv->clients_list, client); + g_object_unref (client); } dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index f037680781..c7cb7d81b0 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -785,6 +785,12 @@ tasks_component_peek_source_list (TasksComponent *component) return component->priv->source_list; } +ESourceSelector * +tasks_component_peek_source_selector (TasksComponent *component) +{ + return component->priv->source_selector; +} + EActivityHandler * tasks_component_peek_activity_handler (TasksComponent *component) { diff --git a/calendar/gui/tasks-component.h b/calendar/gui/tasks-component.h index 063150a56f..cd54ea5ae3 100644 --- a/calendar/gui/tasks-component.h +++ b/calendar/gui/tasks-component.h @@ -26,6 +26,7 @@ #include #include #include +#include #include "Evolution.h" @@ -59,6 +60,7 @@ TasksComponent *tasks_component_peek (void); const char *tasks_component_peek_base_directory (TasksComponent *component); const char *tasks_component_peek_config_directory (TasksComponent *component); ESourceList *tasks_component_peek_source_list (TasksComponent *component); +ESourceSelector *tasks_component_peek_source_selector (TasksComponent *component); EActivityHandler *tasks_component_peek_activity_handler (TasksComponent *component); #endif /* _TASKS_COMPONENT_H_ */ -- cgit v1.2.3