From 4dd58b9823a9526d9c55f01f77678fabe65dc0b3 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 2 Oct 2000 22:10:13 +0000 Subject: change/add prototypes and a typedef for ETreePathCompareFunc. 2000-10-02 Chris Toshok * e-tree-model.h: change/add prototypes and a typedef for ETreePathCompareFunc. * e-tree-model.c (e_tree_model_node_set_compare_function): new function, used to set the comparison function for sorted nodes. Eventually sorting entail just calling this function, with the tree maintaining the sort. (e_tree_model_node_sort): use a helper function (e_tree_model_node_compare) to allow the e-tree user's comparison function to take mode reasonable paramaters. also, fix it so the previous expanded state is kept with the node. i can't believe i wrote it the way it originally was. also, don't take the comparison function here. it's set in e_tree_model_node_set_compare_function. svn path=/trunk/; revision=5674 --- widgets/table/e-tree-model.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (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 b00101ca8e..ab142cc217 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -12,8 +12,11 @@ #define E_IS_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE)) typedef GNode ETreePath; +typedef struct ETreeModel ETreeModel; +typedef struct ETreeModelClass ETreeModelClass; +typedef gint (*ETreePathCompareFunc)(ETreeModel *, ETreePath *path1, ETreePath *path2); -typedef struct { +struct ETreeModel { ETableModel base; GNode *root; gboolean root_visible; @@ -21,9 +24,9 @@ typedef struct { guint32 num_expanded_to_save; guint32 num_collapsed_to_save; GHashTable *expanded_state; /* used for loading/saving expanded state */ -} ETreeModel; +}; -typedef struct { +struct ETreeModelClass { ETableModelClass parent_class; /* @@ -62,7 +65,7 @@ typedef struct { void (*node_collapsed) (ETreeModel *etm, ETreePath *node); void (*node_expanded) (ETreeModel *etm, ETreePath *node, gboolean *allow_expand); -} ETreeModelClass; +}; GtkType e_tree_model_get_type (void); void e_tree_model_construct (ETreeModel *etree); @@ -100,7 +103,8 @@ void e_tree_model_root_node_set_visible (ETreeModel *etree, gboolean visib gboolean e_tree_model_root_node_is_visible (ETreeModel *etree); /* sort routine, analogous to gtk_ctree_node_sort */ -void e_tree_model_node_sort (ETreeModel *tree_model, ETreePath *node, GCompareFunc compare); +void e_tree_model_node_set_compare_function (ETreeModel *tree_model, ETreePath *node, ETreePathCompareFunc compare); +void e_tree_model_node_sort (ETreeModel *tree_model, ETreePath *node); /* ** Routines for emitting signals on the ETreeModel -- cgit v1.2.3