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 | |
parent | e38cff691a83fafa33ebecb9fec28568a0a60c7f (diff) | |
download | gsoc2013-evolution-a513a5f502e7d1d89e6294c3afa4ea20af50edb5.tar.gz 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')
-rw-r--r-- | widgets/table/e-table-model.c | 28 | ||||
-rw-r--r-- | widgets/table/e-table-model.h | 4 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.c | 33 | ||||
-rw-r--r-- | widgets/table/e-table-selection-model.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-simple.c | 166 | ||||
-rw-r--r-- | widgets/table/e-table-simple.h | 34 | ||||
-rw-r--r-- | widgets/table/e-table-subset.c | 133 | ||||
-rw-r--r-- | widgets/table/e-tree-memory-callbacks.c | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-memory-callbacks.h | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-model.c | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-model.h | 4 | ||||
-rw-r--r-- | widgets/table/e-tree-sorted.c | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 11 | ||||
-rw-r--r-- | widgets/text/e-completion-view.c | 5 |
14 files changed, 220 insertions, 208 deletions
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index 9429aeb0f9..9a0b3561dd 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -171,20 +171,8 @@ e_table_model_free_value (ETableModel *e_table_model, int col, void *value) ETM_CLASS (e_table_model)->free_value (e_table_model, col, value); } -char * -e_table_model_get_save_id(ETableModel *e_table_model, int row) -{ - g_return_val_if_fail (e_table_model != NULL, "/"); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), "/"); - - if (ETM_CLASS (e_table_model)->get_save_id) - return ETM_CLASS (e_table_model)->get_save_id (e_table_model, row); - else - return NULL; -} - gboolean -e_table_model_has_save_id(ETableModel *e_table_model) +e_table_model_has_save_id (ETableModel *e_table_model) { g_return_val_if_fail (e_table_model != NULL, FALSE); g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); @@ -195,6 +183,18 @@ e_table_model_has_save_id(ETableModel *e_table_model) return FALSE; } +char * +e_table_model_get_save_id (ETableModel *e_table_model, int row) +{ + g_return_val_if_fail (e_table_model != NULL, "/"); + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), "/"); + + if (ETM_CLASS (e_table_model)->get_save_id) + return ETM_CLASS (e_table_model)->get_save_id (e_table_model, row); + else + return NULL; +} + gboolean e_table_model_has_change_pending(ETableModel *e_table_model) { @@ -316,8 +316,8 @@ e_table_model_class_init (GtkObjectClass *object_class) klass->set_value_at = NULL; klass->is_cell_editable = NULL; - klass->get_save_id = NULL; klass->has_save_id = NULL; + klass->get_save_id = NULL; klass->has_change_pending = NULL; diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h index 333ab0fcfc..5a47f3850b 100644 --- a/widgets/table/e-table-model.h +++ b/widgets/table/e-table-model.h @@ -32,8 +32,8 @@ typedef struct { void (*set_value_at) (ETableModel *etm, int col, int row, const void *value); gboolean (*is_cell_editable) (ETableModel *etm, int col, int row); - char *(*get_save_id) (ETableModel *etm, int row); gboolean (*has_save_id) (ETableModel *etm); + char *(*get_save_id) (ETableModel *etm, int row); gboolean (*has_change_pending) (ETableModel *etm); @@ -94,9 +94,9 @@ gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int row); /**/ +gboolean e_table_model_has_save_id (ETableModel *etm); char *e_table_model_get_save_id (ETableModel *etm, int row); -gboolean e_table_model_has_save_id (ETableModel *etm); /**/ gboolean e_table_model_has_change_pending (ETableModel *etm); diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index d8d806afb8..dfeaac532c 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -26,7 +26,6 @@ enum { ARG_MODEL, }; -#if 0 static void save_to_hash(int model_row, gpointer closure) { @@ -35,7 +34,6 @@ save_to_hash(int model_row, gpointer closure) g_hash_table_insert(etsm->hash, key, key); } -#endif static void free_key(gpointer key, gpointer value, gpointer closure) @@ -60,22 +58,23 @@ model_pre_change (ETableModel *etm, ETableSelectionModel *etsm) { free_hash(etsm); -#if 0 - if (etsm->model && (!etsm->hash) && e_table_model_has_save_id(etsm->model)) { + if (etsm->model && e_table_model_has_save_id (etsm->model)) { gint cursor_row; + etsm->hash = g_hash_table_new(g_str_hash, g_str_equal); e_selection_model_foreach(E_SELECTION_MODEL(etsm), save_to_hash, 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) { etsm->cursor_id = e_table_model_get_save_id(etm, cursor_row); } } -#endif } -#if 0 static gint model_changed_idle(ETableSelectionModel *etsm) { @@ -83,7 +82,7 @@ model_changed_idle(ETableSelectionModel *etsm) e_selection_model_clear(E_SELECTION_MODEL(etsm)); - if (etsm->hash && etm && e_table_model_has_save_id(etm)) { + if (etsm->cursor_id && etm && e_table_model_has_save_id(etm)) { int row_count = e_table_model_row_count(etm); int i; e_selection_model_array_confirm_row_count(E_SELECTION_MODEL_ARRAY(etsm)); @@ -91,8 +90,9 @@ model_changed_idle(ETableSelectionModel *etsm) char *save_id = e_table_model_get_save_id(etm, i); if (g_hash_table_lookup(etsm->hash, save_id)) 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_row(E_SELECTION_MODEL(etsm))); + e_selection_model_change_cursor(E_SELECTION_MODEL(etsm), i, e_selection_model_cursor_col(E_SELECTION_MODEL(etsm))); g_free(etsm->cursor_id); etsm->cursor_id = NULL; } @@ -103,31 +103,26 @@ model_changed_idle(ETableSelectionModel *etsm) etsm->model_changed_idle_id = 0; return FALSE; } -#endif static void model_changed(ETableModel *etm, ETableSelectionModel *etsm) { e_selection_model_clear(E_SELECTION_MODEL(etsm)); -#if 0 if (!etsm->model_changed_idle_id && etm && e_table_model_has_save_id(etm)) { etsm->model_changed_idle_id = g_idle_add_full(G_PRIORITY_HIGH, (GSourceFunc) model_changed_idle, etsm, NULL); } -#endif } static void model_row_changed(ETableModel *etm, int row, ETableSelectionModel *etsm) { - if (etsm->hash) - free_hash(etsm); + free_hash(etsm); } static void model_cell_changed(ETableModel *etm, int col, int row, ETableSelectionModel *etsm) { - if (etsm->hash) - free_hash(etsm); + free_hash(etsm); } #if 1 @@ -135,16 +130,14 @@ static void model_rows_inserted(ETableModel *etm, int row, int count, ETableSelectionModel *etsm) { e_selection_model_array_insert_rows(E_SELECTION_MODEL_ARRAY(etsm), row, count); - if (etsm->hash) - free_hash(etsm); + free_hash(etsm); } static void model_rows_deleted(ETableModel *etm, int row, int count, ETableSelectionModel *etsm) { e_selection_model_array_delete_rows(E_SELECTION_MODEL_ARRAY(etsm), row, count); - if (etsm->hash) - free_hash(etsm); + free_hash(etsm); } #else @@ -251,7 +244,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; diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h index 94eaf2bb94..74857efd61 100644 --- a/widgets/table/e-table-selection-model.h +++ b/widgets/table/e-table-selection-model.h @@ -37,7 +37,7 @@ typedef struct { guint group_info_changed : 1; GHashTable *hash; - gchar *cursor_id; + char *cursor_id; } ETableSelectionModel; typedef struct { diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c index 82d29bd6c7..62ea102b7b 100644 --- a/widgets/table/e-table-simple.c +++ b/widgets/table/e-table-simple.c @@ -13,11 +13,6 @@ #include <config.h> #include "e-table-simple.h" -enum { - ARG_0, - ARG_APPEND_ROW, -}; - #define PARENT_TYPE e_table_model_get_type () static int @@ -42,6 +37,15 @@ simple_row_count (ETableModel *etm) return 0; } +static void +simple_append_row (ETableModel *etm, ETableModel *source, int row) +{ + ETableSimple *simple = E_TABLE_SIMPLE(etm); + + if (simple->append_row) + simple->append_row (etm, source, row, simple->data); +} + static void * simple_value_at (ETableModel *etm, int col, int row) { @@ -73,6 +77,28 @@ simple_is_cell_editable (ETableModel *etm, int col, int row) return FALSE; } +static gboolean +simple_has_save_id (ETableModel *etm) +{ + ETableSimple *simple = E_TABLE_SIMPLE(etm); + + if (simple->has_save_id) + return simple->has_save_id (etm, simple->data); + else + return FALSE; +} + +static char * +simple_get_save_id (ETableModel *etm, int row) +{ + ETableSimple *simple = E_TABLE_SIMPLE(etm); + + if (simple->get_save_id) + return simple->get_save_id (etm, row, simple->data); + else + return NULL; +} + /* The default for simple_duplicate_value is to return the raw value. */ static void * simple_duplicate_value (ETableModel *etm, int col, const void *value) @@ -128,62 +154,26 @@ simple_value_to_string (ETableModel *etm, int col, const void *value) } static void -simple_append_row (ETableModel *etm, ETableModel *source, int row) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - if (simple->append_row) - simple->append_row (etm, source, row, simple->data); -} - -static void -simple_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) +e_table_simple_class_init (GtkObjectClass *object_class) { - ETableSimple *simple = E_TABLE_SIMPLE (o); + ETableModelClass *model_class = (ETableModelClass *) object_class; - switch (arg_id){ - case ARG_APPEND_ROW: - GTK_VALUE_POINTER(*arg) = simple->append_row; - break; - } -} + model_class->column_count = simple_column_count; + model_class->row_count = simple_row_count; + model_class->append_row = simple_append_row; -static void -simple_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ETableSimple *simple = E_TABLE_SIMPLE (o); - - switch (arg_id){ - case ARG_APPEND_ROW: - simple->append_row = GTK_VALUE_POINTER(*arg); - break; - default: - arg->type = GTK_TYPE_INVALID; - } -} + model_class->value_at = simple_value_at; + model_class->set_value_at = simple_set_value_at; + model_class->is_cell_editable = simple_is_cell_editable; -static void -e_table_simple_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; + model_class->has_save_id = simple_has_save_id; + model_class->get_save_id = simple_get_save_id; - object_class->set_arg = simple_set_arg; - object_class->get_arg = simple_get_arg; - - model_class->column_count = simple_column_count; - model_class->row_count = simple_row_count; - model_class->value_at = simple_value_at; - model_class->set_value_at = simple_set_value_at; - model_class->is_cell_editable = simple_is_cell_editable; - model_class->duplicate_value = simple_duplicate_value; - model_class->free_value = simple_free_value; - model_class->initialize_value = simple_initialize_value; - model_class->value_is_empty = simple_value_is_empty; - model_class->value_to_string = simple_value_to_string; - model_class->append_row = simple_append_row; - - gtk_object_add_arg_type ("ETableSimple::append_row", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_APPEND_ROW); + model_class->duplicate_value = simple_duplicate_value; + model_class->free_value = simple_free_value; + model_class->initialize_value = simple_initialize_value; + model_class->value_is_empty = simple_value_is_empty; + model_class->value_to_string = simple_value_to_string; } GtkType @@ -237,33 +227,45 @@ e_table_simple_get_type (void) * object). */ ETableModel * -e_table_simple_new (ETableSimpleColumnCountFn col_count, - ETableSimpleRowCountFn row_count, - ETableSimpleValueAtFn value_at, - ETableSimpleSetValueAtFn set_value_at, - ETableSimpleIsCellEditableFn is_cell_editable, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleInitializeValueFn initialize_value, - ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleValueToStringFn value_to_string, - void *data) +e_table_simple_new (ETableSimpleColumnCountFn col_count, + ETableSimpleRowCountFn row_count, + ETableSimpleAppendRowFn append_row, + + ETableSimpleValueAtFn value_at, + ETableSimpleSetValueAtFn set_value_at, + ETableSimpleIsCellEditableFn is_cell_editable, + + ETableSimpleHasSaveIdFn has_save_id, + ETableSimpleGetSaveIdFn get_save_id, + + ETableSimpleDuplicateValueFn duplicate_value, + ETableSimpleFreeValueFn free_value, + ETableSimpleInitializeValueFn initialize_value, + ETableSimpleValueIsEmptyFn value_is_empty, + ETableSimpleValueToStringFn value_to_string, + void *data) { ETableSimple *et; - et = gtk_type_new (e_table_simple_get_type ()); - - et->col_count = col_count; - et->row_count = row_count; - et->value_at = value_at; - et->set_value_at = set_value_at; - et->is_cell_editable = is_cell_editable; - et->duplicate_value = duplicate_value; - et->free_value = free_value; - et->initialize_value = initialize_value; - et->value_is_empty = value_is_empty; - et->value_to_string = value_to_string; - et->data = data; - + et = gtk_type_new (e_table_simple_get_type ()); + + et->col_count = col_count; + et->row_count = row_count; + et->append_row = append_row; + + et->value_at = value_at; + et->set_value_at = set_value_at; + et->is_cell_editable = is_cell_editable; + + et->has_save_id = has_save_id; + et->get_save_id = get_save_id; + + et->duplicate_value = duplicate_value; + et->free_value = free_value; + et->initialize_value = initialize_value; + et->value_is_empty = value_is_empty; + et->value_to_string = value_to_string; + et->data = data; + return (ETableModel *) et; - } +} diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h index f0f949afc0..28e46bea53 100644 --- a/widgets/table/e-table-simple.h +++ b/widgets/table/e-table-simple.h @@ -22,6 +22,9 @@ typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data); typedef gboolean (*ETableSimpleIsCellEditableFn) (ETableModel *etm, int col, int row, void *data); +typedef gboolean (*ETableSimpleHasSaveIdFn) (ETableModel *etm, void *data); +typedef char *(*ETableSimpleGetSaveIdFn) (ETableModel *etm, int row, void *data); + typedef void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data); typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data); typedef void *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data); @@ -39,6 +42,9 @@ typedef struct { ETableSimpleSetValueAtFn set_value_at; ETableSimpleIsCellEditableFn is_cell_editable; + ETableSimpleHasSaveIdFn has_save_id; + ETableSimpleGetSaveIdFn get_save_id; + ETableSimpleDuplicateValueFn duplicate_value; ETableSimpleFreeValueFn free_value; ETableSimpleInitializeValueFn initialize_value; @@ -51,21 +57,25 @@ typedef struct { ETableModelClass parent_class; } ETableSimpleClass; -GtkType e_table_simple_get_type (void); +GtkType e_table_simple_get_type (void); + +ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count, + ETableSimpleRowCountFn row_count, + ETableSimpleAppendRowFn append_row, -ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count, - ETableSimpleRowCountFn row_count, + ETableSimpleValueAtFn value_at, + ETableSimpleSetValueAtFn set_value_at, + ETableSimpleIsCellEditableFn is_cell_editable, - ETableSimpleValueAtFn value_at, - ETableSimpleSetValueAtFn set_value_at, - ETableSimpleIsCellEditableFn is_cell_editable, + ETableSimpleHasSaveIdFn has_save_id, + ETableSimpleGetSaveIdFn get_save_id, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleInitializeValueFn initialize_value, - ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleValueToStringFn value_to_string, - void *data); + ETableSimpleDuplicateValueFn duplicate_value, + ETableSimpleFreeValueFn free_value, + ETableSimpleInitializeValueFn initialize_value, + ETableSimpleValueIsEmptyFn value_is_empty, + ETableSimpleValueToStringFn value_to_string, + void *data); #ifdef __cplusplus } 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 diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c index adb5160bc2..c589894d28 100644 --- a/widgets/table/e-tree-memory-callbacks.c +++ b/widgets/table/e-tree-memory-callbacks.c @@ -69,7 +69,7 @@ etmc_has_get_node_by_id (ETreeModel *etm) } static ETreePath -etmc_get_node_by_id (ETreeModel *etm, gchar *save_id) +etmc_get_node_by_id (ETreeModel *etm, const char *save_id) { ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm); diff --git a/widgets/table/e-tree-memory-callbacks.h b/widgets/table/e-tree-memory-callbacks.h index 441c5be9f4..c25f821908 100644 --- a/widgets/table/e-tree-memory-callbacks.h +++ b/widgets/table/e-tree-memory-callbacks.h @@ -24,7 +24,7 @@ typedef gboolean (*ETreeMemoryCallbacksHasSaveIdFn) (ETreeModel *etre typedef gchar *(*ETreeMemoryCallbacksGetSaveIdFn) (ETreeModel *etree, ETreePath path, void *model_data); typedef gboolean (*ETreeMemoryCallbacksHasGetNodeByIdFn) (ETreeModel *etree, void *model_data); -typedef ETreePath (*ETreeMemoryCallbacksGetNodeByIdFn) (ETreeModel *etree, gchar *save_id, void *model_data); +typedef ETreePath (*ETreeMemoryCallbacksGetNodeByIdFn) (ETreeModel *etree, const char *save_id, void *model_data); typedef void* (*ETreeMemoryCallbacksValueAtFn) (ETreeModel *etree, ETreePath path, int col, void *model_data); typedef void (*ETreeMemoryCallbacksSetValueAtFn) (ETreeModel *etree, ETreePath path, int col, const void *val, void *model_data); diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index 90ed489a74..f304d1e0cf 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -620,7 +620,7 @@ e_tree_model_has_get_node_by_id (ETreeModel *etree) * return values: The path for this save id. */ ETreePath -e_tree_model_get_node_by_id (ETreeModel *etree, gchar *save_id) +e_tree_model_get_node_by_id (ETreeModel *etree, const char *save_id) { g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h index 1b48e23963..a9b31cb23a 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -54,7 +54,7 @@ struct ETreeModelClass { gchar *(*get_save_id) (ETreeModel *etm, ETreePath node); gboolean (*has_get_node_by_id) (ETreeModel *etm); - ETreePath (*get_node_by_id) (ETreeModel *etm, gchar *save_id); + ETreePath (*get_node_by_id) (ETreeModel *etm, const char *save_id); gboolean (*has_change_pending) (ETreeModel *etm); @@ -119,7 +119,7 @@ gchar *e_tree_model_get_save_id (ETreeModel *model, gboolean e_tree_model_has_get_node_by_id (ETreeModel *model); ETreePath e_tree_model_get_node_by_id (ETreeModel *model, - gchar *save_id); + const char *save_id); gboolean e_tree_model_has_change_pending (ETreeModel *model); diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 1e635865ae..add0b2ca2d 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -847,7 +847,7 @@ ets_has_get_node_by_id (ETreeModel *etm) } static ETreePath -ets_get_node_by_id (ETreeModel *etm, gchar *save_id) +ets_get_node_by_id (ETreeModel *etm, const char *save_id) { ETreeSorted *ets = E_TREE_SORTED(etm); ETreePath node; diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 4ee3c6f704..384e21da21 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -553,14 +553,17 @@ etta_class_init (ETreeTableAdapterClass *klass) object_class->destroy = etta_destroy; table_class->column_count = etta_column_count; - table_class->has_save_id = etta_has_save_id; - table_class->get_save_id = etta_get_save_id; - table_class->has_change_pending = etta_has_change_pending; table_class->row_count = etta_row_count; + table_class->append_row = etta_append_row; + table_class->value_at = etta_value_at; table_class->set_value_at = etta_set_value_at; table_class->is_cell_editable = etta_is_cell_editable; - table_class->append_row = etta_append_row; + + table_class->has_save_id = etta_has_save_id; + table_class->get_save_id = etta_get_save_id; + + table_class->has_change_pending = etta_has_change_pending; table_class->duplicate_value = etta_duplicate_value; table_class->free_value = etta_free_value; table_class->initialize_value = etta_initialize_value; diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c index 7ef019130c..400494623e 100644 --- a/widgets/text/e-completion-view.c +++ b/widgets/text/e-completion-view.c @@ -732,9 +732,14 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion) cv->model = e_table_simple_new (table_col_count, table_row_count, + NULL, + table_value_at, NULL, table_is_cell_editable, + + NULL, NULL, + NULL, NULL, NULL, NULL, table_value_to_string, cv); |