diff options
Diffstat (limited to 'widgets/table/e-table-model.c')
-rw-r--r-- | widgets/table/e-table-model.c | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index 774eb19c3d..89dce2756c 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -38,6 +38,7 @@ d(static gint depth = 0); static GtkObjectClass *e_table_model_parent_class; enum { + MODEL_NO_CHANGE, MODEL_CHANGED, MODEL_PRE_CHANGE, MODEL_ROW_CHANGED, @@ -272,6 +273,15 @@ e_table_model_class_init (GtkObjectClass *object_class) object_class->destroy = e_table_model_destroy; + e_table_model_signals [MODEL_NO_CHANGE] = + gtk_signal_new ("model_no_change", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (ETableModelClass, model_no_change), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + e_table_model_signals [MODEL_CHANGED] = gtk_signal_new ("model_changed", GTK_RUN_LAST, @@ -341,6 +351,7 @@ e_table_model_class_init (GtkObjectClass *object_class) klass->value_is_empty = NULL; klass->value_to_string = NULL; + klass->model_no_change = NULL; klass->model_changed = NULL; klass->model_row_changed = NULL; klass->model_cell_changed = NULL; @@ -391,7 +402,7 @@ e_table_model_pre_change (ETableModel *e_table_model) g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); d(print_tabs()); - d(g_print("Emitting pre_change on model 0x%p.\n", e_table_model)); + d(g_print("Emitting pre_change on model 0x%p, a %s.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type))); d(depth++); gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_PRE_CHANGE]); @@ -399,6 +410,33 @@ e_table_model_pre_change (ETableModel *e_table_model) } /** + * e_table_model_no_change: + * @e_table_model: the table model to notify of the lack of a change + * + * Use this function to notify any views of this table model that + * the contents of the table model have changed. This will emit + * the signal "model_no_change" on the @e_table_model object. + * + * It is preferable to use the e_table_model_row_changed() and + * the e_table_model_cell_changed() to notify of smaller changes + * than to invalidate the entire model, as the views might have + * ways of caching the information they render from the model. + */ +void +e_table_model_no_change (ETableModel *e_table_model) +{ + g_return_if_fail (e_table_model != NULL); + g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); + + d(print_tabs()); + d(g_print("Emitting model_no_change on model 0x%p, a %s.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type))); + d(depth++); + gtk_signal_emit (GTK_OBJECT (e_table_model), + e_table_model_signals [MODEL_NO_CHANGE]); + d(depth--); +} + +/** * e_table_model_changed: * @e_table_model: the table model to notify of the change * @@ -418,7 +456,7 @@ e_table_model_changed (ETableModel *e_table_model) g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); d(print_tabs()); - d(g_print("Emitting model_changed on model 0x%p.\n", e_table_model)); + d(g_print("Emitting model_changed on model 0x%p, a %s.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type))); d(depth++); gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_CHANGED]); @@ -442,7 +480,7 @@ e_table_model_row_changed (ETableModel *e_table_model, int row) g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); d(print_tabs()); - d(g_print("Emitting row_changed on model 0x%p, row %d.\n", e_table_model, row)); + d(g_print("Emitting row_changed on model 0x%p, a %s, row %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row)); d(depth++); gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_ROW_CHANGED], row); @@ -467,7 +505,7 @@ e_table_model_cell_changed (ETableModel *e_table_model, int col, int row) g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); d(print_tabs()); - d(g_print("Emitting cell_changed on model 0x%p, row %d, col %d.\n", e_table_model, row, col)); + d(g_print("Emitting cell_changed on model 0x%p, a %s, row %d, col %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row, col)); d(depth++); gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_CELL_CHANGED], col, row); @@ -492,7 +530,7 @@ e_table_model_rows_inserted (ETableModel *e_table_model, int row, int count) g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); d(print_tabs()); - d(g_print("Emitting row_inserted on model 0x%p, row %d.\n", e_table_model, row)); + d(g_print("Emitting row_inserted on model 0x%p, a %s, row %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row)); d(depth++); gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_ROWS_INSERTED], row, count); @@ -532,7 +570,7 @@ e_table_model_rows_deleted (ETableModel *e_table_model, int row, int count) g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); d(print_tabs()); - d(g_print("Emitting row_deleted on model 0x%p, row %d.\n", e_table_model, row)); + d(g_print("Emitting row_deleted on model 0x%p, a %s, row %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row)); d(depth++); gtk_signal_emit (GTK_OBJECT (e_table_model), e_table_model_signals [MODEL_ROWS_DELETED], row, count); |