[evolution] I#430 - The first user's Search Folder not auto-shown in the folder tree
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#430 - The first user's Search Folder not auto-shown in the folder tree
- Date: Fri, 3 May 2019 08:32:02 +0000 (UTC)
commit b965fe607614148c47f48521a36012163b7010fd
Author: Milan Crha <mcrha redhat com>
Date: Fri May 3 10:33:19 2019 +0200
I#430 - The first user's Search Folder not auto-shown in the folder tree
Closes https://gitlab.gnome.org/GNOME/evolution/issues/430
src/libemail-engine/mail-vfolder.c | 6 +-----
src/mail/em-folder-tree-model.c | 25 ++++++++++++++++++++++++-
src/mail/em-folder-tree-model.h | 3 +++
src/mail/em-folder-tree.c | 3 +++
4 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/src/libemail-engine/mail-vfolder.c b/src/libemail-engine/mail-vfolder.c
index 843d145264..9d7acdd17f 100644
--- a/src/libemail-engine/mail-vfolder.c
+++ b/src/libemail-engine/mail-vfolder.c
@@ -1003,7 +1003,7 @@ store_folder_deleted_cb (CamelStore *store,
/* Warning not thread safe, but might be enough */
G_LOCK (vfolder);
- /* delete it from our list */
+ /* delete it from our list; can be NULL when already removed in the Search Folders edit dialog */
rule = e_rule_context_find_rule ((ERuleContext *) context, info->full_name, NULL);
if (rule) {
CamelSession *session;
@@ -1032,10 +1032,6 @@ store_folder_deleted_cb (CamelStore *store,
g_free (user);
g_object_unref (session);
- } else {
- g_warning (
- "Cannot find rule for deleted vfolder '%s'",
- info->display_name);
}
G_UNLOCK (vfolder);
diff --git a/src/mail/em-folder-tree-model.c b/src/mail/em-folder-tree-model.c
index 8014c604e2..552ef50098 100644
--- a/src/mail/em-folder-tree-model.c
+++ b/src/mail/em-folder-tree-model.c
@@ -81,6 +81,8 @@ struct _StoreInfo {
CamelStore *store;
GtkTreeRowReference *row;
+ gboolean loaded;
+
/* CamelFolderInfo::full_name -> GtkTreeRowReference */
GHashTable *full_hash;
@@ -202,6 +204,7 @@ store_info_new (EMFolderTreeModel *model,
si = g_slice_new0 (StoreInfo);
si->ref_count = 1;
si->store = g_object_ref (store);
+ si->loaded = FALSE;
si->full_hash = g_hash_table_new_full (
(GHashFunc) g_str_hash,
@@ -1425,6 +1428,9 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
return;
}
+ if (!si->loaded)
+ si->loaded = TRUE;
+
tree_store = GTK_TREE_STORE (model);
session = em_folder_tree_model_get_session (model);
@@ -1602,7 +1608,7 @@ folder_tree_model_folder_created_cb (CamelStore *store,
if (CAMEL_IS_SUBSCRIBABLE (store))
return;
- if (g_hash_table_size (si->full_hash) > 0)
+ if (si->loaded)
folder_tree_model_folder_subscribed_cb (store, fi, si);
}
@@ -2007,6 +2013,23 @@ em_folder_tree_model_list_stores (EMFolderTreeModel *model)
return list;
}
+void
+em_folder_tree_model_mark_store_loaded (EMFolderTreeModel *model,
+ CamelStore *store)
+{
+ StoreInfo *si;
+
+ g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
+ g_return_if_fail (CAMEL_IS_STORE (store));
+
+ si = folder_tree_model_store_index_lookup (model, store);
+
+ if (si) {
+ si->loaded = TRUE;
+ store_info_unref (si);
+ }
+}
+
gboolean
em_folder_tree_model_is_type_inbox (EMFolderTreeModel *model,
CamelStore *store,
diff --git a/src/mail/em-folder-tree-model.h b/src/mail/em-folder-tree-model.h
index 33c1da8a02..1402144e4c 100644
--- a/src/mail/em-folder-tree-model.h
+++ b/src/mail/em-folder-tree-model.h
@@ -139,6 +139,9 @@ void em_folder_tree_model_remove_all_stores
(EMFolderTreeModel *model);
GList * em_folder_tree_model_list_stores
(EMFolderTreeModel *model);
+void em_folder_tree_model_mark_store_loaded
+ (EMFolderTreeModel *model,
+ CamelStore *store);
gboolean em_folder_tree_model_is_type_inbox
(EMFolderTreeModel *model,
CamelStore *store,
diff --git a/src/mail/em-folder-tree.c b/src/mail/em-folder-tree.c
index 0ef8eb81f9..3fca8b16d7 100644
--- a/src/mail/em-folder-tree.c
+++ b/src/mail/em-folder-tree.c
@@ -328,6 +328,9 @@ folder_tree_get_folder_info_cb (CamelStore *store,
}
}
+ if (is_store)
+ em_folder_tree_model_mark_store_loaded (EM_FOLDER_TREE_MODEL (model), store);
+
/* The folder being expanded has no children after all. Remove
* the "Loading..." placeholder row and collapse the parent. */
if (child_info == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]