[evolution-groupwise] Adapt to EMConfigTargetFolder.



commit 304967a3ed2ab1a19f3ecfd9292f8888d06166b2
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu May 12 13:44:23 2011 -0400

    Adapt to EMConfigTargetFolder.
    
    The plugin was using the folder URI member incorrectly anyway.
    Also fixed some other unfortunate logic in the immediate vicinity.

 src/plugins/share-folder-common.c |   51 ++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 28 deletions(-)
---
diff --git a/src/plugins/share-folder-common.c b/src/plugins/share-folder-common.c
index cbfda21..5eb1642 100644
--- a/src/plugins/share-folder-common.c
+++ b/src/plugins/share-folder-common.c
@@ -31,6 +31,7 @@
 #include <e-util/e-config.h>
 #include <e-util/e-account-utils.h>
 #include <mail/e-mail-backend.h>
+#include <mail/e-mail-folder-utils.h>
 #include <mail/em-config.h>
 #include <mail/em-folder-properties.h>
 #include <mail/em-folder-tree.h>
@@ -373,21 +374,21 @@ gw_new_shared_folder_cb (GtkAction *action, EShellView *shell_view)
 GtkWidget *
 org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
 {
-
-	gchar *folderuri = NULL;
-	gchar *account = NULL;
 	gchar *id = NULL;
-	gchar *folder_name = NULL;
+	const gchar *folder_name;
 	EGwConnection *cnc;
 	ShareFolder *sharing_tab;
 	EMConfigTargetFolder *target=  (EMConfigTargetFolder *) hook_data->config->target;
 	CamelFolder *folder = target->folder;
+	CamelProvider *provider;
+	CamelStore *store;
 
-	folder_name = g_strdup (camel_folder_get_full_name (folder));
-	folderuri = g_strdup (target->uri);
-	if (folderuri && folder_name)
-		account = g_strrstr(folderuri, "groupwise");
-	else
+	folder_name = camel_folder_get_full_name (folder);
+
+	store = camel_folder_get_parent_store (folder);
+	provider = camel_service_get_provider (CAMEL_SERVICE (store));
+
+	if (g_strcmp0 (provider->protocol, "groupwise") != 0)
 		return NULL;
 
 	 /* This is kind of bad..but we don't have types for all these folders.*/
@@ -404,32 +405,26 @@ org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_d
 	     && strcmp (folder_name, "Trash")
 	     && strcmp (folder_name, "Checklist"))) {
 
-		g_free (folderuri);
 		return NULL;
 	}
 
-	if (account) {
-		CamelStore *parent_store;
+	cnc = get_cnc (store);
 
-		parent_store = camel_folder_get_parent_store (folder);
-		cnc = get_cnc (parent_store);
+	if (E_IS_GW_CONNECTION (cnc))
+		/* XXX Are we leaking folder_name?  I can't tell. */
+		id = get_container_id (cnc, g_strdup (folder_name));
+	else
+		g_warning("Could not Connnect\n");
 
-		if (E_IS_GW_CONNECTION (cnc))
-			id = get_container_id (cnc, folder_name);
-		else
-			g_warning("Could not Connnect\n");
+	if (cnc && id)
+		sharing_tab = share_folder_new (cnc, id);
+	else
+		return NULL;
 
-		if (cnc && id)
-			sharing_tab = share_folder_new (cnc, id);
-		else
-			return NULL;
+	gtk_notebook_append_page((GtkNotebook *) hook_data->parent, (GtkWidget *) sharing_tab->vbox, gtk_label_new_with_mnemonic N_("Sharing"));
+	common = sharing_tab;
 
-		gtk_notebook_append_page((GtkNotebook *) hook_data->parent, (GtkWidget *) sharing_tab->vbox, gtk_label_new_with_mnemonic N_("Sharing"));
-		common = sharing_tab;
-		g_free (folderuri);
-		return GTK_WIDGET (sharing_tab);
-	} else
-		return NULL;
+	return GTK_WIDGET (sharing_tab);
 }
 
 EGwConnection *



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