Commit b965fe60 authored by Milan Crha's avatar Milan Crha

I#430 - The first user's Search Folder not auto-shown in the folder tree

Closes GNOME/evolution#430
parent 7f7e4a5d
......@@ -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);
......
......@@ -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,
......
......@@ -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,
......
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment