Re: [evolution-patches] Exchange: Patch for bug #311324



Hi,

I have incorporated all those changes and sending one new patch. Please
review the patch.

Thanks,
Shakti

On Tue, 2005-08-02 at 11:27 +0530, Sarfraaz Ahmed wrote:
> Looks better now. But, there are a few more tweaks needed. 
> 
> 
> -- Sarfraaz

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.39
diff -u -p -r1.39 ChangeLog
--- ChangeLog	2 Aug 2005 14:37:59 -0000	1.39
+++ ChangeLog	2 Aug 2005 15:16:02 -0000
@@ -1,5 +1,21 @@
 2005-08-02  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-02  Shakti Sen <shprasad blr novell com>
+
 	* Makefile.am: Included 'calendar' in INCLUDES and some .la in
 	'liborg_gnome_exchange_operations_la_LIBADD'
 	* exchange-folder-permission.c: Added the functionality for
Index: exchange-config-listener.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-config-listener.c,v
retrieving revision 1.9
diff -u -p -r1.9 exchange-config-listener.c
--- exchange-config-listener.c	1 Aug 2005 06:46:30 -0000	1.9
+++ exchange-config-listener.c	2 Aug 2005 15:16:03 -0000
@@ -839,6 +839,34 @@ 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_if_fail (excl);
+
+	if (!excl)
+		return 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:
  *
Index: exchange-config-listener.h
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-config-listener.h,v
retrieving revision 1.1
diff -u -p -r1.1 exchange-config-listener.h
--- exchange-config-listener.h	13 Jun 2005 12:39:20 -0000	1.1
+++ exchange-config-listener.h	2 Aug 2005 15:16:03 -0000
@@ -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_
 
 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
 }
Index: exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder.c,v
retrieving revision 1.7
diff -u -p -r1.7 exchange-folder.c
--- exchange-folder.c	2 Aug 2005 12:04:56 -0000	1.7
+++ exchange-folder.c	2 Aug 2005 15:16:03 -0000
@@ -178,7 +178,7 @@ org_gnome_exchange_check_subscribed (EPl
 	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
 	group = e_source_peek_group (source);
 	base_uri = e_source_group_peek_base_uri (group);
-	if (!basu_uri || strcmp (base_uri, "exchange://"))
+	if (!base_uri || strcmp (base_uri, "exchange://"))
 		return;
 
 	ruri = (gchar *) e_source_peek_relative_uri (source);
@@ -305,12 +305,29 @@ org_gnome_exchange_folder_ab_unsubscribe
 	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 ("Exchange account is not created");
+		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 (E
 	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 ("Exchange account is not created");
+		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,17 +422,31 @@ org_gnome_exchange_folder_subscription (
 {
 	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 ("Exchange account is not created");
+		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);
 
Index: exchange-operations.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-operations.c,v
retrieving revision 1.7
diff -u -p -r1.7 exchange-operations.c
--- exchange-operations.c	25 Jul 2005 06:12:03 -0000	1.7
+++ exchange-operations.c	2 Aug 2005 15:16:03 -0000
@@ -61,6 +61,12 @@ e_plugin_lib_enable (EPluginLib *eplib, 
 	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)
Index: exchange-operations.h
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-operations.h,v
retrieving revision 1.5
diff -u -p -r1.5 exchange-operations.h
--- exchange-operations.h	25 Jul 2005 06:12:03 -0000	1.5
+++ exchange-operations.h	2 Aug 2005 15:16:03 -0000
@@ -40,6 +40,7 @@ extern ExchangeConfigListener *exchange_
 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]