[evolution-patches] Patch for bug #310233 (exchange-component)



Hi,

I am attaching a patch for bug #310233. In the patch I have also taken care of some compilation warnings. Please review the patch.

Thanks,
Shakti


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.17
diff -u -p -r1.17 ChangeLog
--- ChangeLog	13 Jul 2005 11:10:33 -0000	1.17
+++ ChangeLog	13 Jul 2005 15:16:23 -0000
@@ -1,3 +1,18 @@
+2005-07-13  Shakti Sen <shprasad novell com>
+
+	* exchange-operations.c: Checked for if the exchange account
+	exist/configured.
+	* exchange-folder-permission.c: Replaced all the occurences of function
+	exchange_config_listener_get_accounts() with
+	exchange_operations_get_exchange_account() and returns if it doesn't 
+	exist.
+	* exchange-folder.c: Same. Also took care to avoid some compile time
+	warnings.
+	* exchange-folder-subscription.c: Included 
+	exchange-folder-subscription.h file to avoid compilation warning.
+
+	Fixes bug #310233.
+
 2005-07-13  Praveen Kumar <kpraveen novell com>
 
 	* org-gnome-exchange-operations.eplug.in : Modified the eplug file to 
Index: exchange-folder-permission.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder-permission.c,v
retrieving revision 1.2
diff -u -p -r1.2 exchange-folder-permission.c
--- exchange-folder-permission.c	8 Jul 2005 11:27:30 -0000	1.2
+++ exchange-folder-permission.c	13 Jul 2005 15:16:23 -0000
@@ -61,10 +61,10 @@ org_gnome_exchange_folder_permissions (E
 	ExchangeAccount *account = NULL;
 	EFolder *folder = NULL;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
 
 	folder = exchange_account_get_folder (account, t->uri);
 
@@ -98,10 +98,10 @@ org_folder_permissions_cb (EPopup *ep, E
 	ExchangeAccount *account = NULL;
 	EFolder *folder = NULL;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
 
 	folder = exchange_account_get_folder (account, selected_exchange_folder_uri);
 	if (folder)
@@ -119,10 +119,10 @@ org_gnome_exchange_menu_folder_permissio
 	if (target == NULL)
 		return;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
 
 	folder = exchange_account_get_folder (account, target->uri);
 	if (folder)
Index: exchange-folder-subscription.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder-subscription.c,v
retrieving revision 1.1
diff -u -p -r1.1 exchange-folder-subscription.c
--- exchange-folder-subscription.c	8 Jul 2005 10:54:11 -0000	1.1
+++ exchange-folder-subscription.c	13 Jul 2005 15:16:24 -0000
@@ -35,6 +35,7 @@
 #include <libedataserver/e-xml-hash-utils.h>
 #include <libedataserverui/e-name-selector.h>
 #include "exchange-config-listener.h"
+#include "exchange-folder-subscription.h"
 
 
 static void
Index: exchange-folder-subscription.h
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder-subscription.h,v
retrieving revision 1.1
diff -u -p -r1.1 exchange-folder-subscription.h
--- exchange-folder-subscription.h	8 Jul 2005 10:54:11 -0000	1.1
+++ exchange-folder-subscription.h	13 Jul 2005 15:16:24 -0000
@@ -1,4 +1,7 @@
 #ifndef __EXCHANGE_FOLDER_SUBSCRIPTION_H__
 #define __EXCHANGE_FOLDER_SUBSCRIPTION_H__
 
+gboolean
+create_folder_subscription_dialog (gchar *mail_account, gchar **user_email_address_ret, gchar **folder_name_ret);
+
 #endif
Index: exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder.c,v
retrieving revision 1.2
diff -u -p -r1.2 exchange-folder.c
--- exchange-folder.c	11 Jul 2005 07:08:23 -0000	1.2
+++ exchange-folder.c	13 Jul 2005 15:16:24 -0000
@@ -31,6 +31,7 @@
 #include <calendar/gui/e-cal-popup.h>
 #include <mail/em-popup.h>
 #include <mail/em-menu.h>
+#include <libedataserverui/e-source-selector.h>
 #include "exchange-operations.h"
 #include "addressbook/gui/widgets/eab-popup.h"
 
@@ -70,15 +71,14 @@ org_gnome_exchange_check_inbox_subscribe
 {
 	GSList *menus = NULL;
 	int i = 0;
-	GSList *accounts, *acc;
 	ExchangeAccount *account = NULL;
 	gchar *path = NULL;
 	gchar *sub_folder = NULL;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
 
 	path = g_strdup_printf (target->uri + strlen ("exchange://") + strlen (account->account_filename));
 	sub_folder = strchr (path, '@');
@@ -122,15 +122,14 @@ org_gnome_exchange_check_address_book_su
 	gchar *uri = NULL;
 	gchar *path = NULL;
 	char *sub_folder = NULL;
-	GSList *accounts, *acc;
 	ExchangeAccount *account = NULL;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
 
-	source = e_source_selector_peek_primary_selection (target->selector);
+	if (!account)
+		return;
+
+	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
 	uri = e_source_get_uri (source);
 	path = g_strdup_printf (uri + strlen ("exchange://") + strlen (account->account_filename));
 	sub_folder = strchr (path, '@');
@@ -155,16 +154,15 @@ org_gnome_exchange_check_subscribed (EPl
 	gchar *ruri = NULL;
 	gchar *path = NULL;
 	char *sub_folder = NULL;
-	GSList *accounts, *acc;
 	ExchangeAccount *account = NULL;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
 
-	source = e_source_selector_peek_primary_selection (target->selector);
-	ruri = e_source_peek_relative_uri (source);
+	if (!account)
+		return;
+
+	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+	ruri = (gchar *) e_source_peek_relative_uri (source);
 	path = g_strdup_printf (ruri + strlen (account->account_filename));
 	sub_folder = strchr (path, '@');
 
@@ -183,7 +181,6 @@ unsubscribe_dialog_ab_response (GtkDialo
 {
 
 	if (response == GTK_RESPONSE_OK) {
-		GSList *accounts, *acc;
 		ExchangeAccount *account = NULL;
 		gchar *path = NULL;
 		gchar *uri = NULL;
@@ -195,11 +192,12 @@ unsubscribe_dialog_ab_response (GtkDialo
 
 		client = gconf_client_get_default ();
 
-		accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-		for (acc = accounts; acc;  acc = acc->next) {
-			account = acc->data;
-		}
-		source = e_source_selector_peek_primary_selection (target->selector);
+		account = exchange_operations_get_exchange_account ();
+
+		if (!account)
+			return;
+
+		source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
 		uri = e_source_get_uri (source);
 		path = g_strdup_printf (uri + strlen ("exchange://") + strlen (account->account_filename));
 		source_uid = e_source_peek_uid (source);
@@ -222,7 +220,6 @@ unsubscribe_dialog_response (GtkDialog *
 {
 
 	if (response == GTK_RESPONSE_OK) {
-		GSList *accounts, *acc;
 		GSList *ids, *node_to_be_deleted;
 		ExchangeAccount *account = NULL;
 		gchar *path = NULL;
@@ -235,12 +232,13 @@ unsubscribe_dialog_response (GtkDialog *
 
 		client = gconf_client_get_default ();
 
-		accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-		for (acc = accounts; acc;  acc = acc->next) {
-			account = acc->data;
-		}
-		source = e_source_selector_peek_primary_selection (target->selector);
-		ruri = e_source_peek_relative_uri (source);
+		account = exchange_operations_get_exchange_account ();
+
+		if (!account)
+			return;
+
+		source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+		ruri = (gchar *) e_source_peek_relative_uri (source);
 		source_uid = e_source_peek_uid (source);
 
 		path = g_strdup_printf (ruri + strlen (account->account_filename));
@@ -282,19 +280,18 @@ org_gnome_exchange_folder_ab_unsubscribe
 	GtkWidget *dialog = NULL;
 	EABPopupTargetSource *target = data;
 	ESource *source = NULL;
-	GSList *accounts, *acc;
 	ExchangeAccount *account = NULL;
 	gchar *title = NULL;
 	gchar *displayed_folder_name = NULL;
 	gint response;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		return;
 
-	source = e_source_selector_peek_primary_selection (target->selector);
-	displayed_folder_name = e_source_peek_name (source);
+	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,
 					 GTK_DIALOG_MODAL,
 					 GTK_MESSAGE_QUESTION,
@@ -318,7 +315,7 @@ org_gnome_exchange_folder_ab_unsubscribe
 	g_free (displayed_folder_name);
 
 	gtk_widget_show (dialog);
-	unsubscribe_dialog_ab_response (dialog, response, data);
+	unsubscribe_dialog_ab_response (GTK_DIALOG (dialog), response, data);
 }
 void
 org_gnome_exchange_folder_unsubscribe (EPlugin *ep, EPopupItem *p, void *data)
@@ -326,19 +323,18 @@ org_gnome_exchange_folder_unsubscribe (E
 	GtkWidget *dialog = NULL;
 	ECalPopupTargetSource *target = data;
 	ESource *source = NULL;
-	GSList *accounts, *acc;
 	ExchangeAccount *account = NULL;
 	gchar *title = NULL;
 	gchar *displayed_folder_name = NULL;
 	gint response;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
 
-	source = e_source_selector_peek_primary_selection (target->selector);
-	displayed_folder_name = e_source_peek_name (source);
+	if (!account)
+		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,
 					 GTK_DIALOG_MODAL,
 					 GTK_MESSAGE_QUESTION,
@@ -362,14 +358,13 @@ org_gnome_exchange_folder_unsubscribe (E
 	g_free (displayed_folder_name);
 
 	gtk_widget_show (dialog);
-	unsubscribe_dialog_response (dialog, response, data);
+	unsubscribe_dialog_response (GTK_DIALOG (dialog), response, data);
 }
 
 
 void
 org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target)
 {
-	GSList *accounts, *acc;
 	ExchangeAccount *account = NULL;
 	EFolder *folder = NULL;
 	ExchangeHierarchy *hier;
@@ -377,12 +372,12 @@ org_gnome_exchange_folder_subscription (
 	gchar *folder_display_name = NULL;
 	gchar *folder_type = NULL;
 	gchar *physical_uri = NULL;
-	gchar *user_email_address = NULL, *storage_name, *folder_name = NULL;
+	gchar *user_email_address = NULL, *folder_name = NULL;
 
-	accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
-	for (acc = accounts; acc;  acc = acc->next) {
-		account = acc->data;
-	}
+	account = exchange_operations_get_exchange_account ();
+
+	if (!account)
+		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.4
diff -u -p -r1.4 exchange-operations.c
--- exchange-operations.c	11 Jul 2005 12:26:24 -0000	1.4
+++ exchange-operations.c	13 Jul 2005 15:16:24 -0000
@@ -176,12 +176,13 @@ exchange_operations_cta_select_node_from
 ExchangeAccount *
 exchange_operations_get_exchange_account (void) 
 {
-	ExchangeAccount *account;
+	ExchangeAccount *account = NULL;
 	GSList *acclist;
 
 	acclist = exchange_config_listener_get_accounts (exchange_global_config_listener);
 	/* FIXME: Need to be changed for handling multiple accounts */
-	account = acclist->data; 
+	if (acclist)
+		account = acclist->data; 
 	
 	return account;
 }


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