From b6306f760aa0b747835ed19ecb1a4baed10248f4 Mon Sep 17 00:00:00 2001 From: Harish Krishnaswamy Date: Sat, 5 Feb 2005 11:55:03 +0000 Subject: add messages for calendar/tasks not marked for offline usage. * calendar-errors.xml: * calendar-errors.xml.h: * gui/e-tasks.c: (client_cal_opened_cb): * gui/gnome-cal.c: (client_cal_opened_cb), (default_client_cal_opened_cb): add messages for calendar/tasks not marked for offline usage. svn path=/trunk/; revision=28718 --- calendar/gui/e-tasks.c | 2 ++ calendar/gui/gnome-cal.c | 52 +++++++++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 21 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 9aaa939268..78ce565da1 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -817,6 +817,8 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, ETasks *tasks) break; case E_CALENDAR_STATUS_BUSY : break; + case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: + e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks))), "calendar:prompt-no-contents-offline-tasks", NULL); default : /* Make sure the source doesn't disappear on us */ g_object_ref (source); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index a01e26b6a2..7372c2c5c5 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2170,6 +2170,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) ECalSourceType source_type; ESource *source; char *msg; + const char *id; int i; priv = gcal->priv; @@ -2177,29 +2178,39 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) source_type = e_cal_get_source_type (ecal); source = e_cal_get_source (ecal); - if (source_type == E_CAL_SOURCE_TYPE_EVENT) + switch (source_type) { + case E_CAL_SOURCE_TYPE_EVENT: + id = "calendar:prompt-no-contents-offline-calendar"; e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL); - else + break; + case E_CAL_SOURCE_TYPE_TODO: + id = "calendar:prompt-no-contents-offline-tasks"; e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL); - - if (status == E_CALENDAR_STATUS_BUSY) + break; + default: + break; + } + switch (status) { + case E_CALENDAR_STATUS_OK: + break; + case E_CALENDAR_STATUS_BUSY: return; - - if (status == E_CALENDAR_STATUS_INVALID_SERVER_VERSION) { + case E_CALENDAR_STATUS_INVALID_SERVER_VERSION e_error_run (NULL, "calendar:server-version", NULL); status = E_CALENDAR_STATUS_OK; - } - if (status != E_CALENDAR_STATUS_OK) { + break; + case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: + e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), id, NULL); + default: /* Make sure the source doesn't disappear on us */ g_object_ref (source); - + priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal); g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source)); gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source); - g_object_unref (source); - + return; } @@ -2267,18 +2278,18 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar break; } - if (status == E_CALENDAR_STATUS_BUSY) + switch (status) { + case E_CALENDAR_STATUS_OK: + break; + case E_CALENDAR_STATUS_BUSY: return; - - if (status == E_CALENDAR_STATUS_INVALID_SERVER_VERSION) { + case E_CALENDAR_STATUS_INVALID_SERVER_VERSION : e_error_run (NULL, "calendar:server-version", NULL); status = E_CALENDAR_STATUS_OK; - } - - if (status != E_CALENDAR_STATUS_OK) { + default: /* Make sure the source doesn't disappear on us */ g_object_ref (source); - + /* FIXME should we do this to prevent multiple error dialogs? */ priv->clients_list[source_type] = g_list_remove (priv->clients_list[source_type], ecal); g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source)); @@ -2286,11 +2297,10 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar /* FIXME Is there a better way to handle this? */ g_object_unref (priv->default_client[source_type]); priv->default_client[source_type] = NULL; - + gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source); - g_object_unref (source); - + return; } -- cgit