[evolution-mapi] Account Setup : If we can find the username in the list of possible matches, return the index.



commit 3cc84768dee62686fb8f4848bc4f0e2006a62c27
Author: Johnny Jacob <jjohnny novell com>
Date:   Thu Dec 10 11:47:50 2009 +0530

    Account Setup : If we can find the username in the list of possible matches, return the index.
    
    Avoids a dialog being poped up when user has typed in the right information.

 .../exchange-mapi-account-setup.c                  |   12 +++++++++++-
 src/libexchangemapi/exchange-mapi-connection.c     |    4 ++--
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-mapi-account-setup.c b/src/account-setup-eplugin/exchange-mapi-account-setup.c
index 810b1fc..beb88e5 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-setup.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-setup.c
@@ -116,6 +116,16 @@ create_profile_callback (struct SRowSet *rowset, gpointer data)
 	GtkTreeSelection *selection;
 	GtkWidget *dialog, *view;
 	GtkVBox *vbox;
+	const gchar *username = (const gchar *)data;
+
+	/* If we can find the exact username, then find & return its index. */
+	for (i = 0; i < rowset->cRows; i++) {
+		lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT);
+
+		if (lpProp_account && lpProp_account->value.lpszA &&
+		    !g_strcmp0 (username, lpProp_account->value.lpszA))
+			return i;
+	}
 
 	/* NOTE: A good way would be display the list of username entries */
 	/* using GtkEntryCompletion in the username gtkentry. But plugins */
@@ -214,7 +224,7 @@ validate_credentials (GtkWidget *widget, EConfig *config)
 		gboolean status = exchange_mapi_create_profile (url->user, password, domain_name,
 								url->host, &error_msg, 
 								(mapi_profile_callback_t) create_profile_callback,
-								NULL);
+								url->user);
 		if (status) {
 			/* Things are successful */
 			gchar *profname = NULL, *uri = NULL; 
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index b564ffc..c7ce8f8 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -3106,8 +3106,8 @@ exchange_mapi_create_profile (const char *username, const char *password, const
 	}
 	d(g_print("MapiLogonProvider : succeeded \n"));
 
-	retval = ProcessNetworkProfile(session, username, callback, NULL); 
-	if (retval != MAPI_E_SUCCESS) {
+	retval = ProcessNetworkProfile(session, username, callback, data); 
+	If (retval != MAPI_E_SUCCESS) {
 		manage_mapi_error ("ProcessNetworkProfile", GetLastError(), error_msg);
 		g_debug ("Deleting profile %s ", profname); 
 		DeleteProfile(profname); 



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