aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-selection-model.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-10-05 05:40:08 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-10-05 05:40:08 +0800
commit60b04c2ac577a4139bd388f38c6c335bf262de61 (patch)
treec51a1c6e8d7483de28eedc6ac26a95c78ae8c0a7 /widgets/table/e-table-selection-model.c
parent801c54738fe337b299c092794218274f4c2eff75 (diff)
downloadgsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.tar
gsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.tar.gz
gsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.tar.bz2
gsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.tar.lz
gsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.tar.xz
gsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.tar.zst
gsoc2013-evolution-60b04c2ac577a4139bd388f38c6c335bf262de61.zip
Select all elements of the etable.
2000-10-04 Jeffrey Stedfast <fejj@helixcode.com> * e-table-selection-model.c (e_table_selection_model_select_all): Select all elements of the etable. (e_table_selection_model_invert_selection): Invert the current selection. * e-table.c (e_table_select_all): New convenience function to select all elements in an e-table. (e_table_invert_selection): New convenience function to invert the current selection in an e-table. svn path=/trunk/; revision=5719
Diffstat (limited to 'widgets/table/e-table-selection-model.c')
-rw-r--r--widgets/table/e-table-selection-model.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index 024ef2abc1..552d632fc9 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -501,3 +501,45 @@ e_table_selection_model_selected_count (ETableSelectionModel *selection)
return count;
}
+
+void
+e_table_selection_model_select_all (ETableSelectionModel *selection)
+{
+ int i;
+
+ if (selection->row_count < 0) {
+ if (selection->model) {
+ selection->row_count = e_table_model_row_count (selection->model);
+ g_free (selection->selection);
+ selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
+ }
+ }
+
+ if (!selection->selection)
+ selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
+
+ for (i = 0; i < (selection->row_count + 31) / 32; i ++) {
+ selection->selection[i] = ONES;
+ }
+}
+
+void
+e_table_selection_model_invert_selection (ETableSelectionModel *selection)
+{
+ int i;
+
+ if (selection->row_count < 0) {
+ if (selection->model) {
+ selection->row_count = e_table_model_row_count (selection->model);
+ g_free (selection->selection);
+ selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
+ }
+ }
+
+ if (!selection->selection)
+ selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
+
+ for (i = 0; i < (selection->row_count + 31) / 32; i ++) {
+ selection->selection[i] = ~selection->selection[i];
+ }
+}