diff options
Diffstat (limited to 'widgets/table/e-table-selection-model.c')
-rw-r--r-- | widgets/table/e-table-selection-model.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 72ee3bacce..552b1557c6 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -8,10 +8,12 @@ * (C) 2000, 2001 Ximian, Inc. */ #include <config.h> +#include "e-table-selection-model.h" + #include <string.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include "e-table-selection-model.h" + #include "gal/util/e-util.h" #define ETSM_CLASS(e) ((ETableSelectionModelClass *)((GtkObject *)e)->klass) @@ -25,6 +27,7 @@ static gint etsm_get_row_count (ESelectionModelArray *esm); enum { ARG_0, ARG_MODEL, + ARG_HEADER, }; static void @@ -97,6 +100,12 @@ model_changed_idle(ETableSelectionModel *etsm) if (etsm->cursor_id && !strcmp(etsm->cursor_id, save_id)) { cursor_row = i; cursor_col = e_selection_model_cursor_col(E_SELECTION_MODEL(etsm)); + if (cursor_col == -1) { + if (etsm->eth) { + cursor_col = e_table_header_prioritized_column (etsm->eth); + } else + cursor_col = 0; + } e_selection_model_change_cursor(E_SELECTION_MODEL(etsm), cursor_row, cursor_col); g_free(etsm->cursor_id); etsm->cursor_id = NULL; @@ -232,6 +241,9 @@ etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) case ARG_MODEL: GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etsm->model); break; + case ARG_HEADER: + GTK_VALUE_OBJECT (*arg) = (GtkObject *)etsm->eth; + break; } } @@ -245,6 +257,9 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) drop_model(etsm); add_model(etsm, GTK_VALUE_OBJECT (*arg) ? E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)) : NULL); break; + case ARG_HEADER: + etsm->eth = (ETableHeader *)GTK_VALUE_OBJECT (*arg); + break; } } @@ -277,6 +292,8 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass) gtk_object_add_arg_type ("ETableSelectionModel::model", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL); + gtk_object_add_arg_type ("ETableSelectionModel::header", E_TABLE_HEADER_TYPE, + GTK_ARG_READWRITE, ARG_HEADER); } E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionModel, |