[evolution-patches] Patch for exchange connector



Hi, Connector maintainers,
I found the "Unscribe foldfer..." popup menu shown on my evolution-jescs folders, too. It should only be shown on an exchange folder. Attached is the patch to fix it. Please review it.
   BTW, it fixes two memory leaks, too.
   Thanks!
      Harry
? Makefile
? Makefile.in
? folder.diff
? org-gnome-exchange-operations.eplug
? org-gnome-exchange-operations.error
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.34
diff -u -p -r1.34 ChangeLog
--- ChangeLog	25 Jul 2005 12:11:25 -0000	1.34
+++ ChangeLog	27 Jul 2005 08:05:05 -0000
@@ -1,3 +1,10 @@
+2005-07-27  Harry Lu  <harry lu sun com>
+
+	Only show the unsubscribe menu if it is an exchange folder.
+	* exchange-folder.c:
+	(org_gnome_exchange_check_address_book_subscribed),
+	(org_gnome_exchange_check_subscribed):
+
 2005-07-25  Shakti Sen <shprasad novell com>
 
 	* org-gnome-exchange-operations.eplug.in: Fixed a small typo.
Index: exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder.c,v
retrieving revision 1.4
diff -u -p -r1.4 exchange-folder.c
--- exchange-folder.c	21 Jul 2005 14:46:34 -0000	1.4
+++ exchange-folder.c	27 Jul 2005 08:05:05 -0000
@@ -124,6 +124,7 @@ org_gnome_exchange_check_address_book_su
 	gchar *path = NULL;
 	char *sub_folder = NULL;
 	ExchangeAccount *account = NULL;
+	ESourceGroup *group;
 
 	account = exchange_operations_get_exchange_account ();
 
@@ -131,12 +132,18 @@ org_gnome_exchange_check_address_book_su
 		return;
 
 	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+	group = e_source_peek_group (source);
+	if (!group || strcmp (e_source_group_peek_base_uri (group), "exchange://"))
+		return;
+
 	uri = e_source_get_uri (source);
 	path = g_strdup_printf (uri + strlen ("exchange://") + strlen (account->account_filename));
 	sub_folder = strchr (path, '@');
 
-	if (!sub_folder)
+	if (!sub_folder) {
+		g_free (path);
 		return;
+	}
 
 	for (i = 0; i < sizeof (popup_ab_items) / sizeof (popup_ab_items[0]); i++)
 		menus = g_slist_prepend (menus, &popup_ab_items[i]);
@@ -156,6 +163,7 @@ org_gnome_exchange_check_subscribed (EPl
 	gchar *path = NULL;
 	char *sub_folder = NULL;
 	ExchangeAccount *account = NULL;
+	ESourceGroup *group;
 
 	account = exchange_operations_get_exchange_account ();
 
@@ -163,12 +171,18 @@ org_gnome_exchange_check_subscribed (EPl
 		return;
 
 	source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector));
+	group = e_source_peek_group (source);
+	if (!group || strcmp (e_source_group_peek_base_uri (group), "exchange://"))
+		return;
+
 	ruri = (gchar *) e_source_peek_relative_uri (source);
 	path = g_strdup_printf (ruri + strlen (account->account_filename));
 	sub_folder = strchr (path, '@');
 
-	if (!sub_folder)
+	if (!sub_folder) {
+		g_free (path);
 		return;
+	}
 
 	for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++)
 		menus = g_slist_prepend (menus, &popup_items[i]);


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