diff options
Diffstat (limited to 'widgets/table/e-table-selection-model.c')
-rw-r--r-- | widgets/table/e-table-selection-model.c | 42 |
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]; + } +} |