[evolution-patches] Exchange favourite folders
- From: "Ahmed Sarfraaz" <asarfraaz novell com>
- To: <evolution-patches lists ximian com>
- Subject: [evolution-patches] Exchange favourite folders
- Date: Tue, 29 Mar 2005 03:28:58 -0700
This patch handles the favourite folder handling in a more cleaner way
and also fixes the ref count on the folders going wrong. Changelog has
the explainations.
Thanks
-- Sarfraaz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.310
diff -u -p -u -r1.310 ChangeLog
--- ChangeLog 29 Mar 2005 07:54:13 -0000 1.310
+++ ChangeLog 29 Mar 2005 10:26:04 -0000
@@ -1,3 +1,15 @@
+2005-03-29 Sarfraaz Ahmed <asarfraaz novell com>
+
+ * storage/exchange-account.c (hierarchy_new_folder) : No need to check
+ for an entry already being present in the hashtable since we no longer
+ can have such a situation.
+ (hierarchy_removed_folder) : Handled the extra unrefs.
+ * storage/exchange-hierarchy-favorites.c
+ (exchange_hierarchy_favorites_add_folder) : Dont create a favourite
+ folder if its already been created.
+ * storage/exchange-hierarchy-webdav.c (scan_subtree) : Added a unref
+ which was missing.
+
2005-03-29 Sushma Rai <rsushma novell com>
* storage/exchange-folder-size.[ch] (free_fsize_table): Freeing the key
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-account.c,v
retrieving revision 1.39
diff -u -p -u -r1.39 exchange-account.c
--- storage/exchange-account.c 11 Mar 2005 07:50:21 -0000 1.39
+++ storage/exchange-account.c 29 Mar 2005 10:26:04 -0000
@@ -333,59 +333,49 @@ hierarchy_new_folder (ExchangeHierarchy
/* This makes the cleanup easier. We just unref it each time
* we find it in account->priv->folders.
*/
- if (!g_hash_table_lookup (account->priv->folders,
- e_folder_exchange_get_path (folder))) {
- /* Avoid dupilcations since the user could add a folder as
- favorite even though it is already marked as favorite */
- g_object_ref (folder);
- g_hash_table_insert (account->priv->folders,
- (char *)e_folder_exchange_get_path (folder),
- folder);
- table_updated = 1;
- }
- if (!g_hash_table_lookup (account->priv->folders,
- e_folder_get_physical_uri (folder))) {
- /* Avoid dupilcations since the user could add a folder as
- favorite even though it is already marked as favorite */
- g_object_ref (folder);
- g_hash_table_insert (account->priv->folders,
- (char *)e_folder_get_physical_uri (folder),
- folder);
- table_updated = 1;
- }
+ g_object_ref (folder);
+ g_hash_table_insert (account->priv->folders,
+ (char *)e_folder_exchange_get_path (folder),
+ folder);
+
+ g_object_ref (folder);
+ g_hash_table_insert (account->priv->folders,
+ (char *)e_folder_get_physical_uri (folder),
+ folder);
+
if (!g_hash_table_lookup (account->priv->folders,
e_folder_exchange_get_internal_uri (folder))) {
/* The internal_uri for public folders and favorites folder
is same !!! Without this check the folder value could
overwrite the previously added folder. */
- g_object_ref (folder);
g_hash_table_insert (account->priv->folders,
(char *)e_folder_exchange_get_internal_uri (folder),
folder);
- table_updated = 1;
}
+
+ g_object_ref (folder);
+
if (permanent_uri && (!g_hash_table_lookup (account->priv->folders,
permanent_uri))) {
g_object_ref (folder);
g_hash_table_insert (account->priv->folders,
(char *)permanent_uri,
folder);
- table_updated = 1;
}
- if (table_updated)
- {
- g_hash_table_insert (account->priv->hierarchies_by_folder,
- folder, hier);
+ g_hash_table_insert (account->priv->hierarchies_by_folder,
+ folder, hier);
- g_signal_emit (account, signals[NEW_FOLDER], 0, folder);
- }
+ g_signal_emit (account, signals[NEW_FOLDER], 0, folder);
}
static void
hierarchy_removed_folder (ExchangeHierarchy *hier, EFolder *folder,
ExchangeAccount *account)
{
+ const char *permanent_uri =
+ e_folder_exchange_get_permanent_uri (folder);
+
if (!g_hash_table_lookup (account->priv->folders,
e_folder_exchange_get_path (folder)))
return;
@@ -408,7 +398,8 @@ hierarchy_removed_folder (ExchangeHierar
g_object_unref (folder);
g_object_unref (folder);
- if (hier->type != EXCHANGE_HIERARCHY_FAVORITES) {
+ g_object_unref (folder);
+ if (permanent_uri) {
g_object_unref (folder);
}
}
@@ -868,6 +859,8 @@ get_password (ExchangeAccount *account,
NULL);
if (remember != oldremember) {
account->priv->account->source->save_passwd = remember;
+ if (!remember)
+ e_passwords_forget_password ("Exchange", account->priv->password_key);
}
g_free (prompt);
}
Index: storage/exchange-hierarchy-favorites.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-hierarchy-favorites.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 exchange-hierarchy-favorites.c
--- storage/exchange-hierarchy-favorites.c 26 Feb 2005 14:19:16 -0000 1.14
+++ storage/exchange-hierarchy-favorites.c 29 Mar 2005 10:26:04 -0000
@@ -247,7 +247,7 @@ exchange_hierarchy_favorites_add_folder
E2kProperties *props;
E2kHTTPStatus status;
const char *folder_uri, *permanent_uri;
- char *shortcut_uri;
+ char *shortcut_uri = NULL;
g_return_val_if_fail (EXCHANGE_IS_HIERARCHY (hier), EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR);
g_return_val_if_fail (E_IS_FOLDER (folder), EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR);
@@ -255,6 +255,9 @@ exchange_hierarchy_favorites_add_folder
hfav = EXCHANGE_HIERARCHY_FAVORITES (hier);
permanent_uri = e_folder_exchange_get_permanent_uri (folder);
+ folder_uri = e_folder_exchange_get_internal_uri (folder);
+ if (g_hash_table_lookup (hfav->priv->shortcuts, folder_uri) != NULL)
+ return EXCHANGE_ACCOUNT_FOLDER_OK;
props = e2k_properties_new ();
e2k_properties_set_string (props, PR_FAV_DISPLAY_NAME,
@@ -272,7 +275,6 @@ exchange_hierarchy_favorites_add_folder
e2k_properties_free (props);
if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
- folder_uri = e_folder_exchange_get_internal_uri (folder);
g_hash_table_insert (hfav->priv->shortcuts,
g_strdup (folder_uri), shortcut_uri);
Index: storage/exchange-hierarchy-webdav.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-hierarchy-webdav.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 exchange-hierarchy-webdav.c
--- storage/exchange-hierarchy-webdav.c 29 Mar 2005 07:54:13 -0000 1.28
+++ storage/exchange-hierarchy-webdav.c 29 Mar 2005 10:26:05 -0000
@@ -213,7 +213,7 @@ hierarchy_removed_folder (ExchangeHierar
g_hash_table_remove (EXCHANGE_HIERARCHY_WEBDAV (hier)->priv->folders_by_internal_path,
(char *)e2k_uri_path (internal_uri));
-
+
mf_path = e_folder_exchange_get_storage_file (folder, "connector-metadata.xml");
unlink (mf_path);
g_free (mf_path);
@@ -741,7 +741,7 @@ scan_subtree (ExchangeHierarchy *hier, E
exchange_hierarchy_webdav_offline_scan_subtree (EXCHANGE_HIERARCHY (hier), add_folders, folders);
for (i = 0; i <folders->len; i++) {
tmp = (EFolder *)folders->pdata[i];
- exchange_hierarchy_new_folder (hier, (EFolder *)folders->pdata[i]);
+ exchange_hierarchy_new_folder (hier, tmp);
}
return EXCHANGE_ACCOUNT_FOLDER_OK;
}
@@ -770,6 +770,7 @@ scan_subtree (ExchangeHierarchy *hier, E
subtrees = g_slist_prepend (subtrees, folder);
}
exchange_hierarchy_new_folder (hier, folder);
+ g_object_unref (folder);
/* Check the folder size here */
name = e2k_properties_get_prop (result->props,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]