diff options
author | Milan Crha <mcrha@redhat.com> | 2008-08-11 18:08:14 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-08-11 18:08:14 +0800 |
commit | 28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9 (patch) | |
tree | 19c341addfb7d286a202084f14bdb146c1875c3b /widgets/table/e-tree-table-adapter.c | |
parent | c29e1c65703bc651f786130024da2efcedcf607d (diff) | |
download | gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar.gz gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar.zst gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.zip |
** Fix for bug #519292
2008-08-11 Milan Crha <mcrha@redhat.com>
** Fix for bug #519292
* mail/message-list.c: (load_tree_expand_all): Drop function.
* mail/message-list.c: (regen_list_done): Rather use desired expanded state
value when creating the tree instead of the default model's value for
this to have 'expand/collapse all' commands work better and quicker.
* widgets/tablee-tree.h: (e_tree_load_all_expanded_state):
* widgets/tablee-tree.c: (e_tree_load_all_expanded_state):
* widgets/tablee-tree-table-adapter.h:
(e_tree_table_adapter_load_all_expanded_state):
* widgets/tablee-tree-table-adapter.c:
(e_tree_table_adapter_load_all_expanded_state),
(set_expanded_state_func), (set_collapsed_state_func):
Drop functions in favor of new functions.
* widgets/tablee-tree.h: (e_tree_force_expanded_state):
* widgets/tablee-tree.c: (e_tree_force_expanded_state):
* widgets/tablee-tree-table-adapter.h: (e_tree_table_adapter_force_expanded_state):
* widgets/tablee-tree-table-adapter.c: (e_tree_table_adapter_force_expanded_state),
(struct ETreeTableAdapterPriv), (create_gnode), (etta_init):
Use either default value of the model to expanded state of new node or
use the one which has been set (forced) by new functions.
svn path=/trunk/; revision=35954
Diffstat (limited to 'widgets/table/e-tree-table-adapter.c')
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index b5567a0b95..6029d849c2 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -82,6 +82,8 @@ struct ETreeTableAdapterPriv { int sort_info_changed_id; guint resort_idle_id; + + int force_expanded_state; /* use this instead of model's default if not 0; <0 ... collapse, >0 ... expand */ }; static void etta_sort_info_changed (ETableSortInfo *sort_info, ETreeTableAdapter *etta); @@ -322,7 +324,7 @@ create_gnode(ETreeTableAdapter *etta, ETreePath path) node = g_new0(node_t, 1); node->path = path; node->index = -1; - node->expanded = e_tree_model_get_expanded_default(etta->priv->source); + node->expanded = etta->priv->force_expanded_state == 0 ? e_tree_model_get_expanded_default (etta->priv->source) : etta->priv->force_expanded_state > 0; node->expandable = e_tree_model_node_is_expandable(etta->priv->source, path); node->expandable_set = 1; node->num_visible_children = 0; @@ -737,6 +739,7 @@ etta_init (ETreeTableAdapter *etta) etta->priv->node_request_collapse_id = 0; etta->priv->resort_idle_id = 0; + etta->priv->force_expanded_state = 0; } static void @@ -996,42 +999,13 @@ open_file (ETreeTableAdapter *etta, const char *filename) return doc; } -static void -set_expanded_state_func (gpointer keyp, gpointer value, gpointer data) -{ - ETreePath path = keyp; - node_t *node = ((GNode *)value)->data; - ETreeTableAdapter *etta = (ETreeTableAdapter *) data; - - if (node->expanded != TRUE) { - e_tree_table_adapter_node_set_expanded_recurse (etta, path, TRUE); - node->expanded = TRUE; - } -} - -static void -set_collapsed_state_func (gpointer keyp, gpointer value, gpointer data) -{ - ETreePath path = keyp; - node_t *node = ((GNode *)value)->data; - ETreeTableAdapter *etta = (ETreeTableAdapter *) data; - - if (node->expanded != FALSE) { - e_tree_table_adapter_node_set_expanded_recurse (etta, path, FALSE); - node->expanded = FALSE; - } -} - +/* state: <0 ... collapse; 0 ... use default; >0 ... expand */ void -e_tree_table_adapter_load_all_expanded_state (ETreeTableAdapter *etta, gboolean state) +e_tree_table_adapter_force_expanded_state (ETreeTableAdapter *etta, int state) { + g_return_if_fail (etta != NULL); - g_return_if_fail(etta != NULL); - - if (state) - g_hash_table_foreach (etta->priv->nodes, set_expanded_state_func, etta); - else - g_hash_table_foreach (etta->priv->nodes, set_collapsed_state_func, etta); + etta->priv->force_expanded_state = state; } void |