diff options
Diffstat (limited to 'widgets')
27 files changed, 123 insertions, 268 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index f2caec3008..fa6afd4a3d 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,48 @@ +2000-06-12 Federico Mena Quintero <federico@helixcode.com> + + * e-table-model.[ch]: Removed the freeze/thaw stuff for the model. + As Chris wisely pointed out, having freeze/thaw on the model makes + its state inconsistent from the perspective of the views. + + * e-table-sorted-variable.c: Do not check for a frozen model. + * e-table-subset.c: Likewise. + * e-table-subset-variable.c: Likewise. + + * e-table-example-1.c: Removed the ETableModel thaw handler. + * e-table-example-2.c: Likewise. + * e-table-simple.c: Likewise. + * e-table-size-test.c: Likewise. + * test-check.c: Likewise. + * test-cols.c: Likewise. + * test-table.c: Likewise. + +2000-06-08 Federico Mena Quintero <federico@helixcode.com> + + * e-table-model.h (ETableModelClass): Added a freeze method. + + * e-table-model.c (e_table_model_freeze): Call the freeze method + instead of the thaw method! + + * e-table-simple.h (ETableSimple): Added the freeze function. + + * e-table-simple.c (simple_thaw): Check whether the function + exists. + (simple_freeze): New handler. + (e_table_simple_new): Take in and set the freeze handler. + (e_table_simple_class_init): Set the freeze handler. + + * test-check.c (check_test): Pass in the freeze handler to + e_table_simple_new(). + + * test-cols.c (multi_cols_test): Likewise. + + * e-table-example-2.c (create_table): Likewise. + + * e-table-example-1.c (create_table): Likewise. + + * test-table.c (table_browser_test): Likewise. + (do_e_table_demo): Likewise. + 2000-06-10 Chris Toshok <toshok@helixcode.com> * e-tree-example-1.c (create_tree): supply the pixbufs here. diff --git a/widgets/e-table/e-table-example-1.c b/widgets/e-table/e-table-example-1.c index fbaa3389a2..949131b597 100644 --- a/widgets/e-table/e-table-example-1.c +++ b/widgets/e-table/e-table-example-1.c @@ -171,13 +171,6 @@ my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) return !(value && *(char *)value); } -/* This function is for when the model is unfrozen. This can mostly - be ignored for simple models. */ -static void -my_thaw (ETableModel *etc, void *data) -{ -} - /* We create a window containing our new table. */ static void create_table (void) @@ -200,7 +193,7 @@ create_table (void) my_set_value_at, my_is_cell_editable, my_duplicate_value, my_free_value, my_initialize_value, my_value_is_empty, - my_thaw, NULL); + NULL); /* * Next we create a header. The ETableHeader is used in two * different way. The first is the full_header. This is the diff --git a/widgets/e-table/e-table-example-2.c b/widgets/e-table/e-table-example-2.c index c318507ea4..3accba6cb8 100644 --- a/widgets/e-table/e-table-example-2.c +++ b/widgets/e-table/e-table-example-2.c @@ -207,11 +207,6 @@ my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) } } -static void -my_thaw (ETableModel *etc, void *data) -{ -} - /* We create a window containing our new table. */ static void create_table () @@ -239,7 +234,7 @@ create_table () my_set_value_at, my_is_cell_editable, my_duplicate_value, my_free_value, my_initialize_value, my_value_is_empty, - my_thaw, NULL); + NULL); /* Next we create a header. The ETableHeader is used in two different way. The first is the full_header. This is the diff --git a/widgets/e-table/e-table-model.c b/widgets/e-table/e-table-model.c index 38f5592bb8..62a45d966e 100644 --- a/widgets/e-table/e-table-model.c +++ b/widgets/e-table/e-table-model.c @@ -197,7 +197,6 @@ e_table_model_class_init (GtkObjectClass *object_class) klass->free_value = NULL; klass->initialize_value = NULL; klass->value_is_empty = NULL; - klass->thaw = NULL; klass->model_changed = NULL; klass->model_row_changed = NULL; klass->model_cell_changed = NULL; @@ -280,24 +279,3 @@ e_table_model_row_deleted (ETableModel *e_table_model, int row) gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_ROW_DELETED], row); } - -void -e_table_model_freeze (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = TRUE; - return ETM_CLASS (e_table_model)->thaw (e_table_model); -} - -void -e_table_model_thaw (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = FALSE; - if (ETM_CLASS(e_table_model)->thaw) - ETM_CLASS (e_table_model)->thaw (e_table_model); -} diff --git a/widgets/e-table/e-table-model.h b/widgets/e-table/e-table-model.h index 0c8d51b882..e73df7fa45 100644 --- a/widgets/e-table/e-table-model.h +++ b/widgets/e-table/e-table-model.h @@ -12,8 +12,6 @@ typedef struct { GtkObject base; - - guint frozen : 1; } ETableModel; typedef struct { @@ -37,7 +35,6 @@ typedef struct { /* Return TRUE if value is equivalent to an empty cell. */ gboolean (*value_is_empty) (ETableModel *etm, int col, const void *value); - void (*thaw) (ETableModel *etm); /* * Signals */ @@ -71,9 +68,6 @@ void e_table_model_free_value (ETableModel *e_table_model, int col, void *e_table_model_initialize_value (ETableModel *e_table_model, int col); gboolean e_table_model_value_is_empty (ETableModel *e_table_model, int col, const void *value); -void e_table_model_freeze (ETableModel *e_table_model); -void e_table_model_thaw (ETableModel *e_table_model); - /* * Routines for emitting signals on the e_table */ diff --git a/widgets/e-table/e-table-simple.c b/widgets/e-table/e-table-simple.c index 7e0135b21e..e823e8d550 100644 --- a/widgets/e-table/e-table-simple.c +++ b/widgets/e-table/e-table-simple.c @@ -112,14 +112,6 @@ simple_value_is_empty (ETableModel *etm, int col, const void *value) } static void -simple_thaw (ETableModel *etm) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - simple->thaw (etm, simple->data); -} - -static void e_table_simple_class_init (GtkObjectClass *object_class) { ETableModelClass *model_class = (ETableModelClass *) object_class; @@ -133,7 +125,6 @@ e_table_simple_class_init (GtkObjectClass *object_class) 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->thaw = simple_thaw; } GtkType @@ -169,7 +160,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count, ETableSimpleFreeValueFn free_value, ETableSimpleInitializeValueFn initialize_value, ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleThawFn thaw, void *data) { ETableSimple *et; @@ -185,7 +175,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count, et->free_value = free_value; et->initialize_value = initialize_value; et->value_is_empty = value_is_empty; - et->thaw = thaw; et->data = data; return (ETableModel *) et; diff --git a/widgets/e-table/e-table-simple.h b/widgets/e-table/e-table-simple.h index ab97452f10..31ebd439f0 100644 --- a/widgets/e-table/e-table-simple.h +++ b/widgets/e-table/e-table-simple.h @@ -19,7 +19,6 @@ typedef void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data); typedef void *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data); typedef gboolean (*ETableSimpleValueIsEmptyFn) (ETableModel *etm, int col, const void *val, void *data); -typedef void (*ETableSimpleThawFn) (ETableModel *etm, void *data); typedef struct { ETableModel parent; @@ -33,7 +32,6 @@ typedef struct { ETableSimpleFreeValueFn free_value; ETableSimpleInitializeValueFn initialize_value; ETableSimpleValueIsEmptyFn value_is_empty; - ETableSimpleThawFn thaw; void *data; } ETableSimple; @@ -52,7 +50,6 @@ ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count, ETableSimpleFreeValueFn free_value, ETableSimpleInitializeValueFn initialize_value, ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleThawFn thaw, void *data); #endif /* _E_TABLE_SIMPLE_H_ */ diff --git a/widgets/e-table/e-table-size-test.c b/widgets/e-table/e-table-size-test.c index 058429ca64..12040b29d4 100644 --- a/widgets/e-table/e-table-size-test.c +++ b/widgets/e-table/e-table-size-test.c @@ -171,13 +171,6 @@ my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) return !(value && *(char *)value); } -/* This function is for when the model is unfrozen. This can mostly - be ignored for simple models. */ -static void -my_thaw (ETableModel *etc, void *data) -{ -} - /* We create a window containing our new table. */ static void create_table (void) @@ -195,7 +188,7 @@ create_table (void) my_set_value_at, my_is_cell_editable, my_duplicate_value, my_free_value, my_initialize_value, my_value_is_empty, - my_thaw, NULL); + NULL); /* * Next we create a header. The ETableHeader is used in two * different way. The first is the full_header. This is the diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c index f7719df3c1..4f2985edc6 100644 --- a/widgets/e-table/e-table-sorted-variable.c +++ b/widgets/e-table/e-table-sorted-variable.c @@ -159,8 +159,8 @@ etsv_add (ETableSubsetVariable *etssv, } etss->map_table[i] = row; etss->n_map++; - if (!etm->frozen) - e_table_model_row_inserted (etm, i); + + e_table_model_row_inserted (etm, i); } static void @@ -182,8 +182,8 @@ etsv_add_all (ETableSubsetVariable *etssv) if (etsv->sort_idle_id == 0) { etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL); } - if (!etm->frozen) - e_table_model_changed (etm); + + e_table_model_changed (etm); } ETableModel * @@ -217,29 +217,25 @@ e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETa static void etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv) { - if (!E_TABLE_MODEL(etsv)->frozen){ - /* FIXME: do_resort (); */ - } + /* FIXME: do_resort (); */ } static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv) { ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if (!E_TABLE_MODEL(etsv)->frozen){ - if (e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add (etssv, row); - } + + if (e_table_subset_variable_remove(etssv, row)) + e_table_subset_variable_add (etssv, row); } static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv) { ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if (!E_TABLE_MODEL(etsv)->frozen){ - if (e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add (etssv, row); - } + + if (e_table_subset_variable_remove(etssv, row)) + e_table_subset_variable_add (etssv, row); } static void diff --git a/widgets/e-table/e-table-subset-variable.c b/widgets/e-table/e-table-subset-variable.c index a8948c5e68..377b21c9ae 100644 --- a/widgets/e-table/e-table-subset-variable.c +++ b/widgets/e-table/e-table-subset-variable.c @@ -39,8 +39,8 @@ etssv_add (ETableSubsetVariable *etssv, if (etss->map_table[i] >= row) etss->map_table[i] ++; etss->map_table[etss->n_map++] = row; - if (!etm->frozen) - e_table_model_row_inserted (etm, etss->n_map - 1); + + e_table_model_row_inserted (etm, etss->n_map - 1); } static void @@ -57,8 +57,8 @@ etssv_add_all (ETableSubsetVariable *etssv) } for (i = 0; i < rows; i++) etss->map_table[etss->n_map++] = i; - if (!etm->frozen) - e_table_model_changed (etm); + + e_table_model_changed (etm); } static gboolean @@ -74,8 +74,8 @@ etssv_remove (ETableSubsetVariable *etssv, if (etss->map_table[i] == row) { memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int)); etss->n_map --; - if (!etm->frozen) - e_table_model_changed (etm); + + e_table_model_changed (etm); ret_val = TRUE; break; } diff --git a/widgets/e-table/e-table-subset.c b/widgets/e-table/e-table-subset.c index a0add3b954..d2b1e37a9d 100644 --- a/widgets/e-table/e-table-subset.c +++ b/widgets/e-table/e-table-subset.c @@ -115,12 +115,6 @@ etss_value_is_empty (ETableModel *etm, int col, const void *value) } static void -etss_thaw (ETableModel *etm) -{ - e_table_model_changed (etm); -} - -static void etss_class_init (GtkObjectClass *klass) { ETableModelClass *table_class = (ETableModelClass *) klass; @@ -138,7 +132,6 @@ etss_class_init (GtkObjectClass *klass) table_class->free_value = etss_free_value; table_class->initialize_value = etss_initialize_value; table_class->value_is_empty = etss_value_is_empty; - table_class->thaw = etss_thaw; } E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE); @@ -146,23 +139,20 @@ E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, static void etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss) { - if (!E_TABLE_MODEL(etss)->frozen) - e_table_model_changed (E_TABLE_MODEL (etss)); + e_table_model_changed (E_TABLE_MODEL (etss)); } static void etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) { - if (!E_TABLE_MODEL(etss)->frozen){ - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; + const int n = etss->n_map; + const int * const map_table = etss->map_table; + int i; - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - return; - } + for (i = 0; i < n; i++){ + if (map_table [i] == row){ + e_table_model_row_changed (E_TABLE_MODEL (etss), i); + return; } } } @@ -170,16 +160,14 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) static void etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset *etss) { - if (!E_TABLE_MODEL(etss)->frozen){ - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; + const int n = etss->n_map; + const int * const map_table = etss->map_table; + int i; - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - return; - } + for (i = 0; i < n; i++){ + if (map_table [i] == row){ + e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + return; } } } diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c index 9d95a91d91..87da1ed55e 100644 --- a/widgets/e-table/test-check.c +++ b/widgets/e-table/test-check.c @@ -119,12 +119,6 @@ value_is_empty (ETableModel *etc, int col, const void *value, void *data) } static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed (etc); -} - -static void set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) { gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); @@ -149,7 +143,7 @@ check_test (void) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); /* * Header diff --git a/widgets/e-table/test-cols.c b/widgets/e-table/test-cols.c index 5de5d3399a..414f9a2c56 100644 --- a/widgets/e-table/test-cols.c +++ b/widgets/e-table/test-cols.c @@ -124,12 +124,6 @@ set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); } -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed (etc); -} - void multi_cols_test (void) { @@ -148,7 +142,7 @@ multi_cols_test (void) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); /* * Header diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c index 59126abdab..6ad9e48e0b 100644 --- a/widgets/e-table/test-table.c +++ b/widgets/e-table/test-table.c @@ -203,12 +203,6 @@ value_is_empty (ETableModel *etc, int col, const void *value, void *data) } static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed (etc); -} - -static void set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) { gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); @@ -234,7 +228,7 @@ table_browser_test (void) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); /* * Header @@ -333,7 +327,7 @@ do_e_table_demo (const char *spec) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); full_header = e_table_header_new (); cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c index fbaa3389a2..949131b597 100644 --- a/widgets/table/e-table-example-1.c +++ b/widgets/table/e-table-example-1.c @@ -171,13 +171,6 @@ my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) return !(value && *(char *)value); } -/* This function is for when the model is unfrozen. This can mostly - be ignored for simple models. */ -static void -my_thaw (ETableModel *etc, void *data) -{ -} - /* We create a window containing our new table. */ static void create_table (void) @@ -200,7 +193,7 @@ create_table (void) my_set_value_at, my_is_cell_editable, my_duplicate_value, my_free_value, my_initialize_value, my_value_is_empty, - my_thaw, NULL); + NULL); /* * Next we create a header. The ETableHeader is used in two * different way. The first is the full_header. This is the diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c index c318507ea4..3accba6cb8 100644 --- a/widgets/table/e-table-example-2.c +++ b/widgets/table/e-table-example-2.c @@ -207,11 +207,6 @@ my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) } } -static void -my_thaw (ETableModel *etc, void *data) -{ -} - /* We create a window containing our new table. */ static void create_table () @@ -239,7 +234,7 @@ create_table () my_set_value_at, my_is_cell_editable, my_duplicate_value, my_free_value, my_initialize_value, my_value_is_empty, - my_thaw, NULL); + NULL); /* Next we create a header. The ETableHeader is used in two different way. The first is the full_header. This is the diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index 38f5592bb8..62a45d966e 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -197,7 +197,6 @@ e_table_model_class_init (GtkObjectClass *object_class) klass->free_value = NULL; klass->initialize_value = NULL; klass->value_is_empty = NULL; - klass->thaw = NULL; klass->model_changed = NULL; klass->model_row_changed = NULL; klass->model_cell_changed = NULL; @@ -280,24 +279,3 @@ e_table_model_row_deleted (ETableModel *e_table_model, int row) gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_ROW_DELETED], row); } - -void -e_table_model_freeze (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = TRUE; - return ETM_CLASS (e_table_model)->thaw (e_table_model); -} - -void -e_table_model_thaw (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = FALSE; - if (ETM_CLASS(e_table_model)->thaw) - ETM_CLASS (e_table_model)->thaw (e_table_model); -} diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h index 0c8d51b882..e73df7fa45 100644 --- a/widgets/table/e-table-model.h +++ b/widgets/table/e-table-model.h @@ -12,8 +12,6 @@ typedef struct { GtkObject base; - - guint frozen : 1; } ETableModel; typedef struct { @@ -37,7 +35,6 @@ typedef struct { /* Return TRUE if value is equivalent to an empty cell. */ gboolean (*value_is_empty) (ETableModel *etm, int col, const void *value); - void (*thaw) (ETableModel *etm); /* * Signals */ @@ -71,9 +68,6 @@ void e_table_model_free_value (ETableModel *e_table_model, int col, void *e_table_model_initialize_value (ETableModel *e_table_model, int col); gboolean e_table_model_value_is_empty (ETableModel *e_table_model, int col, const void *value); -void e_table_model_freeze (ETableModel *e_table_model); -void e_table_model_thaw (ETableModel *e_table_model); - /* * Routines for emitting signals on the e_table */ diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c index 7e0135b21e..e823e8d550 100644 --- a/widgets/table/e-table-simple.c +++ b/widgets/table/e-table-simple.c @@ -112,14 +112,6 @@ simple_value_is_empty (ETableModel *etm, int col, const void *value) } static void -simple_thaw (ETableModel *etm) -{ - ETableSimple *simple = E_TABLE_SIMPLE(etm); - - simple->thaw (etm, simple->data); -} - -static void e_table_simple_class_init (GtkObjectClass *object_class) { ETableModelClass *model_class = (ETableModelClass *) object_class; @@ -133,7 +125,6 @@ e_table_simple_class_init (GtkObjectClass *object_class) 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->thaw = simple_thaw; } GtkType @@ -169,7 +160,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count, ETableSimpleFreeValueFn free_value, ETableSimpleInitializeValueFn initialize_value, ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleThawFn thaw, void *data) { ETableSimple *et; @@ -185,7 +175,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count, et->free_value = free_value; et->initialize_value = initialize_value; et->value_is_empty = value_is_empty; - et->thaw = thaw; et->data = data; return (ETableModel *) et; diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h index ab97452f10..31ebd439f0 100644 --- a/widgets/table/e-table-simple.h +++ b/widgets/table/e-table-simple.h @@ -19,7 +19,6 @@ typedef void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data); typedef void *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data); typedef gboolean (*ETableSimpleValueIsEmptyFn) (ETableModel *etm, int col, const void *val, void *data); -typedef void (*ETableSimpleThawFn) (ETableModel *etm, void *data); typedef struct { ETableModel parent; @@ -33,7 +32,6 @@ typedef struct { ETableSimpleFreeValueFn free_value; ETableSimpleInitializeValueFn initialize_value; ETableSimpleValueIsEmptyFn value_is_empty; - ETableSimpleThawFn thaw; void *data; } ETableSimple; @@ -52,7 +50,6 @@ ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count, ETableSimpleFreeValueFn free_value, ETableSimpleInitializeValueFn initialize_value, ETableSimpleValueIsEmptyFn value_is_empty, - ETableSimpleThawFn thaw, void *data); #endif /* _E_TABLE_SIMPLE_H_ */ diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c index 058429ca64..12040b29d4 100644 --- a/widgets/table/e-table-size-test.c +++ b/widgets/table/e-table-size-test.c @@ -171,13 +171,6 @@ my_value_is_empty (ETableModel *etc, int col, const void *value, void *data) return !(value && *(char *)value); } -/* This function is for when the model is unfrozen. This can mostly - be ignored for simple models. */ -static void -my_thaw (ETableModel *etc, void *data) -{ -} - /* We create a window containing our new table. */ static void create_table (void) @@ -195,7 +188,7 @@ create_table (void) my_set_value_at, my_is_cell_editable, my_duplicate_value, my_free_value, my_initialize_value, my_value_is_empty, - my_thaw, NULL); + NULL); /* * Next we create a header. The ETableHeader is used in two * different way. The first is the full_header. This is the diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index f7719df3c1..4f2985edc6 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -159,8 +159,8 @@ etsv_add (ETableSubsetVariable *etssv, } etss->map_table[i] = row; etss->n_map++; - if (!etm->frozen) - e_table_model_row_inserted (etm, i); + + e_table_model_row_inserted (etm, i); } static void @@ -182,8 +182,8 @@ etsv_add_all (ETableSubsetVariable *etssv) if (etsv->sort_idle_id == 0) { etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL); } - if (!etm->frozen) - e_table_model_changed (etm); + + e_table_model_changed (etm); } ETableModel * @@ -217,29 +217,25 @@ e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETa static void etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv) { - if (!E_TABLE_MODEL(etsv)->frozen){ - /* FIXME: do_resort (); */ - } + /* FIXME: do_resort (); */ } static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv) { ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if (!E_TABLE_MODEL(etsv)->frozen){ - if (e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add (etssv, row); - } + + if (e_table_subset_variable_remove(etssv, row)) + e_table_subset_variable_add (etssv, row); } static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv) { ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if (!E_TABLE_MODEL(etsv)->frozen){ - if (e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add (etssv, row); - } + + if (e_table_subset_variable_remove(etssv, row)) + e_table_subset_variable_add (etssv, row); } static void diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index a8948c5e68..377b21c9ae 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -39,8 +39,8 @@ etssv_add (ETableSubsetVariable *etssv, if (etss->map_table[i] >= row) etss->map_table[i] ++; etss->map_table[etss->n_map++] = row; - if (!etm->frozen) - e_table_model_row_inserted (etm, etss->n_map - 1); + + e_table_model_row_inserted (etm, etss->n_map - 1); } static void @@ -57,8 +57,8 @@ etssv_add_all (ETableSubsetVariable *etssv) } for (i = 0; i < rows; i++) etss->map_table[etss->n_map++] = i; - if (!etm->frozen) - e_table_model_changed (etm); + + e_table_model_changed (etm); } static gboolean @@ -74,8 +74,8 @@ etssv_remove (ETableSubsetVariable *etssv, if (etss->map_table[i] == row) { memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int)); etss->n_map --; - if (!etm->frozen) - e_table_model_changed (etm); + + e_table_model_changed (etm); ret_val = TRUE; break; } diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index a0add3b954..d2b1e37a9d 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -115,12 +115,6 @@ etss_value_is_empty (ETableModel *etm, int col, const void *value) } static void -etss_thaw (ETableModel *etm) -{ - e_table_model_changed (etm); -} - -static void etss_class_init (GtkObjectClass *klass) { ETableModelClass *table_class = (ETableModelClass *) klass; @@ -138,7 +132,6 @@ etss_class_init (GtkObjectClass *klass) table_class->free_value = etss_free_value; table_class->initialize_value = etss_initialize_value; table_class->value_is_empty = etss_value_is_empty; - table_class->thaw = etss_thaw; } E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE); @@ -146,23 +139,20 @@ E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, static void etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss) { - if (!E_TABLE_MODEL(etss)->frozen) - e_table_model_changed (E_TABLE_MODEL (etss)); + e_table_model_changed (E_TABLE_MODEL (etss)); } static void etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) { - if (!E_TABLE_MODEL(etss)->frozen){ - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; + const int n = etss->n_map; + const int * const map_table = etss->map_table; + int i; - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_row_changed (E_TABLE_MODEL (etss), i); - return; - } + for (i = 0; i < n; i++){ + if (map_table [i] == row){ + e_table_model_row_changed (E_TABLE_MODEL (etss), i); + return; } } } @@ -170,16 +160,14 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) static void etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset *etss) { - if (!E_TABLE_MODEL(etss)->frozen){ - const int n = etss->n_map; - const int * const map_table = etss->map_table; - int i; + const int n = etss->n_map; + const int * const map_table = etss->map_table; + int i; - for (i = 0; i < n; i++){ - if (map_table [i] == row){ - e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); - return; - } + for (i = 0; i < n; i++){ + if (map_table [i] == row){ + e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i); + return; } } } diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c index 9d95a91d91..87da1ed55e 100644 --- a/widgets/table/test-check.c +++ b/widgets/table/test-check.c @@ -119,12 +119,6 @@ value_is_empty (ETableModel *etc, int col, const void *value, void *data) } static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed (etc); -} - -static void set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) { gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); @@ -149,7 +143,7 @@ check_test (void) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); /* * Header diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c index 5de5d3399a..414f9a2c56 100644 --- a/widgets/table/test-cols.c +++ b/widgets/table/test-cols.c @@ -124,12 +124,6 @@ set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); } -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed (etc); -} - void multi_cols_test (void) { @@ -148,7 +142,7 @@ multi_cols_test (void) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); /* * Header diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c index 59126abdab..6ad9e48e0b 100644 --- a/widgets/table/test-table.c +++ b/widgets/table/test-table.c @@ -203,12 +203,6 @@ value_is_empty (ETableModel *etc, int col, const void *value, void *data) } static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed (etc); -} - -static void set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) { gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); @@ -234,7 +228,7 @@ table_browser_test (void) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); /* * Header @@ -333,7 +327,7 @@ do_e_table_demo (const char *spec) set_value_at, is_cell_editable, duplicate_value, free_value, initialize_value, value_is_empty, - thaw, NULL); + NULL); full_header = e_table_header_new (); cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT); |