diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-20 02:14:43 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-20 02:15:25 +0800 |
commit | 452638466217dbfef0c0954c90aa7cb03cf91452 (patch) | |
tree | f989c0219b18498a57cf842259e309893de49786 /e-util | |
parent | c52e39357825f788e973b7fb1ac4b082d30b9b29 (diff) | |
download | gsoc2013-evolution-452638466217dbfef0c0954c90aa7cb03cf91452.tar.gz gsoc2013-evolution-452638466217dbfef0c0954c90aa7cb03cf91452.tar.zst gsoc2013-evolution-452638466217dbfef0c0954c90aa7cb03cf91452.zip |
Bug 702006 - Select All does not select collapsed threads
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-tree-selection-model.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/e-util/e-tree-selection-model.c b/e-util/e-tree-selection-model.c index 3b2fd8fd45..b78863045d 100644 --- a/e-util/e-tree-selection-model.c +++ b/e-util/e-tree-selection-model.c @@ -384,8 +384,7 @@ tree_selection_model_is_row_selected (ESelectionModel *selection, ETreePath path; g_return_val_if_fail ( - row < e_table_model_row_count ( - E_TABLE_MODEL (etsm->priv->etta)), FALSE); + row < e_selection_model_row_count (selection), FALSE); g_return_val_if_fail (row >= 0, FALSE); g_return_val_if_fail (etsm != NULL, FALSE); @@ -439,12 +438,25 @@ tree_selection_model_selected_count (ESelectionModel *selection) return g_hash_table_size (etsm->priv->paths); } +/* Helper for tree_selection_model_select_all() */ +static gboolean +tree_selection_model_traverse_cb (ETreeModel *tree_model, + ETreePath path, + gpointer user_data) +{ + ETreeSelectionModel *etsm; + + etsm = E_TREE_SELECTION_MODEL (user_data); + g_hash_table_add (etsm->priv->paths, path); + + return FALSE; +} + static void tree_selection_model_select_all (ESelectionModel *selection) { ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection); ETreePath root; - gint count; root = e_tree_model_get_root (etsm->priv->model); if (root == NULL) @@ -452,8 +464,14 @@ tree_selection_model_select_all (ESelectionModel *selection) clear_selection (etsm); - count = e_selection_model_row_count (selection); - select_range (etsm, 0, count - 1); + /* We want to select ALL rows regardless of expanded state. + * ETreeTableAdapter pretends that collapsed rows don't exist, + * so instead we need to iterate over the ETreeModel directly. */ + + e_tree_model_node_traverse ( + etsm->priv->model, root, + tree_selection_model_traverse_cb, + selection); if (etsm->priv->cursor_path == NULL) etsm->priv->cursor_path = e_tree_table_adapter_node_at_row ( @@ -500,7 +518,12 @@ tree_selection_model_row_count (ESelectionModel *selection) { ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection); - return e_table_model_row_count (E_TABLE_MODEL (etsm->priv->etta)); + /* We want to return the true row count, including collapsed rows. + * ETreeTableAdapter pretends that collapsed rows don't exist and + * will return a false count (for our purpose), so instead we ask + * the ETreeModel directly. */ + + return e_tree_model_node_get_n_nodes (etsm->priv->model); } static void |