From c154c5a495fcd8bbdc3b96057160f9d93c155935 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Fri, 23 Sep 2005 10:53:38 +0000 Subject: ** Fixes bug 312849 2005-09-22 Praveen Kumar ** Fixes bug 312849 * exchange-calendar.c (e_exchange_calendar_pcalendar): Populate the folder hierarchy only if Evolution is online. (e_exchange_calendar_check): Disable the "OK" button if Evolution is offline. (e_exchange_calendar_commit): Don't do anything if Evolution is offline. * exchange-contacts.c (e_exchange_contacts_pcontacts): Populate the folder hierarchy only if Evolution is online. (e_exchange_contacts_check): Disable the "OK" button if Evolution is offline. (e_exchange_contacts_commit): Don't do anything if Evolution is offline. svn path=/trunk/; revision=30372 --- plugins/exchange-operations/ChangeLog | 20 +++++++++++++ plugins/exchange-operations/exchange-calendar.c | 40 +++++++++++++++++++++---- plugins/exchange-operations/exchange-contacts.c | 34 ++++++++++++++++++++- 3 files changed, 88 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index b5b403b7af..ee216d2820 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,23 @@ +2005-09-22 Praveen Kumar + + ** Fixes bug 312849 + + * exchange-calendar.c + (e_exchange_calendar_pcalendar): Populate the folder hierarchy only + if Evolution is online. + (e_exchange_calendar_check): Disable the "OK" button if Evolution + is offline. + (e_exchange_calendar_commit): Don't do anything if Evolution is + offline. + + * exchange-contacts.c + (e_exchange_contacts_pcontacts): Populate the folder hierarchy only + if Evolution is online. + (e_exchange_contacts_check): Disable the "OK" button if Evolution + is offline. + (e_exchange_contacts_commit): Don't do anything if Evolution is + offline. + 2005-09-15 Arunprakash * exchange-account-setup.c diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c index 351443d9f8..708700ee5f 100644 --- a/plugins/exchange-operations/exchange-calendar.c +++ b/plugins/exchange-operations/exchange-calendar.c @@ -152,6 +152,9 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) char *folder_size; const char *rel_uri; int row, i; + gint offline_status; + char *offline_msg; + GtkWidget *lbl_offline_msg; if (!hidden) @@ -176,6 +179,24 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) e_uri_free (uri); g_free (uri_text); + parent = data->parent; + row = ((GtkTable*)parent)->nrows; + + exchange_config_listener_get_offline_status (exchange_global_config_listener, + &offline_status); + if (offline_status == OFFLINE_MODE) { + /* Evolution is in offline mode; we will not be able to create + new folders or modify existing folders. */ + offline_msg = g_markup_printf_escaped ("%s", + _("Evolution is in offline mode. You cannot create or modify folders now.\nPlease switch to online mode for such operations.")); + lbl_offline_msg = gtk_label_new (""); + gtk_label_set_markup (GTK_LABEL (lbl_offline_msg), offline_msg); + g_free (offline_msg); + gtk_widget_show (lbl_offline_msg); + gtk_table_attach (GTK_TABLE (parent), lbl_offline_msg, 0, 2, row, row+1, GTK_FILL|GTK_EXPAND, 0, 0, 0); + return lbl_offline_msg; + } + rel_uri = e_source_peek_relative_uri (t->source); if (rel_uri && strlen (rel_uri)) { calendar_src_exists = TRUE; @@ -186,9 +207,6 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) calendar_src_exists = FALSE; } - parent = data->parent; - row = ((GtkTable*)parent)->nrows; - /* REVIEW: Should this handle be freed? - Attn: surf */ account = exchange_operations_get_exchange_account (); account_name = account->account_name; @@ -280,11 +298,16 @@ e_exchange_calendar_check (EPlugin *epl, EConfigHookPageCheckData *data) ESourceGroup *group; const char *base_uri; const char *rel_uri; + gint offline_status; rel_uri = e_source_peek_relative_uri (t->source); group = e_source_peek_group (t->source); base_uri = e_source_group_peek_base_uri (group); + exchange_config_listener_get_offline_status (exchange_global_config_listener, + &offline_status); if (base_uri && !strncmp (base_uri, "exchange", 8)) { + if (offline_status == OFFLINE_MODE) + return FALSE; if (rel_uri && !strlen (rel_uri)) { return FALSE; } @@ -302,13 +325,20 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target) int prefix_len; ExchangeAccount *account; ExchangeAccountFolderResult result; - + gint offline_status; + uri_text = e_source_get_uri (source); if (uri_text && strncmp (uri_text, "exchange", 8)) { g_free (uri_text); return ; } - + + exchange_config_listener_get_offline_status (exchange_global_config_listener, + &offline_status); + + if (offline_status == OFFLINE_MODE) + return; + account = exchange_operations_get_exchange_account (); path_prefix = g_strconcat (account->account_filename, "/", NULL); prefix_len = strlen (path_prefix); diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c index 8457e3af61..dc1859cee2 100644 --- a/plugins/exchange-operations/exchange-contacts.c +++ b/plugins/exchange-operations/exchange-contacts.c @@ -136,6 +136,10 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) EABConfigTargetSource *t = (EABConfigTargetSource *) data->target; ESource *source = t->source; + GtkWidget *lbl_offline_msg, *vb_offline_msg; + char *offline_msg; + gint offline_status; + if (data->old) { gtk_widget_destroy (vb_pcontacts); @@ -149,6 +153,23 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) g_free (uri_text); + exchange_config_listener_get_offline_status (exchange_global_config_listener, + &offline_status); + if (offline_status == OFFLINE_MODE) { + /* Evolution is in offline mode; we will not be able to create + new folders or modify existing folders. */ + offline_msg = g_markup_printf_escaped ("%s", + _("Evolution is in offline mode. You cannot create or modify folders now.\nPlease switch to online mode for such operations.")); + vb_offline_msg = gtk_vbox_new (FALSE, 6); + gtk_container_add (GTK_CONTAINER (data->parent), vb_offline_msg); + lbl_offline_msg = gtk_label_new (""); + gtk_label_set_markup (GTK_LABEL (lbl_offline_msg), offline_msg); + g_free (offline_msg); + gtk_box_pack_start (GTK_BOX (vb_offline_msg), lbl_offline_msg, FALSE, FALSE, 0); + gtk_widget_show_all (vb_offline_msg); + return vb_offline_msg; + } + rel_uri = e_source_peek_relative_uri (source); uid = e_source_peek_uid (source); if (rel_uri && uid && (strcmp (rel_uri, uid))) { @@ -263,14 +284,19 @@ e_exchange_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data) ESourceGroup *group; const char *base_uri; const char *rel_uri; + gint offline_status; rel_uri = e_source_peek_relative_uri (t->source); group = e_source_peek_group (t->source); base_uri = e_source_group_peek_base_uri (group); + exchange_config_listener_get_offline_status (exchange_global_config_listener, + &offline_status); if (base_uri && !strncmp (base_uri, "exchange", 8)) { + if (offline_status == OFFLINE_MODE) + return FALSE; if (rel_uri && !strlen (rel_uri)) { return FALSE; - } + } } return TRUE; @@ -285,6 +311,7 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target) int prefix_len; ExchangeAccount *account; ExchangeAccountFolderResult result; + gint offline_status; uri_text = e_source_get_uri (source); if (uri_text && strncmp (uri_text, "exchange", 8)) { @@ -293,6 +320,11 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target) } g_free (uri_text); + exchange_config_listener_get_offline_status (exchange_global_config_listener, + &offline_status); + if (offline_status == OFFLINE_MODE) + return; + account = exchange_operations_get_exchange_account (); path_prefix = g_strconcat (account->account_filename, "/", NULL); prefix_len = strlen (path_prefix); -- cgit v1.2.3