[evolution-groupwise] groupwise-features: Avoid e_get_account_by_source_url().



commit 4a53846339f2f792770cecc4b9a85338728988c4
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu May 5 15:50:20 2011 +0530

    groupwise-features: Avoid e_get_account_by_source_url().
    
    Use e_get_account_by_uid() instead.

 src/plugins/install-shared.c      |    7 +++----
 src/plugins/proxy-login.c         |   22 +++++++++++++---------
 src/plugins/share-folder-common.c |   13 +++++--------
 3 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/plugins/install-shared.c b/src/plugins/install-shared.c
index d43d6fa..6d290d0 100644
--- a/src/plugins/install-shared.c
+++ b/src/plugins/install-shared.c
@@ -110,7 +110,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
 			container_id = get_container_id (cnc, parent_name);
 
 			if (e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) {
-				CamelURL *url;
+				const gchar *uid;
 
 				/* FIXME Not passing a GCancellable or GError here. */
 				folder = camel_store_get_folder_sync (
@@ -126,9 +126,8 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data)
 					CAMEL_MESSAGE_DELETED);
 				camel_folder_summary_touch (folder->summary);
 				/* camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", changes); */
-				url = camel_service_get_camel_url (service);
-				uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
-				account = e_get_account_by_source_url (uri);
+				uid = camel_service_get_uid (service);
+				account = e_get_account_by_uid (uid);
 				uri = account->source->url;
 				em_folder_tree_model_remove_store (
 					model, CAMEL_STORE (service));
diff --git a/src/plugins/proxy-login.c b/src/plugins/proxy-login.c
index 97446f6..fd96f56 100644
--- a/src/plugins/proxy-login.c
+++ b/src/plugins/proxy-login.c
@@ -507,10 +507,12 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
 	GtkTreeModel *model = NULL;
 	GtkTreeIter iter;
 	GtkWidget *tbox_account_name;
+	CamelStore *store;
+	EAccount *account;
 	gboolean is_store = FALSE;
-	gchar *uri = NULL;
 	proxyLoginPrivate *priv;
 	EGwConnection *cnc;
+	const gchar *uid;
 
 	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
 	g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
@@ -522,15 +524,19 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
 	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
 		return;
 
-	gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, COL_BOOL_IS_STORE, &is_store, -1);
+	gtk_tree_model_get (
+		model, &iter,
+		COL_POINTER_CAMEL_STORE, &store,
+		COL_BOOL_IS_STORE, &is_store, -1);
 
-	if (!is_store || !uri) {
-		g_free (uri);
+	if (!is_store)
 		return;
-	}
+
+	uid = camel_service_get_uid (CAMEL_SERVICE (store));
+	account = e_get_account_by_uid (uid);
 
 	/* This pops-up the password dialog in case the User has forgot-passwords explicitly */
-	cnc = proxy_login_get_cnc (e_get_account_by_source_url (uri), NULL);
+	cnc = proxy_login_get_cnc (account, NULL);
 	if (cnc)
 		g_object_unref (cnc);
 
@@ -541,7 +547,7 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
 	e_load_ui_builder_definition (priv->builder, "proxy-login-dialog.ui");
 
 	priv->main = e_builder_get_widget (priv->builder, "proxy_login_dialog");
-	pld->account = e_get_account_by_source_url (uri);
+	pld->account = account;
 	priv->tree = GTK_TREE_VIEW (e_builder_get_widget (priv->builder, "proxy_login_treeview"));
 	priv->store =  gtk_tree_store_new (2,
 					   GDK_TYPE_PIXBUF,
@@ -553,6 +559,4 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
 	gtk_widget_grab_focus (tbox_account_name);
 	g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(proxy_login_cb), e_shell_view_get_shell_window (shell_view));
 	gtk_widget_show (GTK_WIDGET (priv->main));
-
-	g_free (uri);
 }
diff --git a/src/plugins/share-folder-common.c b/src/plugins/share-folder-common.c
index 3adb754..20720e9 100644
--- a/src/plugins/share-folder-common.c
+++ b/src/plugins/share-folder-common.c
@@ -66,18 +66,16 @@ static void refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store);
 static void
 refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
 {
-	gchar *uri;
 	EAccount *account;
 	CamelProvider *provider;
-	CamelURL *url;
+	const gchar *uid;
+	gchar *uri;
 
-	url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-	uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+	uid = camel_service_get_uid (CAMEL_SERVICE (store));
+	account = e_get_account_by_uid (uid);
 
-	account = e_get_account_by_source_url (uri);
-	if (!account) {
+	if (account == NULL)
 		return;
-	}
 
 	uri = account->source->url;
 	em_folder_tree_model_remove_store (model, store);
@@ -89,7 +87,6 @@ refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
 	if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
 		return;
 	em_folder_tree_model_add_store (model, store, account->name);
-	/* g_object_unref (store); */
 }
 
 void



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