[evolution-data-server] Bug 731440 - [IMAPx] Moved folder within account duplicated in UI
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 731440 - [IMAPx] Moved folder within account duplicated in UI
- Date: Wed, 25 Jun 2014 18:33:39 +0000 (UTC)
commit 03d795df7a4959e3ddd8d302b4adaa91a3f3f0f4
Author: Milan Crha <mcrha redhat com>
Date: Wed Jun 25 20:31:52 2014 +0200
Bug 731440 - [IMAPx] Moved folder within account duplicated in UI
camel/providers/imapx/camel-imapx-folder.c | 5 ++-
camel/providers/imapx/camel-imapx-server.c | 3 +-
camel/providers/imapx/camel-imapx-store.c | 31 ++++++++++++++++++----------
camel/providers/imapx/camel-imapx-utils.c | 2 +
4 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index e9f3910..e889b8d 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -820,17 +820,17 @@ imapx_refresh_info_sync (CamelFolder *folder,
CamelIMAPXServer *imapx_server;
CamelIMAPXMailbox *mailbox = NULL;
CamelFolderChangeInfo *changes;
- const gchar *folder_name;
+ gchar *folder_name;
gboolean success = FALSE;
GError *local_error = NULL;
store = camel_folder_get_parent_store (folder);
- folder_name = camel_folder_get_full_name (folder);
/* Not connected, thus skip the operation */
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
return TRUE;
+ folder_name = g_strdup (camel_folder_get_full_name (folder));
imapx_store = CAMEL_IMAPX_STORE (store);
imapx_server = camel_imapx_store_ref_server (imapx_store, folder_name, TRUE, cancellable, error);
@@ -874,6 +874,7 @@ imapx_refresh_info_sync (CamelFolder *folder,
exit:
g_clear_object (&mailbox);
g_clear_object (&imapx_server);
+ g_free (folder_name);
return success;
}
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 5e98af2..73d0f90 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -694,7 +694,8 @@ imapx_server_remove_job_mailbox (CamelIMAPXServer *imapx_server,
folder_path = camel_imapx_mailbox_dup_folder_path (mailbox);
n_stored = GPOINTER_TO_INT (g_hash_table_lookup (imapx_server->priv->jobs_prop_folder_paths,
folder_path));
- g_warn_if_fail (n_stored >= 1);
+ if (!camel_imapx_mailbox_is_inbox (camel_imapx_mailbox_get_name (mailbox)))
+ g_warn_if_fail (n_stored >= 1);
n_stored--;
if (n_stored > 0) {
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 1c5c7c7..7896ccb 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -413,7 +413,7 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
gboolean emit_folder_created_subscribed = FALSE;
gboolean emit_folder_unsubscribed_deleted = FALSE;
gboolean emit_folder_renamed = FALSE;
- const gchar *folder_path;
+ gchar *folder_path;
const gchar *mailbox_name;
gchar separator;
@@ -441,6 +441,8 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
/* Summary retains ownership of the returned CamelStoreInfo. */
si = camel_imapx_store_summary_mailbox (store->summary, mailbox_name);
+ if (!si && oldname)
+ si = camel_imapx_store_summary_mailbox (store->summary, oldname);
if (si != NULL) {
mailbox_was_in_summary = TRUE;
if (si->info.flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)
@@ -462,8 +464,7 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
camel_store_summary_touch (store->summary);
}
- folder_path = camel_store_info_path (
- store->summary, (CamelStoreInfo *) si);
+ folder_path = camel_imapx_mailbox_to_folder_path (mailbox_name, separator);
fi = imapx_store_build_folder_info (store, folder_path, flags);
/* Figure out which signals to emit, if any. */
@@ -499,14 +500,14 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
emit_folder_created_subscribed = FALSE;
emit_folder_unsubscribed_deleted = FALSE;
emit_folder_renamed = FALSE;
+ } else {
+ /* At most one signal emission flag should be set. */
+ g_warn_if_fail (
+ (emit_folder_created_subscribed ? 1 : 0) +
+ (emit_folder_unsubscribed_deleted ? 1 : 0) +
+ (emit_folder_renamed ? 1 : 0) <= 1);
}
- /* At most one signal emission flag should be set. */
- g_warn_if_fail (
- (emit_folder_created_subscribed ? 1 : 0) +
- (emit_folder_unsubscribed_deleted ? 1 : 0) +
- (emit_folder_renamed ? 1 : 0) <= 1);
-
if (emit_folder_created_subscribed) {
camel_store_folder_created (
CAMEL_STORE (store), fi);
@@ -535,14 +536,14 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
imapx_store_rename_storage_path (
store, old_folder_path, new_folder_path);
- camel_store_folder_renamed (
- CAMEL_STORE (store), old_folder_path, fi);
+ camel_store_folder_renamed (CAMEL_STORE (store), old_folder_path, fi);
g_free (old_folder_path);
g_free (new_folder_path);
}
camel_folder_info_free (fi);
+ g_free (folder_path);
}
static void
@@ -2042,6 +2043,10 @@ imapx_store_rename_folder_sync (CamelStore *store,
g_object_unref (settings);
+ /* This suppresses CamelStore signal emissions
+ * in imapx_store_process_mailbox_attributes(). */
+ g_atomic_int_inc (&imapx_store->priv->syncing_folders);
+
imapx_server = camel_imapx_store_ref_server (imapx_store, NULL, FALSE, cancellable, error);
if (imapx_server == NULL)
@@ -2149,6 +2154,10 @@ exit:
g_clear_object (&mailbox);
g_clear_object (&imapx_server);
+ /* This enabled CamelStore signal emissions
+ * in imapx_store_process_mailbox_attributes() again. */
+ g_atomic_int_dec_and_test (&imapx_store->priv->syncing_folders);
+
return success;
}
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 060bf68..0276d75 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -2458,6 +2458,8 @@ camel_imapx_command_add_qresync_parameter (CamelIMAPXCommand *ic,
imapx_summary = CAMEL_IMAPX_SUMMARY (folder->summary);
mailbox = camel_imapx_folder_ref_mailbox (imapx_folder);
+ if (!mailbox)
+ return FALSE;
last_known_uidvalidity = camel_imapx_mailbox_get_uidvalidity (mailbox);
last_known_modsequence = imapx_summary->modseq;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]