diff options
author | Not Zed <NotZed@Ximian.com> | 2005-06-20 18:29:14 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-06-20 18:29:14 +0800 |
commit | 510b2562813a16cf7795fcf0351e0f1aba9246d4 (patch) | |
tree | 978bc5a113fa4a8fe00a661f84d37e6ebcbaf44c | |
parent | 56b1fe3fe1f07f85cedeb0efa9d622174dc25056 (diff) | |
download | gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.tar gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.tar.gz gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.tar.bz2 gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.tar.lz gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.tar.xz gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.tar.zst gsoc2013-evolution-510b2562813a16cf7795fcf0351e0f1aba9246d4.zip |
If only a few rows have changed, emit each as a separate row_changed event
2005-06-08 Not Zed <NotZed@Ximian.com>
* e-tree-selection-model.c (etsm_toggle_single_row)
(etsm_select_single_row): If only a few rows have changed, emit
each as a separate row_changed event rather than triggering a
complete redraw of the whole window.
svn path=/trunk/; revision=29551
-rw-r--r-- | widgets/table/e-tree-selection-model.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 5ecabb796a..1a9cac548a 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -573,16 +573,44 @@ etsm_cursor_col (ESelectionModel *selection) } static void +etsm_get_rows(int row, void *d) +{ + int **rowp = d; + + **rowp = row; + (*rowp)++; +} + +static void etsm_select_single_row (ESelectionModel *selection, gint row) { ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection); ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); + int rows[5], *rowp = NULL, size; g_return_if_fail (path != NULL); + /* we really only care about the size=1 case (cursor changed), + but this doesn't cost much */ + size = g_hash_table_size(etsm->priv->paths); + if (size > 0 && size <= 5) { + rowp = rows; + etsm_foreach(selection, etsm_get_rows, &rowp); + } + select_single_path (etsm, path); - e_selection_model_selection_changed(E_SELECTION_MODEL(etsm)); + if (size>5) { + e_selection_model_selection_changed(E_SELECTION_MODEL(etsm)); + } else { + if (rowp) { + int *p = rows; + + while (p<rowp) + e_selection_model_selection_row_changed((ESelectionModel *)etsm, *p++); + } + e_selection_model_selection_row_changed((ESelectionModel *)etsm, row); + } } static void @@ -599,7 +627,8 @@ etsm_toggle_single_row (ESelectionModel *selection, gint row) g_hash_table_insert (etsm->priv->paths, path, path); etsm->priv->start_path = NULL; - e_selection_model_selection_changed(E_SELECTION_MODEL(etsm)); + + e_selection_model_selection_row_changed((ESelectionModel *)etsm, row); } static void |