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



Hi,

I have attached a patch for online/offline support in exchange (in eds
as well as for plugins). Please review the patch. bug #311324.

Thanks,
Shakti

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.21
diff -u -p -r1.21 ChangeLog
--- ChangeLog	22 Jul 2005 07:46:28 -0000	1.21
+++ ChangeLog	29 Jul 2005 05:00:50 -0000
@@ -1,3 +1,10 @@
+2005-07-29  Shakti Sen <shprasad novell com>
+
+	* storage/exchange-account.c (exchange_account_is_offline):
+	Added support for online/offline.
+
+	Fixed bug #311324.
+
 2005-07-22  Praveen Kumar <kpraveen novell com>
 
 	* storage/exchange-esource.c (add_folder_esource) : Modified the way
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.9
diff -u -p -r1.9 exchange-account.c
--- storage/exchange-account.c	21 Jul 2005 14:45:57 -0000	1.9
+++ storage/exchange-account.c	29 Jul 2005 05:00:51 -0000
@@ -1213,7 +1213,18 @@ void
 exchange_account_is_offline (ExchangeAccount *account, int *state)
 {
 	// SURF : Dummy
-	*state = ONLINE_MODE;
+	GConfValue *value;
+	gboolean *offline;
+	GConfClient *client = gconf_client_get_default ();
+	value = gconf_client_get (client,
+				  "/apps/evolution/shell/start_offline", NULL);
+	if (value)
+		offline = gconf_value_get_bool (value);
+
+	if (offline)
+		*state = OFFLINE_MODE;
+	else
+		*state = ONLINE_MODE;
 }
 
 // SURF : Picked this from gal/util/e-util.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.36
diff -u -p -r1.36 ChangeLog
--- ChangeLog	28 Jul 2005 18:05:12 -0000	1.36
+++ ChangeLog	29 Jul 2005 04:54:46 -0000
@@ -1,3 +1,12 @@
+2005-07-29  Shakti Sen <shprasad 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.
+
+	Fixes bug #311324.
+
 2005-07-27  Praveen Kumar <kpraveen novell com>
 
 	* exchange-folder.c (org_gnome_exchange_folder_subscription) : Handle
Index: exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder.c,v
retrieving revision 1.6
diff -u -p -r1.6 exchange-folder.c
--- exchange-folder.c	28 Jul 2005 18:05:12 -0000	1.6
+++ exchange-folder.c	29 Jul 2005 04:54:47 -0000
@@ -206,6 +206,7 @@ unsubscribe_dialog_ab_response (GtkDialo
 		ESourceGroup *source_group = NULL;
 		ESource *source = NULL;
 		EABPopupTargetSource *target = data;
+		ExchangeAccountFolderResult res;
 
 		client = gconf_client_get_default ();
 
@@ -219,7 +220,7 @@ unsubscribe_dialog_ab_response (GtkDialo
 		path = g_strdup_printf (uri + strlen ("exchange://") + strlen (account->account_filename));
 		source_uid = e_source_peek_uid (source);
 
-		exchange_account_remove_shared_folder (account, path);
+		res = exchange_account_remove_shared_folder (account, path);
 
 		source_group = e_source_peek_group (source);
 		e_source_group_remove_source_by_uid (source_group, source_uid);
@@ -301,12 +302,25 @@ org_gnome_exchange_folder_ab_unsubscribe
 	gchar *title = NULL;
 	gchar *displayed_folder_name = NULL;
 	gint response;
+	gint mode;
 
 	account = exchange_operations_get_exchange_account ();
 
 	if (!account)
 		return;
 
+	exchange_account_is_offline (account, &mode);
+
+	if (mode != ONLINE_MODE) {
+		printf ("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,
@@ -344,12 +358,25 @@ org_gnome_exchange_folder_unsubscribe (E
 	gchar *title = NULL;
 	gchar *displayed_folder_name = NULL;
 	gint response;
+	gint mode;
 
 	account = exchange_operations_get_exchange_account ();
 
 	if (!account)
 		return;
 
+	exchange_account_is_offline (account, &mode);
+
+	if (mode != ONLINE_MODE) {
+		printf ("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,
@@ -384,17 +411,26 @@ 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;
 
 	account = exchange_operations_get_exchange_account ();
 
 	if (!account)
 		return;
+
+	exchange_account_is_offline (account, &mode);
+
+	if (mode != ONLINE_MODE) {
+		printf ("Subscribe to Other User's Folder is not allowed in Offline mode\n");
+		/* FIXME:
+		   I think throwing an error dialog is not allowed i
+		   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);
 


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