diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-09-17 11:57:12 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-09-17 11:57:12 +0800 |
commit | a513a5f502e7d1d89e6294c3afa4ea20af50edb5 (patch) | |
tree | d82d69ae0f01701de7dcae336d6ae7aa0a6efd4d /widgets/table/e-table-subset.c | |
parent | e38cff691a83fafa33ebecb9fec28568a0a60c7f (diff) | |
download | gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar.gz gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar.bz2 gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar.lz gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar.xz gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar.zst gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.zip |
Bumped version number to 0.11.99.4.
2001-09-16 Christopher James Lahey <clahey@ximian.com>
* configure.in: Bumped version number to 0.11.99.4.
* gal/e-text/e-completion-view.c (e_completion_view_construct),
tests/test-table-1.c (create_table): Changed the parameters to
e_table_simple_new here to adjust to changes in the interface.
* gal/widgets/e-categories-master-list-array.c (ecmla_default):
Fixed a memory leak here.
* gal/widgets/e-categories.c (e_categories_get_save_id): Added
get_save_id here so that selection would be maintained across
changes.
From gal/e-table/ChangeLog:
2001-09-16 Christopher James Lahey <clahey@ximian.com>
* e-table-model.c, e-table-model.h (e_table_model_class_init):
Rearranged order of has_save_id and get_save_id to be more
consistent with ETree.
* e-table-selection-model.c, e-table-selection-model.h: Turned on
the code to maintain selection and cursor across changes if the
model supports get_save_id.
* e-table-simple.c, e-table-simple.h: Changed this interface to
take all of the ETableModel functions in the _new function.
* e-table-subset.c (etss_has_save_id, etss_get_save_id): Added
these to properly proxy the save_id functionality.
* e-tree-memory-callbacks.c, e-tree-memory-callbacks.h,
e-tree-model.c, e-tree-model.h, e-tree-sorted.c: Made the save_id
parameter to get_node_by_id be const char * instead of char *.
* e-tree-table-adapter.c (etta_class_init): Rearranged some
assignments here to be more consistent.
svn path=/trunk/; revision=12869
Diffstat (limited to 'widgets/table/e-table-subset.c')
-rw-r--r-- | widgets/table/e-table-subset.c | 133 |
1 files changed, 66 insertions, 67 deletions
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 95eb85433e..40a214b0eb 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -25,6 +25,44 @@ static ETableModelClass *etss_parent_class; #define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT(object)->klass)) +static gint +etss_get_view_row (ETableSubset *etss, int row) +{ + int limit; + const int n = etss->n_map; + const int * const map_table = etss->map_table; + int i; + + limit = MIN(n, etss->last_access + 10); + for (i = etss->last_access; i < limit; i++) { + if (map_table [i] == row){ + d(g_print("a) Found %d from %d\n", i, etss->last_access)); + etss->last_access = i; + return i; + } + } + + limit = MAX(0, etss->last_access - 10); + for (i = etss->last_access - 1; i >= limit; i--) { + if (map_table [i] == row){ + e_table_model_row_changed (E_TABLE_MODEL (etss), i); + d(g_print("b) Found %d from %d\n", i, etss->last_access)); + etss->last_access = i; + return i; + } + } + + for (i = 0; i < n; i++){ + if (map_table [i] == row){ + e_table_model_row_changed (E_TABLE_MODEL (etss), i); + d(g_print("c) Found %d from %d\n", i, etss->last_access)); + etss->last_access = i; + return i; + } + } + return -1; +} + static void etss_destroy (GtkObject *object) { @@ -103,6 +141,22 @@ etss_is_cell_editable (ETableModel *etm, int col, int row) return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]); } +static gboolean +etss_has_save_id (ETableModel *etm) +{ + ETableSubset *etss = (ETableSubset *)etm; + + return e_table_model_has_save_id (etss->source); +} + +static char * +etss_get_save_id (ETableModel *etm, int row) +{ + ETableSubset *etss = (ETableSubset *)etm; + + return e_table_model_get_save_id (etss->source, etss->map_table [row]); +} + static void etss_append_row (ETableModel *etm, ETableModel *source, int row) { @@ -162,10 +216,15 @@ etss_class_init (GtkObjectClass *object_class) table_class->column_count = etss_column_count; table_class->row_count = etss_row_count; + table_class->append_row = etss_append_row; + table_class->value_at = etss_value_at; table_class->set_value_at = etss_set_value_at; table_class->is_cell_editable = etss_is_cell_editable; - table_class->append_row = etss_append_row; + + table_class->has_save_id = etss_has_save_id; + table_class->get_save_id = etss_get_save_id; + table_class->duplicate_value = etss_duplicate_value; table_class->free_value = etss_free_value; table_class->initialize_value = etss_initialize_value; @@ -203,77 +262,17 @@ etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm) static void etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, int row) { - int limit; - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; - - limit = MIN(n, etss->last_access + 10); - for (i = etss->last_access; i < limit; i++) { - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - d(g_print("a) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - limit = MAX(0, etss->last_access - 10); - for (i = etss->last_access - 1; i >= limit; i--) { - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - d(g_print("b) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - d(g_print("c) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } + int view_row = etss_get_view_row (etss, row); + if (view_row != -1) + e_table_model_row_changed (E_TABLE_MODEL (etss), view_row); } static void etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, int col, int row) { - int limit; - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; - - limit = MIN(n, etss->last_access + 10); - for (i = etss->last_access; i < limit; i++) { - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - d(g_print("d) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - limit = MAX(0, etss->last_access - 10); - for (i = etss->last_access - 1; i >= limit; i--) { - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - d(g_print("e) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } - - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - d(g_print("f) Found %d from %d\n", i, etss->last_access)); - etss->last_access = i; - return; - } - } + int view_row = etss_get_view_row (etss, row); + if (view_row != -1) + e_table_model_cell_changed (E_TABLE_MODEL (etss), col, view_row); } static void |