From 510b2562813a16cf7795fcf0351e0f1aba9246d4 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 20 Jun 2005 10:29:14 +0000 Subject: If only a few rows have changed, emit each as a separate row_changed event 2005-06-08 Not Zed * 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 --- widgets/table/e-tree-selection-model.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'widgets') 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 @@ -572,17 +572,45 @@ etsm_cursor_col (ESelectionModel *selection) return etsm->priv->cursor_col; } +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 (ppriv->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 -- cgit v1.2.3