[evolution-kolab/account-mgmt: 9/12] EBookBackendKolab: Eliminate priv->book_uri.



commit 42d12062de306067f491e3751755c2b064e42e09
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jun 28 23:29:28 2012 -0400

    EBookBackendKolab: Eliminate priv->book_uri.

 src/addressbook/e-book-backend-kolab.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 21044d3..54ee1a4 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -58,7 +58,6 @@ struct _EBookBackendKolabPrivate
 {
 	/* GNOME_Evolution_Addressbook_BookMode	book_mode; */
 	KolabMailAccess *book_koma;
-	gchar *book_uri;
 	gboolean auth_received;
 	GError *mode_switch_err;
 };
@@ -238,7 +237,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 	KolabSettingsHandler *ksettings = NULL;
 	KolabMailAccess *tmp_koma = NULL;
 	KolabSyncStrategyID sync_value = KOLAB_SYNC_STRATEGY_DEFAULT;
-	gchar *sourcename = NULL;
+	const gchar *foldername;
 	gchar *servername = NULL;
 	gchar *username = NULL;
 	gchar *user_at_server = NULL;
@@ -273,8 +272,6 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 		goto exit;
 	}
 
-	priv->book_uri = e_source_get_uri (esource);
-
 	kolab_settings = book_backend_kolab_get_collection_settings (self);
 	network_settings = CAMEL_NETWORK_SETTINGS (kolab_settings);
 
@@ -285,7 +282,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 
 	/* Prepare data from sync strategy property */
 	sync_value = camel_kolab_imapx_settings_get_sync_strategy (kolab_settings);
-	sourcename = kolab_util_backend_get_relative_path_from_uri (priv->book_uri);
+	foldername = kolab_util_backend_get_foldername (E_BACKEND (backend));
 
 	/* Check whether we have a KolabMailAccess (KoMA) instance already */
 	user_at_server = g_strdup_printf ("%s %s",
@@ -309,7 +306,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 		                                     NULL,
 		                                     NULL,
 		                                     NULL,
-		                                     sourcename,
+		                                     foldername,
 		                                     &sync_value);
 		/* We may find that we do not yet have a password set.
 		 * In case we're requested to go online, we will need
@@ -362,7 +359,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 	                                     servername,
 	                                     username,
 	                                     NULL,
-	                                     sourcename,
+	                                     foldername,
 	                                     &sync_value);
 
 	/* create new KolabMailAccess instance */
@@ -617,7 +614,7 @@ e_book_backend_kolab_remove_contacts (EBookBackendSync *backend,
 	EBookBackendKolab *self = NULL;
 	EBookBackendKolabPrivate *priv = NULL;
 	const GSList *it = NULL;
-	gchar *sourcename = NULL;
+	const gchar *foldername;
 	gboolean ok = FALSE;
 	GError *tmp_err = NULL;
 
@@ -631,13 +628,13 @@ e_book_backend_kolab_remove_contacts (EBookBackendSync *backend,
 	self = E_BOOK_BACKEND_KOLAB (backend);
 	priv = E_BOOK_BACKEND_KOLAB_PRIVATE (self);
 
-	sourcename = kolab_util_backend_get_relative_path_from_uri (priv->book_uri);
+	foldername = kolab_util_backend_get_foldername (E_BACKEND (backend));
 
 	for (it = id_list; it != NULL; it = g_slist_next (it)) {
 		const gchar *uid = it->data;
 		ok = kolab_mail_access_delete_by_uid (priv->book_koma,
 		                                      uid,
-		                                      sourcename,
+		                                      foldername,
 		                                      cancellable,
 		                                      &tmp_err);
 		if (! ok) {
@@ -653,8 +650,6 @@ e_book_backend_kolab_remove_contacts (EBookBackendSync *backend,
 	}
 
  exit:
-	g_free (sourcename);
-
 	if (tmp_err != NULL) {
 		kolab_util_contact_err_to_edb_err (error, tmp_err, __func__, __LINE__);
 		g_error_free (tmp_err);
@@ -1045,7 +1040,6 @@ e_book_backend_kolab_authenticate_user (EBookBackendSync *backend,
 		g_warning (" + username from argument and username in "
 		           "KolabSettingsHandler do not match: %s vs. %s",
 		           tmp_user, user);
-	sourcename = kolab_util_backend_get_relative_path_from_uri (priv->book_uri);
 
 	kolab_util_backend_prepare_settings (ksettings,
 	                                     NULL,
@@ -1172,7 +1166,6 @@ e_book_backend_kolab_init (EBookBackendKolab *backend)
 
 	g_debug ("%s()[%u] called.", __func__, __LINE__);
 
-	priv->book_uri = NULL;
 	priv->book_koma = NULL;
 	priv->auth_received = FALSE;
 	priv->mode_switch_err = NULL;
@@ -1212,8 +1205,6 @@ e_book_backend_kolab_finalize (GObject *object)
 
 	g_debug ("%s()[%u] called.", __func__, __LINE__);
 
-	if (priv->book_uri != NULL)
-		g_free (priv->book_uri);
 	if (priv->mode_switch_err != NULL) {
 		g_warning ("%s()[%u]: %s",
 		           __func__, __LINE__, priv->mode_switch_err->message);



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