From a02934f6a81406fa9509025e94199e9e78ea59a8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 7 May 2004 20:36:18 +0000 Subject: Fix for bug #57152. 2004-05-07 Jeffrey Stedfast Fix for bug #57152. * em-folder-tree.c (emft_get_folder_info__got): If we queried for a recursive folder-info listing, then pass fully_loaded as TRUE to set_folder_info(). (emft_get_folder_info__got): If we find that a folder doesn't have children, set the expanded state to FALSE. * em-folder-tree-model.c (em_folder_tree_model_set_folder_info): Now takes a "fully_loaded" argument to hint to set_folder_info whether or not folder-info's without child nodes can possibly have children (eg. if fully_loaded is set and fi->child is NULL, then 'load' will be FALSE no matter what fi->flags contains). svn path=/trunk/; revision=25826 --- mail/ChangeLog | 16 ++++++++++++++++ mail/em-folder-tree-model.c | 13 +++++++------ mail/em-folder-tree-model.h | 2 +- mail/em-folder-tree.c | 7 ++++++- 4 files changed, 30 insertions(+), 8 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 005367b822..664b809101 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,19 @@ +2004-05-07 Jeffrey Stedfast + + Fix for bug #57152. + + * em-folder-tree.c (emft_get_folder_info__got): If we queried for + a recursive folder-info listing, then pass fully_loaded as TRUE to + set_folder_info(). + (emft_get_folder_info__got): If we find that a folder doesn't have + children, set the expanded state to FALSE. + + * em-folder-tree-model.c (em_folder_tree_model_set_folder_info): + Now takes a "fully_loaded" argument to hint to set_folder_info + whether or not folder-info's without child nodes can possibly have + children (eg. if fully_loaded is set and fi->child is NULL, then + 'load' will be FALSE no matter what fi->flags contains). + 2004-05-07 Radek Doulik * mail-config.c (config_write_style): set cite_color property of diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 8c81be9735..571ac3042b 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -411,17 +411,18 @@ account_removed (EAccountList *accounts, EAccount *account, gpointer user_data) void em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *iter, struct _EMFolderTreeModelStoreInfo *si, - CamelFolderInfo *fi) + CamelFolderInfo *fi, int fully_loaded) { GtkTreeRowReference *uri_row, *path_row; unsigned int unread; GtkTreePath *path; GtkTreeIter sub; - gboolean load; + gboolean load = FALSE; struct _CamelFolder *folder; gboolean emitted = FALSE; - load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS)); + if (!fully_loaded) + load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS)); path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter); uri_row = gtk_tree_row_reference_new ((GtkTreeModel *) model, path); @@ -493,7 +494,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite emitted = TRUE; } - em_folder_tree_model_set_folder_info (model, &sub, si, fi); + em_folder_tree_model_set_folder_info (model, &sub, si, fi, fully_loaded); fi = fi->next; } while (fi); } @@ -558,7 +559,7 @@ folder_subscribed (CamelStore *store, CamelFolderInfo *fi, EMFolderTreeModel *mo /* append a new node */ gtk_tree_store_append ((GtkTreeStore *) model, &iter, &parent); - em_folder_tree_model_set_folder_info (model, &iter, si, fi); + em_folder_tree_model_set_folder_info (model, &iter, si, fi, TRUE); g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->path, fi->uri); @@ -701,7 +702,7 @@ folder_renamed (CamelStore *store, CamelRenameInfo *info, EMFolderTreeModel *mod } gtk_tree_store_append ((GtkTreeStore *) model, &iter, &root); - em_folder_tree_model_set_folder_info (model, &iter, si, info->new); + em_folder_tree_model_set_folder_info (model, &iter, si, info->new, TRUE); done: diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index 7685399197..c6beb52ee1 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -121,7 +121,7 @@ EMFolderTreeModel *em_folder_tree_model_new (const char *evolution_dir); void em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *iter, struct _EMFolderTreeModelStoreInfo *si, - CamelFolderInfo *fi); + CamelFolderInfo *fi, int fully_loaded); void em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, const char *display_name); void em_folder_tree_model_remove_store (EMFolderTreeModel *model, CamelStore *store); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 68bf9eceb2..bf814c1bb4 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -145,6 +145,8 @@ static void em_folder_tree_finalize (GObject *obj); static gboolean emft_save_state (EMFolderTree *emft); static void emft_queue_save_state (EMFolderTree *emft); +static void emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter *iter, gboolean expanded); + static void emft_tree_row_activated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, EMFolderTree *emft); static void emft_tree_row_collapsed (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); static void emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *path, EMFolderTree *emft); @@ -1701,10 +1703,13 @@ emft_get_folder_info__got (struct _mail_msg *mm) if (fi == NULL) { /* no children afterall... remove the "Loading..." placeholder node */ + emft_update_model_expanded_state (priv, &root, FALSE); gtk_tree_store_remove (model, &iter); } else { + int fully_loaded = (m->flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? TRUE : FALSE; + do { - em_folder_tree_model_set_folder_info (priv->model, &iter, si, fi); + em_folder_tree_model_set_folder_info (priv->model, &iter, si, fi, fully_loaded); if ((fi = fi->next) != NULL) gtk_tree_store_append (model, &iter, &root); -- cgit