From c228df2b30468e49051f64ca78476871946e403d Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 3 Oct 2001 15:03:05 +0000 Subject: Initialize the hash field. (model_changed_idle): Send cursor changed and 2001-10-03 Christopher James Lahey * e-table-selection-model.c (e_table_selection_model_init): Initialize the hash field. (model_changed_idle): Send cursor changed and selection changed signals. (model_pre_change): If there's no cursor here, make sure to set the cursor_id to NULL. svn path=/trunk/; revision=13373 --- widgets/table/e-table-selection-model.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'widgets') diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 56fa07213a..716667a197 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -67,11 +67,11 @@ model_pre_change (ETableModel *etm, ETableSelectionModel *etsm) gtk_object_get(GTK_OBJECT(etsm), "cursor_row", &cursor_row, NULL); - if (etsm->cursor_id) - g_free (etsm->cursor_id); - if (cursor_row != -1) { + g_free (etsm->cursor_id); + if (cursor_row != -1) etsm->cursor_id = e_table_model_get_save_id(etm, cursor_row); - } + else + etsm->cursor_id = NULL; } } @@ -84,6 +84,8 @@ model_changed_idle(ETableSelectionModel *etsm) if (etsm->cursor_id && etm && e_table_model_has_save_id(etm)) { int row_count = e_table_model_row_count(etm); + int cursor_row = -1; + int cursor_col = -1; int i; e_selection_model_array_confirm_row_count(E_SELECTION_MODEL_ARRAY(etsm)); for (i = 0; i < row_count; i++) { @@ -92,13 +94,17 @@ model_changed_idle(ETableSelectionModel *etsm) e_selection_model_change_one_row(E_SELECTION_MODEL(etsm), i, TRUE); if (etsm->cursor_id && !strcmp(etsm->cursor_id, save_id)) { - e_selection_model_change_cursor(E_SELECTION_MODEL(etsm), i, e_selection_model_cursor_col(E_SELECTION_MODEL(etsm))); + cursor_row = i; + cursor_col = e_selection_model_cursor_col(E_SELECTION_MODEL(etsm)); + e_selection_model_change_cursor(E_SELECTION_MODEL(etsm), cursor_row, cursor_col); g_free(etsm->cursor_id); etsm->cursor_id = NULL; } g_free(save_id); } free_hash(etsm); + e_selection_model_cursor_changed (E_SELECTION_MODEL(etsm), cursor_row, cursor_col); + e_selection_model_selection_changed (E_SELECTION_MODEL(etsm)); } etsm->model_changed_idle_id = 0; return FALSE; @@ -245,7 +251,7 @@ static void e_table_selection_model_init (ETableSelectionModel *selection) { selection->model = NULL; - /* selection->hash = NULL;*/ + selection->hash = NULL; selection->cursor_id = NULL; selection->model_changed_idle_id = 0; -- cgit v1.2.3