aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-selection-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-13 05:52:49 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-13 05:52:49 +0800
commita5931319b6e19fdcbe18e077a2305cf41ccaea9e (patch)
tree7aa5a91b02815bf30928e52c2144cda58b26c06b /widgets/table/e-table-selection-model.c
parent0ad57aa1b9f67bf68920cf6a8bbaad773f105108 (diff)
downloadgsoc2013-evolution-a5931319b6e19fdcbe18e077a2305cf41ccaea9e.tar.gz
gsoc2013-evolution-a5931319b6e19fdcbe18e077a2305cf41ccaea9e.tar.zst
gsoc2013-evolution-a5931319b6e19fdcbe18e077a2305cf41ccaea9e.zip
Use new e_table_header_prioritized_column field.
2001-10-12 Christopher James Lahey <clahey@ximian.com> * e-table-click-to-add.c (set_initial_selection): Use new e_table_header_prioritized_column field. * e-table-header.c, e-table-header.h (e_table_header_prioritized_column): New function. Refactors the code from ETableClickToAdd to find the column with the highest priority. * e-table-selection-model.c, e-table-selection-model.h (model_changed_idle): Changed this function to use the e_table_header_prioritized_column function. Added an argument to set the "header" on this selection model. * e-table-utils.h: Indentation cleanup. * e-table.c (et_real_construct): Set the "header" argument on the selection model here. * e-table.h: #include <gal/e-table/e-table-sorter.h> svn path=/trunk/; revision=13633
Diffstat (limited to 'widgets/table/e-table-selection-model.c')
-rw-r--r--widgets/table/e-table-selection-model.c19
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,