From b036a0df45473a69635b72f71341bc5d4f3deb5e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 16 Mar 2004 22:54:55 +0000 Subject: Fix for bug #55358. 2004-03-16 Jeffrey Stedfast Fix for bug #55358. * em-folder-tree.c (emft_expand_node): Changed to be the callback function for em_folder_tree_model_expand_foreach(). (emft_maybe_expand_row): Renamed from emft_loading_row_cb(). We now handle both "loading-row" an "loaded-row" signals. Also updated for slight change in key generation. (em_folder_tree_new_with_model): Connect to the "loaded-row" signal. (emft_update_model_expanded_state): Updated for slight change in key generation. * em-folder-tree-model.c (em_folder_tree_model_add_store): Emit the "loaded-row" signal for the newly added store. (em_folder_tree_model_set_folder_info): Emit "loaded-row" for the row we've just set the info on (but only after we've added a child node if there is one, so the signal handler can expand the newly added row if appropriate). (em_folder_tree_model_class_init): Setup the "loaded-row" signal. (em_folder_tree_model_finalize): The tree-state is now an xml file and not a binary file, so change the expanded free func. (em_folder_tree_model_load_state): Load the expand-state xml file. If one doesn't exist, setup some defaults. (em_folder_tree_model_get_expanded): Scan the XML tree for the node. (em_folder_tree_model_set_expanded): Same. (em_folder_tree_model_save_expanded): Save the expand-state xml tree to disk. (em_folder_tree_model_expand_foreach): New function to iterate over all xml nodes and call the callback if the expand state is "true". svn path=/trunk/; revision=25094 --- mail/em-folder-tree-model.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'mail/em-folder-tree-model.h') diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index 103dc57052..7685399197 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -27,6 +27,8 @@ #include #include +#include + #include #include @@ -81,11 +83,11 @@ struct _EMFolderTreeModelStoreInfo { struct _EMFolderTreeModel { GtkTreeStore parent_object; - char *filename; /* state filename */ + char *filename; /* state filename */ + xmlDocPtr expanded; /* saved expanded state from previous session */ GHashTable *store_hash; /* maps CamelStore's to store-info's */ GHashTable *uri_hash; /* maps URI's to GtkTreeRowReferences */ - GHashTable *expanded; /* saved expanded state from previous session */ EAccountList *accounts; GHashTable *account_hash; /* maps accounts to store-info's */ @@ -101,6 +103,10 @@ struct _EMFolderTreeModelClass { GtkTreePath *path, GtkTreeIter *iter); + void (* loaded_row) (EMFolderTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter); + void (* folder_added) (EMFolderTreeModel *model, const char *path, const char *uri); @@ -126,6 +132,9 @@ gboolean em_folder_tree_model_get_expanded (EMFolderTreeModel *model, const char void em_folder_tree_model_set_expanded (EMFolderTreeModel *model, const char *key, gboolean expanded); void em_folder_tree_model_save_expanded (EMFolderTreeModel *model); +typedef void (* EMFTModelExpandFunc) (EMFolderTreeModel *model, const char *path, void *user_data); +void em_folder_tree_model_expand_foreach (EMFolderTreeModel *model, EMFTModelExpandFunc func, void *user_data); + void em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore *store, const char *path, int unread); #ifdef __cplusplus -- cgit