evolution-data-server r9365 - in trunk/servers/exchange: . storage



Author: msuman
Date: Mon Aug 18 04:59:37 2008
New Revision: 9365
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9365&view=rev

Log:
Milan Crha  <mcrha redhat com> ** Part of fix for bug #324203 (New function to retrieve account's source url params easily, Update GAL source's can-browse property properly).

Modified:
   trunk/servers/exchange/ChangeLog
   trunk/servers/exchange/storage/exchange-account.c
   trunk/servers/exchange/storage/exchange-account.h
   trunk/servers/exchange/storage/exchange-esource.c

Modified: trunk/servers/exchange/storage/exchange-account.c
==============================================================================
--- trunk/servers/exchange/storage/exchange-account.c	(original)
+++ trunk/servers/exchange/storage/exchange-account.c	Mon Aug 18 04:59:37 2008
@@ -1683,6 +1683,37 @@
 }
 
 /**
+ * exchange_account_get_account_uri_param:
+ * @acct: and #ExchangeAccount
+ * @param: uri param name to get
+ *
+ * Reads the parameter #param from the source url of the underlying EAccount.
+ * Returns the value or NULL. Returned value should be freed with g_free.
+ **/
+char *
+exchange_account_get_account_uri_param (ExchangeAccount *acct, const char *param)
+{
+	EAccount *account;
+	E2kUri *uri;
+	char *res;
+
+	g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (acct), NULL);
+	g_return_val_if_fail (param != NULL, NULL);
+
+	account = exchange_account_fetch (acct);
+	g_return_val_if_fail (account != NULL, NULL);
+
+	uri = e2k_uri_new (e_account_get_string (account, E_ACCOUNT_SOURCE_URL));
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	res = g_strdup (e2k_uri_get_param (uri, param));
+
+	e2k_uri_free (uri);
+
+	return res;
+}
+
+/**
  * exchange_account_get_standard_uri:
  * @account: an #ExchangeAccount
  * @item: the short name of the standard URI

Modified: trunk/servers/exchange/storage/exchange-account.h
==============================================================================
--- trunk/servers/exchange/storage/exchange-account.h	(original)
+++ trunk/servers/exchange/storage/exchange-account.h	Mon Aug 18 04:59:37 2008
@@ -81,6 +81,7 @@
 E2kGlobalCatalog      *exchange_account_get_global_catalog   (ExchangeAccount  *acct);
 
 EAccount 	      *exchange_account_fetch 		     (ExchangeAccount *acct);
+char                  *exchange_account_get_account_uri_param (ExchangeAccount *acct, const char *param);
 
 const char            *exchange_account_get_standard_uri     (ExchangeAccount  *acct,
 							      const char       *item);

Modified: trunk/servers/exchange/storage/exchange-esource.c
==============================================================================
--- trunk/servers/exchange/storage/exchange-esource.c	(original)
+++ trunk/servers/exchange/storage/exchange-esource.c	Mon Aug 18 04:59:37 2008
@@ -106,9 +106,13 @@
 			return;
 		}
 		if (is_contacts_folder && g_str_has_prefix (physical_uri, "gal://")) {
+			char *browse = exchange_account_get_account_uri_param (account, "ad_browse");
+
 			source = e_source_new_with_absolute_uri (folder_name,
 								 physical_uri);
 			e_source_set_property (source, "completion", "true");
+			e_source_set_property (source, "can-browse", browse ? "1" : NULL);
+			g_free (browse);
 		}
 		else {
 			source = e_source_new (folder_name, relative_uri);
@@ -145,9 +149,13 @@
 							folder_name)) == NULL) {
 			printf("old group, new source\n");
 			if (is_contacts_folder && g_str_has_prefix (physical_uri, "gal://")) {
+				char *browse = exchange_account_get_account_uri_param (account, "ad_browse");
+
 				source = e_source_new_with_absolute_uri (
 						folder_name, physical_uri);
 				e_source_set_property (source, "completion", "true");
+				e_source_set_property (source, "can-browse", browse ? "1" : NULL);
+				g_free (browse);
 			}
 			else {
         			source = e_source_new (folder_name, relative_uri);
@@ -185,6 +193,17 @@
 					e_source_list_sync (source_list, NULL);
 				}
 			}
+
+			if (is_contacts_folder && g_str_has_prefix (physical_uri, "gal://")) {
+				char *browse = exchange_account_get_account_uri_param (account, "ad_browse");
+				const char *old_browse = e_source_get_property (source, "can-browse");
+
+				if ((old_browse || browse) && (!old_browse || !browse)) {
+					e_source_set_property (source, "can-browse", browse ? "1" : NULL);
+				}
+
+				g_free (browse);
+			}
 		}
 	}
 



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