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 | |
parent | c29e1c65703bc651f786130024da2efcedcf607d (diff) | |
download | gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar.gz gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar.bz2 gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar.lz gsoc2013-evolution-28a98b7973e5fd9341fbc7faa6f49b7d0b8d4de9.tar.xz 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')
-rw-r--r-- | widgets/table/ChangeLog | 20 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 42 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.h | 4 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 7 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 2 |
5 files changed, 36 insertions, 39 deletions
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index 47bba15e2a..24889709e8 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,5 +1,25 @@ 2008-08-11 Milan Crha <mcrha@redhat.com> + ** Part of fix for bug #519292 + + * e-tree.h: (e_tree_load_all_expanded_state): + * e-tree.c: (e_tree_load_all_expanded_state): + * e-tree-table-adapter.h: + (e_tree_table_adapter_load_all_expanded_state): + * e-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. + * e-tree.h: (e_tree_force_expanded_state): + * e-tree.c: (e_tree_force_expanded_state): + * e-tree-table-adapter.h: (e_tree_table_adapter_force_expanded_state): + * e-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. + +2008-08-11 Milan Crha <mcrha@redhat.com> + ** Part of fix for bug #352695 * e-tree-table-adapter.h: 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 diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h index e7fed9c2a7..4d792f7451 100644 --- a/widgets/table/e-tree-table-adapter.h +++ b/widgets/table/e-tree-table-adapter.h @@ -72,8 +72,8 @@ void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta, ETreePath path, gboolean expanded); -void e_tree_table_adapter_load_all_expanded_state (ETreeTableAdapter *etta, - gboolean state); +void e_tree_table_adapter_force_expanded_state (ETreeTableAdapter *etta, + int state); void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta, gboolean visible); ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta, diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 64f0bde2d1..6d375cdfc1 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -2088,10 +2088,13 @@ e_tree_load_expanded_state_xml (ETree *et, xmlDoc *doc) e_tree_table_adapter_load_expanded_state_xml (et->priv->etta, doc); } +/* state: <0 ... collapse; 0 ... no force - use default; >0 ... expand; + when using this, be sure to reset to 0 once no forcing is required + anymore, aka the build of the tree is done */ void -e_tree_load_all_expanded_state (ETree *et, gboolean state) +e_tree_force_expanded_state (ETree *et, int state) { - e_tree_table_adapter_load_all_expanded_state (et->priv->etta, state); + e_tree_table_adapter_force_expanded_state (et->priv->etta, state); } gint diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index 30bb0fdb40..3093855e4b 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -292,7 +292,7 @@ void e_tree_load_expanded_state_xml (ETree *et, xml int e_tree_row_count (ETree *et); GtkWidget *e_tree_get_tooltip (ETree *et); -void e_tree_load_all_expanded_state (ETree *et, gboolean state); +void e_tree_force_expanded_state (ETree *et, int state); typedef enum { E_TREE_FIND_NEXT_BACKWARD = 0, |