aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShakti Sen <shprasad@blr.novell.com>2005-08-03 17:58:28 +0800
committerShakti Prasad Sen <shaktis@src.gnome.org>2005-08-03 17:58:28 +0800
commit6502cc080fd6e6de0d974b64c43809cbd54d0edc (patch)
tree30b0839e6a82a2775d30762aaa18c8ac6dbd28c6
parent888a7229872d0b4a8574cfc69ed007727530cb96 (diff)
downloadgsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.tar
gsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.tar.gz
gsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.tar.bz2
gsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.tar.lz
gsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.tar.xz
gsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.tar.zst
gsoc2013-evolution-6502cc080fd6e6de0d974b64c43809cbd54d0edc.zip
Added offline/online support and removed some warning messages. Added a
2005-08-03 Shakti Sen <shprasad@blr.novell.com> * exchange-folder.c (org_gnome_exchange_folder_ab_unsubscribe) (org_gnome_exchange_folder_unsubscribe) (org_gnome_exchange_folder_subscription): Added offline/online support and removed some warning messages. * exchange-operations.c: Added a new function exchange_is_offline(). * exchange-operations.h: Included a prototype. * exchange-config-listener.c (exchange_config_listener_get_offline_status): Added newly to get the online/offline status. * exchange-config-listener.h: Added the prototype for exchange_config_listener_get_offline_status(). Fixes bug #311324. svn path=/trunk/; revision=29969
-rw-r--r--plugins/exchange-operations/ChangeLog16
-rw-r--r--plugins/exchange-operations/exchange-config-listener.c25
-rw-r--r--plugins/exchange-operations/exchange-config-listener.h6
-rw-r--r--plugins/exchange-operations/exchange-folder.c56
-rw-r--r--plugins/exchange-operations/exchange-operations.c6
-rw-r--r--plugins/exchange-operations/exchange-operations.h1
6 files changed, 106 insertions, 4 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog
index 30001c4433..5dd379de5b 100644
--- a/plugins/exchange-operations/ChangeLog
+++ b/plugins/exchange-operations/ChangeLog
@@ -1,3 +1,19 @@
+2005-08-03 Shakti Sen <shprasad@blr.novell.com>
+
+ * exchange-folder.c (org_gnome_exchange_folder_ab_unsubscribe)
+ (org_gnome_exchange_folder_unsubscribe)
+ (org_gnome_exchange_folder_subscription): Added offline/online support
+ and removed some warning messages.
+ * exchange-operations.c: Added a new function exchange_is_offline().
+ * exchange-operations.h: Included a prototype.
+ * exchange-config-listener.c
+ (exchange_config_listener_get_offline_status): Added newly to get the
+ online/offline status.
+ * exchange-config-listener.h: Added the prototype for
+ exchange_config_listener_get_offline_status().
+
+ Fixes bug #311324.
+
2005-08-03 Sarfraaz Ahmed <asarfraaz@novell.com>
* exchange-folder.c : Fixed a build break. A typo.
diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c
index 5b4cb2a86c..006a5521c6 100644
--- a/plugins/exchange-operations/exchange-config-listener.c
+++ b/plugins/exchange-operations/exchange-config-listener.c
@@ -839,6 +839,31 @@ idle_construct (gpointer data)
return FALSE;
}
+ExchangeConfigListenerStatus
+exchange_config_listener_get_offline_status (ExchangeConfigListener *excl,
+ gint *mode)
+{
+ ExchangeConfigListenerPrivate *priv;
+ GConfValue *value;
+ ExchangeConfigListenerStatus status = CONFIG_LISTENER_STATUS_OK;
+ gboolean offline = FALSE;
+
+ g_return_val_if_fail (excl != NULL, CONFIG_LISTENER_STATUS_NOT_FOUND);
+
+ priv = excl->priv;
+ value = gconf_client_get (priv->gconf,
+ "/apps/evolution/shell/start_offline", NULL);
+ if (value)
+ offline = gconf_value_get_bool (value);
+
+ if (offline)
+ *mode = OFFLINE_MODE;
+ else
+ *mode = ONLINE_MODE;
+
+ return status;
+
+}
/**
* exchange_config_listener_new:
*
diff --git a/plugins/exchange-operations/exchange-config-listener.h b/plugins/exchange-operations/exchange-config-listener.h
index 7cc058dd05..a63c33651b 100644
--- a/plugins/exchange-operations/exchange-config-listener.h
+++ b/plugins/exchange-operations/exchange-config-listener.h
@@ -16,6 +16,11 @@ extern "C" {
#pragma }
#endif /* __cplusplus */
+typedef enum {
+ CONFIG_LISTENER_STATUS_OK,
+ CONFIG_LISTENER_STATUS_NOT_FOUND
+} ExchangeConfigListenerStatus;
+
#define EXCHANGE_TYPE_CONFIG_LISTENER (exchange_config_listener_get_type ())
#define EXCHANGE_CONFIG_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXCHANGE_TYPE_CONFIG_LISTENER, ExchangeConfigListener))
#define EXCHANGE_CONFIG_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXCHANGE_TYPE_CONFIG_LISTENER, ExchangeConfigListenerClass))
@@ -50,6 +55,7 @@ GSList *exchange_config_listener_get_accounts (ExchangeConfigLis
void add_folder_esource (ExchangeAccount *account, FolderType folder_type, const char *folder_name, const char *physical_uri);
void remove_folder_esource (ExchangeAccount *account, FolderType folder_type, const char *physical_uri);
+ExchangeConfigListenerStatus exchange_config_listener_get_offline_status (ExchangeConfigListener *excl, gint *mode);
#ifdef __cplusplus
}
diff --git a/plugins/exchange-operations/exchange-folder.c b/plugins/exchange-operations/exchange-folder.c
index 0419744f59..d3e8639af0 100644
--- a/plugins/exchange-operations/exchange-folder.c
+++ b/plugins/exchange-operations/exchange-folder.c
@@ -305,12 +305,29 @@ org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, void *data)
gchar *title = NULL;
gchar *displayed_folder_name = NULL;
gint response;
+ gint mode;
+ ExchangeConfigListenerStatus status;
account = exchange_operations_get_exchange_account ();
if (!account)
return;
+ status = exchange_is_offline (&mode);
+
+ if (status != CONFIG_LISTENER_STATUS_OK) {
+ g_warning ("Config listener not found");
+ return;
+ } else if (mode == OFFLINE_MODE) {
+ g_warning ("Unsubscribe to Other User's Folder is not allowed in Offline mode\n");
+ /* FIXME:
+ I think throwing an error dialog is not allowed
+ because of UI freeze.
+ e_error_run (NULL, ERROR_DOMAIN ":folder-offline-error", NULL);
+ */
+ return;
+ }
+
source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
displayed_folder_name = (gchar *) e_source_peek_name (source);
dialog = gtk_message_dialog_new (NULL,
@@ -348,12 +365,29 @@ org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, void *data)
gchar *title = NULL;
gchar *displayed_folder_name = NULL;
gint response;
+ gint mode;
+ ExchangeConfigListenerStatus status;
account = exchange_operations_get_exchange_account ();
if (!account)
return;
+ status = exchange_is_offline (&mode);
+
+ if (status != CONFIG_LISTENER_STATUS_OK) {
+ g_warning ("Config listener not found");
+ return;
+ } else if (mode == OFFLINE_MODE) {
+ g_warning ("Unsubscribe to Other User's Folder is not allowed in Offline mode\n");
+ /* FIXME:
+ I think throwing an error dialog is not allowed
+ because of UI freeze.
+ e_error_run (NULL, ERROR_DOMAIN ":folder-offline-error", NULL);
+ */
+ return;
+ }
+
source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
displayed_folder_name = (gchar *) e_source_peek_name (source);
dialog = gtk_message_dialog_new (NULL,
@@ -388,18 +422,32 @@ org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target)
{
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
- ExchangeHierarchy *hier;
ExchangeAccountFolderResult result;
- gchar *folder_display_name = NULL;
- gchar *folder_type = NULL;
- gchar *physical_uri = NULL;
gchar *user_email_address = NULL, *folder_name = NULL;
+ gint mode;
+ ExchangeConfigListenerStatus status;
account = exchange_operations_get_exchange_account ();
if (!account)
return;
+ status = exchange_is_offline (&mode);
+
+ if (status != CONFIG_LISTENER_STATUS_OK) {
+ g_warning ("Config listener not found");
+ return;
+ }
+ else if (mode == OFFLINE_MODE) {
+ g_warning ("Subscribe to Other User's Folder is not allowed in Offline mode\n");
+ /* FIXME:
+ I think throwing an error dialog is not allowed
+ because of UI freeze.
+ e_error_run (NULL, ERROR_DOMAIN ":folder-offline-error", NULL);
+ */
+ return;
+ }
+
create_folder_subscription_dialog (account->account_name, &user_email_address, &folder_name);
if (user_email_address && folder_name) {
diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c
index a2f004025f..9f822183c5 100644
--- a/plugins/exchange-operations/exchange-operations.c
+++ b/plugins/exchange-operations/exchange-operations.c
@@ -61,6 +61,12 @@ e_plugin_lib_enable (EPluginLib *eplib, int enable)
return 0;
}
+ExchangeConfigListenerStatus
+exchange_is_offline (gint *mode)
+{
+ return exchange_config_listener_get_offline_status (exchange_global_config_listener, mode);
+}
+
/* FIXME: See if a GLib variant of this function available */
gboolean
exchange_operations_tokenize_string (char **string, char *token, char delimit)
diff --git a/plugins/exchange-operations/exchange-operations.h b/plugins/exchange-operations/exchange-operations.h
index c0134aca76..35cdfca444 100644
--- a/plugins/exchange-operations/exchange-operations.h
+++ b/plugins/exchange-operations/exchange-operations.h
@@ -40,6 +40,7 @@ extern ExchangeConfigListener *exchange_global_config_listener;
int e_plugin_lib_enable (EPluginLib *eplib, int enable);
ExchangeAccount *exchange_operations_get_exchange_account (void);
+ExchangeConfigListenerStatus exchange_is_offline (gint *mode);
gboolean exchange_operations_tokenize_string (char **string, char *token, char delimit);