evolution/bnc-442135-exchange-settings-offline.patch

77 lines
2.3 KiB
Diff

Index: plugins/exchange-operations/org-gnome-exchange-operations.error.xml
===================================================================
--- plugins/exchange-operations/org-gnome-exchange-operations.error.xml (revision 36615)
+++ plugins/exchange-operations/org-gnome-exchange-operations.error.xml (working copy)
@@ -48,6 +48,11 @@
<_secondary>Cannot display folders.</_secondary>
</error>
+ <error id="exchange-settings-offline" type="info">
+ <_primary>Exchange Account is offline.</_primary>
+ <_secondary>Cannot access the "Exchange settings" tab in offline mode.</_secondary>
+ </error>
+
<error id="account-offline-generic" type="info">
<_primary>Exchange Account is offline.</_primary>
<_secondary>Cannot perform the operation.</_secondary>
Index: plugins/exchange-operations/exchange-account-setup.c
===================================================================
--- plugins/exchange-operations/exchange-account-setup.c (revision 36615)
+++ plugins/exchange-operations/exchange-account-setup.c (working copy)
@@ -181,6 +181,7 @@
const char *source_url;
char *message = NULL, *txt = NULL, *oof_message;
gboolean oof_state = FALSE;
+ gint offline_status;
GtkVBox *vbox_settings;
@@ -234,6 +235,14 @@
account = exchange_operations_get_exchange_account ();
+ exchange_config_listener_get_offline_status (exchange_global_config_listener,
+ &offline_status);
+ if (offline_status == OFFLINE_MODE) {
+ e_error_run (NULL, ERROR_DOMAIN ":exchange-settings-offline", NULL);
+
+ return NULL;
+ }
+
oof_data = g_new0 (OOFData, 1);
oof_data->state = FALSE;
@@ -815,7 +824,8 @@
{
if (oof_data->message)
g_free (oof_data->message);
- g_free (oof_data);
+ if (oof_data)
+ g_free (oof_data);
}
void
@@ -824,6 +834,7 @@
EMConfigTargetAccount *target_account;
const char *source_url;
CamelURL *url;
+ gint offline_status;
target_account = (EMConfigTargetAccount *)data->config->target;
source_url = e_account_get_string (target_account->account, E_ACCOUNT_SOURCE_URL);
@@ -844,6 +855,14 @@
}
camel_url_free (url);
+
+ exchange_config_listener_get_offline_status (exchange_global_config_listener,
+ &offline_status);
+
+ if (offline_status == OFFLINE_MODE) {
+ return;
+ }
+
/* Set oof data in exchange account */
set_oof_info ();
destroy_oof_data ();