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



commit b1269d22fc8c9d067c6d69710db6158a129fada3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 3 15:18:15 2011 -0400

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

 plugins/groupwise-features/install-shared.c      |    7 +++----
 plugins/groupwise-features/proxy-login.c         |   22 +++++++++++++---------
 plugins/groupwise-features/share-folder-common.c |   13 +++++--------
 3 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c
index d43d6fa..6d290d0 100644
--- a/plugins/groupwise-features/install-shared.c
+++ b/plugins/groupwise-features/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/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index 3f80ac9..55d4ecf 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -508,10 +508,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);
@@ -523,15 +525,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);
 
@@ -542,7 +548,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,
@@ -554,6 +560,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/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c
index 3adb754..20720e9 100644
--- a/plugins/groupwise-features/share-folder-common.c
+++ b/plugins/groupwise-features/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]