From 1084ed7340617c3476cf33694256dd06f07d86ec Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 25 Sep 2000 19:02:44 +0000 Subject: add save_state stuff to ETreeModel, and prototypes for the public methods. 2000-09-25 Chris Toshok * gal/e-table/e-tree-model.h: add save_state stuff to ETreeModel, and prototypes for the public methods. * gal/e-table/e-tree-model.c: add save_id to the ENode. (expanded_remove_func): new function, iterator to delete the save id's. (etree_destroy): iterate over expanded_state. (etree_set_expanded): if the node has a save id, make sure to update both the collapsed and expanded counts. (e_tree_model_node_insert_id): convenience function that inserts a node and sets its id. (e_tree_model_node_sort): remove extra spew. (save_expanded_state_func): new function, iterator for saving expanded state. (e_tree_model_save_expanded_state): new function. (get_string_value): helper function for loading. (e_tree_model_load_expanded_state): new function. (e_tree_model_node_set_save_id): sets the save id for a node, adding it to the hashtable if it's not already there. if the id was there previously, set the expanded flag of the node accordingly. svn path=/trunk/; revision=5573 --- widgets/table/e-tree-model.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'widgets/table/e-tree-model.h') diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h index 318faaa0a4..b00101ca8e 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -18,6 +18,9 @@ typedef struct { GNode *root; gboolean root_visible; GArray *row_array; /* used in the mapping between ETable and our tree */ + guint32 num_expanded_to_save; + guint32 num_collapsed_to_save; + GHashTable *expanded_state; /* used for loading/saving expanded state */ } ETreeModel; typedef struct { @@ -108,4 +111,11 @@ void e_tree_model_node_removed (ETreeModel *tree_model, ETreePath *parent_node void e_tree_model_node_collapsed (ETreeModel *tree_model, ETreePath *node); void e_tree_model_node_expanded (ETreeModel *tree_model, ETreePath *node, gboolean *allow_expand); +/* expanded state saving stuff */ +gboolean e_tree_model_save_expanded_state (ETreeModel *etm, const char *filename); +gboolean e_tree_model_load_expanded_state (ETreeModel *etm, const char *filename); +void e_tree_model_node_set_save_id (ETreeModel *etm, ETreePath *node, const char *id); +ETreePath* e_tree_model_node_insert_id (ETreeModel *tree_model, ETreePath *parent_path, + int position, gpointer node_data, const char *save_id); + #endif /* _E_TREE_MODEL_H */ -- cgit