diff options
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-table-memory-store.c | 39 | ||||
-rw-r--r-- | e-util/e-table-memory.c | 19 | ||||
-rw-r--r-- | e-util/e-table-memory.h | 4 | ||||
-rw-r--r-- | e-util/e-table-model.c | 151 | ||||
-rw-r--r-- | e-util/e-table-model.h | 22 | ||||
-rw-r--r-- | e-util/e-table-one.c | 39 | ||||
-rw-r--r-- | e-util/e-table-one.h | 4 | ||||
-rw-r--r-- | e-util/e-table-subset.c | 49 | ||||
-rw-r--r-- | e-util/e-table-subset.h | 4 | ||||
-rw-r--r-- | e-util/e-tree-table-adapter.c | 53 | ||||
-rw-r--r-- | e-util/e-tree-table-adapter.h | 4 | ||||
-rw-r--r-- | e-util/gal-define-views-model.c | 49 | ||||
-rw-r--r-- | e-util/gal-define-views-model.h | 4 |
13 files changed, 245 insertions, 196 deletions
diff --git a/e-util/e-table-memory-store.c b/e-util/e-table-memory-store.c index 6432cc3c5b..480aacc3ac 100644 --- a/e-util/e-table-memory-store.c +++ b/e-util/e-table-memory-store.c @@ -36,10 +36,17 @@ struct _ETableMemoryStorePrivate { gpointer *store; }; -G_DEFINE_TYPE ( +/* Forward Declarations */ +static void e_table_memory_store_table_model_init + (ETableModelInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( ETableMemoryStore, e_table_memory_store, - E_TYPE_TABLE_MEMORY) + E_TYPE_TABLE_MEMORY, + G_IMPLEMENT_INTERFACE ( + E_TYPE_TABLE_MODEL, + e_table_memory_store_table_model_init)) static gpointer duplicate_value (ETableMemoryStore *etms, @@ -235,24 +242,28 @@ static void e_table_memory_store_class_init (ETableMemoryStoreClass *class) { GObjectClass *object_class; - ETableModelClass *model_class; g_type_class_add_private (class, sizeof (ETableMemoryStorePrivate)); object_class = G_OBJECT_CLASS (class); object_class->finalize = table_memory_store_finalize; +} - model_class = E_TABLE_MODEL_CLASS (class); - model_class->column_count = table_memory_store_column_count; - model_class->append_row = table_memory_store_append_row; - model_class->value_at = table_memory_store_value_at; - model_class->set_value_at = table_memory_store_set_value_at; - model_class->is_cell_editable = table_memory_store_is_cell_editable; - model_class->duplicate_value = table_memory_store_duplicate_value; - model_class->free_value = table_memory_store_free_value; - model_class->initialize_value = table_memory_store_initialize_value; - model_class->value_is_empty = table_memory_store_value_is_empty; - model_class->value_to_string = table_memory_store_value_to_string; +static void +e_table_memory_store_table_model_init (ETableModelInterface *interface) +{ + interface->column_count = table_memory_store_column_count; + interface->append_row = table_memory_store_append_row; + + interface->value_at = table_memory_store_value_at; + interface->set_value_at = table_memory_store_set_value_at; + interface->is_cell_editable = table_memory_store_is_cell_editable; + + interface->duplicate_value = table_memory_store_duplicate_value; + interface->free_value = table_memory_store_free_value; + interface->initialize_value = table_memory_store_initialize_value; + interface->value_is_empty = table_memory_store_value_is_empty; + interface->value_to_string = table_memory_store_value_to_string; } static void diff --git a/e-util/e-table-memory.c b/e-util/e-table-memory.c index 5a0bcd1868..09f13e0b11 100644 --- a/e-util/e-table-memory.c +++ b/e-util/e-table-memory.c @@ -37,10 +37,17 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_TABLE_MEMORY, ETableMemoryPrivate)) -G_DEFINE_TYPE ( +/* Forward Declarations */ +static void e_table_memory_table_model_init + (ETableModelInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( ETableMemory, e_table_memory, - E_TYPE_TABLE_MODEL) + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE ( + E_TYPE_TABLE_MODEL, + e_table_memory_table_model_init)) struct _ETableMemoryPrivate { gpointer *data; @@ -73,15 +80,17 @@ static void e_table_memory_class_init (ETableMemoryClass *class) { GObjectClass *object_class; - ETableModelClass *table_model_class; g_type_class_add_private (class, sizeof (ETableMemoryPrivate)); object_class = G_OBJECT_CLASS (class); object_class->finalize = table_memory_finalize; +} - table_model_class = E_TABLE_MODEL_CLASS (class); - table_model_class->row_count = table_memory_row_count; +static void +e_table_memory_table_model_init (ETableModelInterface *interface) +{ + interface->row_count = table_memory_row_count; } static void diff --git a/e-util/e-table-memory.h b/e-util/e-table-memory.h index db0809daf7..86f2b7014a 100644 --- a/e-util/e-table-memory.h +++ b/e-util/e-table-memory.h @@ -57,12 +57,12 @@ typedef struct _ETableMemoryClass ETableMemoryClass; typedef struct _ETableMemoryPrivate ETableMemoryPrivate; struct _ETableMemory { - ETableModel parent; + GObject parent; ETableMemoryPrivate *priv; }; struct _ETableMemoryClass { - ETableModelClass parent_class; + GObjectClass parent_class; }; GType e_table_memory_get_type (void) G_GNUC_CONST; diff --git a/e-util/e-table-model.c b/e-util/e-table-model.c index 7f9477b0f2..78030370f8 100644 --- a/e-util/e-table-model.c +++ b/e-util/e-table-model.c @@ -22,7 +22,7 @@ d (static gint depth = 0;) -G_DEFINE_TYPE (ETableModel, e_table_model, G_TYPE_OBJECT) +G_DEFINE_INTERFACE (ETableModel, e_table_model, G_TYPE_OBJECT) enum { MODEL_NO_CHANGE, @@ -49,48 +49,46 @@ table_model_is_frozen (ETableModel *table_model) } static void -e_table_model_class_init (ETableModelClass *class) +e_table_model_default_init (ETableModelInterface *interface) { - GObjectClass *object_class = G_OBJECT_CLASS (class); - signals[MODEL_NO_CHANGE] = g_signal_new ( "model_no_change", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_no_change), + G_STRUCT_OFFSET (ETableModelInterface, model_no_change), NULL, NULL, NULL, G_TYPE_NONE, 0); signals[MODEL_CHANGED] = g_signal_new ( "model_changed", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_changed), + G_STRUCT_OFFSET (ETableModelInterface, model_changed), NULL, NULL, NULL, G_TYPE_NONE, 0); signals[MODEL_PRE_CHANGE] = g_signal_new ( "model_pre_change", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_pre_change), + G_STRUCT_OFFSET (ETableModelInterface, model_pre_change), NULL, NULL, NULL, G_TYPE_NONE, 0); signals[MODEL_ROW_CHANGED] = g_signal_new ( "model_row_changed", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_row_changed), + G_STRUCT_OFFSET (ETableModelInterface, model_row_changed), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_INT); signals[MODEL_CELL_CHANGED] = g_signal_new ( "model_cell_changed", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_cell_changed), + G_STRUCT_OFFSET (ETableModelInterface, model_cell_changed), NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, @@ -98,9 +96,9 @@ e_table_model_class_init (ETableModelClass *class) signals[MODEL_ROWS_INSERTED] = g_signal_new ( "model_rows_inserted", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted), + G_STRUCT_OFFSET (ETableModelInterface, model_rows_inserted), NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, @@ -108,20 +106,15 @@ e_table_model_class_init (ETableModelClass *class) signals[MODEL_ROWS_DELETED] = g_signal_new ( "model_rows_deleted", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_INTERFACE (interface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted), + G_STRUCT_OFFSET (ETableModelInterface, model_rows_deleted), NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); } -static void -e_table_model_init (ETableModel *table_model) -{ -} - /** * e_table_model_column_count: * @table_model: The e-table-model to operate on @@ -131,14 +124,14 @@ e_table_model_init (ETableModel *table_model) gint e_table_model_column_count (ETableModel *table_model) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), 0); - class = E_TABLE_MODEL_GET_CLASS (table_model); - g_return_val_if_fail (class->column_count != NULL, 0); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); + g_return_val_if_fail (interface->column_count != NULL, 0); - return class->column_count (table_model); + return interface->column_count (table_model); } /** @@ -150,14 +143,14 @@ e_table_model_column_count (ETableModel *table_model) gint e_table_model_row_count (ETableModel *table_model) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), 0); - class = E_TABLE_MODEL_GET_CLASS (table_model); - g_return_val_if_fail (class->row_count != NULL, 0); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); + g_return_val_if_fail (interface->row_count != NULL, 0); - return class->row_count (table_model); + return interface->row_count (table_model); } /** @@ -172,14 +165,14 @@ e_table_model_append_row (ETableModel *table_model, ETableModel *source, gint row) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_if_fail (E_IS_TABLE_MODEL (table_model)); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->append_row != NULL) - class->append_row (table_model, source, row); + if (interface->append_row != NULL) + interface->append_row (table_model, source, row); } /** @@ -206,14 +199,14 @@ e_table_model_value_at (ETableModel *table_model, gint col, gint row) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), NULL); - class = E_TABLE_MODEL_GET_CLASS (table_model); - g_return_val_if_fail (class->value_at != NULL, NULL); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); + g_return_val_if_fail (interface->value_at != NULL, NULL); - return class->value_at (table_model, col, row); + return interface->value_at (table_model, col, row); } /** @@ -237,14 +230,14 @@ e_table_model_set_value_at (ETableModel *table_model, gint row, gconstpointer value) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_if_fail (E_IS_TABLE_MODEL (table_model)); - class = E_TABLE_MODEL_GET_CLASS (table_model); - g_return_if_fail (class->set_value_at != NULL); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); + g_return_if_fail (interface->set_value_at != NULL); - class->set_value_at (table_model, col, row, value); + interface->set_value_at (table_model, col, row, value); } /** @@ -261,14 +254,14 @@ e_table_model_is_cell_editable (ETableModel *table_model, gint col, gint row) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), FALSE); - class = E_TABLE_MODEL_GET_CLASS (table_model); - g_return_val_if_fail (class->is_cell_editable != NULL, FALSE); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); + g_return_val_if_fail (interface->is_cell_editable != NULL, FALSE); - return class->is_cell_editable (table_model, col, row); + return interface->is_cell_editable (table_model, col, row); } gpointer @@ -276,16 +269,16 @@ e_table_model_duplicate_value (ETableModel *table_model, gint col, gconstpointer value) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), NULL); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->duplicate_value == NULL) + if (interface->duplicate_value == NULL) return NULL; - return class->duplicate_value (table_model, col, value); + return interface->duplicate_value (table_model, col, value); } void @@ -293,76 +286,76 @@ e_table_model_free_value (ETableModel *table_model, gint col, gpointer value) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_if_fail (E_IS_TABLE_MODEL (table_model)); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->free_value != NULL) - class->free_value (table_model, col, value); + if (interface->free_value != NULL) + interface->free_value (table_model, col, value); } gboolean e_table_model_has_save_id (ETableModel *table_model) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), FALSE); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->has_save_id == NULL) + if (interface->has_save_id == NULL) return FALSE; - return class->has_save_id (table_model); + return interface->has_save_id (table_model); } gchar * e_table_model_get_save_id (ETableModel *table_model, gint row) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), NULL); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->get_save_id == NULL) + if (interface->get_save_id == NULL) return NULL; - return class->get_save_id (table_model, row); + return interface->get_save_id (table_model, row); } gboolean e_table_model_has_change_pending (ETableModel *table_model) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), FALSE); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->has_change_pending == NULL) + if (interface->has_change_pending == NULL) return FALSE; - return class->has_change_pending (table_model); + return interface->has_change_pending (table_model); } gpointer e_table_model_initialize_value (ETableModel *table_model, gint col) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), NULL); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->initialize_value == NULL) + if (interface->initialize_value == NULL) return NULL; - return class->initialize_value (table_model, col); + return interface->initialize_value (table_model, col); } gboolean @@ -370,16 +363,16 @@ e_table_model_value_is_empty (ETableModel *table_model, gint col, gconstpointer value) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), FALSE); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->value_is_empty == NULL) + if (interface->value_is_empty == NULL) return FALSE; - return class->value_is_empty (table_model, col, value); + return interface->value_is_empty (table_model, col, value); } gchar * @@ -387,16 +380,16 @@ e_table_model_value_to_string (ETableModel *table_model, gint col, gconstpointer value) { - ETableModelClass *class; + ETableModelInterface *interface; g_return_val_if_fail (E_IS_TABLE_MODEL (table_model), NULL); - class = E_TABLE_MODEL_GET_CLASS (table_model); + interface = E_TABLE_MODEL_GET_INTERFACE (table_model); - if (class->value_to_string == NULL) + if (interface->value_to_string == NULL) return g_strdup (""); - return class->value_to_string (table_model, col, value); + return interface->value_to_string (table_model, col, value); } #if d(!)0 diff --git a/e-util/e-table-model.h b/e-util/e-table-model.h index 60fc11c53c..99f53b15c1 100644 --- a/e-util/e-table-model.h +++ b/e-util/e-table-model.h @@ -31,30 +31,20 @@ #define E_TABLE_MODEL(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_TABLE_MODEL, ETableModel)) -#define E_TABLE_MODEL_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_TABLE_MODEL, ETableModelClass)) #define E_IS_TABLE_MODEL(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), E_TYPE_TABLE_MODEL)) -#define E_IS_TABLE_MODEL_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_TABLE_MODEL)) -#define E_TABLE_MODEL_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_TABLE_MODEL, ETableModelClass)) +#define E_TABLE_MODEL_GET_INTERFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE \ + ((obj), E_TYPE_TABLE_MODEL, ETableModelInterface)) G_BEGIN_DECLS typedef struct _ETableModel ETableModel; -typedef struct _ETableModelClass ETableModelClass; +typedef struct _ETableModelInterface ETableModelInterface; -struct _ETableModel { - GObject parent; -}; - -struct _ETableModelClass { - GObjectClass parent_class; +struct _ETableModelInterface { + GTypeInterface parent_interface; gint (*column_count) (ETableModel *table_model); gint (*row_count) (ETableModel *table_model); diff --git a/e-util/e-table-one.c b/e-util/e-table-one.c index 242484fdfa..59279c3d59 100644 --- a/e-util/e-table-one.c +++ b/e-util/e-table-one.c @@ -27,10 +27,17 @@ #include "e-table-one.h" -G_DEFINE_TYPE ( +/* Forward Declarations */ +static void e_table_one_table_model_init + (ETableModelInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( ETableOne, e_table_one, - E_TYPE_TABLE_MODEL) + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE ( + E_TYPE_TABLE_MODEL, + e_table_one_table_model_init)) static void table_one_dispose (GObject *object) @@ -182,22 +189,26 @@ static void e_table_one_class_init (ETableOneClass *class) { GObjectClass *object_class; - ETableModelClass *model_class; object_class = G_OBJECT_CLASS (class); object_class->dispose = table_one_dispose; +} - model_class = E_TABLE_MODEL_CLASS (class); - model_class->column_count = table_one_column_count; - model_class->row_count = table_one_row_count; - model_class->value_at = table_one_value_at; - model_class->set_value_at = table_one_set_value_at; - model_class->is_cell_editable = table_one_is_cell_editable; - model_class->duplicate_value = table_one_duplicate_value; - model_class->free_value = table_one_free_value; - model_class->initialize_value = table_one_initialize_value; - model_class->value_is_empty = table_one_value_is_empty; - model_class->value_to_string = table_one_value_to_string; +static void +e_table_one_table_model_init (ETableModelInterface *interface) +{ + interface->column_count = table_one_column_count; + interface->row_count = table_one_row_count; + + interface->value_at = table_one_value_at; + interface->set_value_at = table_one_set_value_at; + interface->is_cell_editable = table_one_is_cell_editable; + + interface->duplicate_value = table_one_duplicate_value; + interface->free_value = table_one_free_value; + interface->initialize_value = table_one_initialize_value; + interface->value_is_empty = table_one_value_is_empty; + interface->value_to_string = table_one_value_to_string; } static void diff --git a/e-util/e-table-one.h b/e-util/e-table-one.h index 86f5538ffb..788bcbe335 100644 --- a/e-util/e-table-one.h +++ b/e-util/e-table-one.h @@ -54,14 +54,14 @@ typedef struct _ETableOne ETableOne; typedef struct _ETableOneClass ETableOneClass; struct _ETableOne { - ETableModel parent; + GObject parent; ETableModel *source; gpointer *data; }; struct _ETableOneClass { - ETableModelClass parent_class; + GObjectClass parent_class; }; GType e_table_one_get_type (void) G_GNUC_CONST; diff --git a/e-util/e-table-subset.c b/e-util/e-table-subset.c index 92f71cedde..741fc8d230 100644 --- a/e-util/e-table-subset.c +++ b/e-util/e-table-subset.c @@ -54,7 +54,17 @@ struct _ETableSubsetPrivate { gint last_access; }; -G_DEFINE_TYPE (ETableSubset, e_table_subset, E_TYPE_TABLE_MODEL) +/* Forward Declarations */ +static void e_table_subset_table_model_init + (ETableModelInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + ETableSubset, + e_table_subset, + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE ( + E_TYPE_TABLE_MODEL, + e_table_subset_table_model_init)) static gint table_subset_get_view_row (ETableSubset *table_subset, @@ -390,7 +400,6 @@ static void e_table_subset_class_init (ETableSubsetClass *class) { GObjectClass *object_class; - ETableModelClass *table_class; g_type_class_add_private (class, sizeof (ETableSubsetPrivate)); @@ -398,21 +407,6 @@ e_table_subset_class_init (ETableSubsetClass *class) object_class->dispose = table_subset_dispose; object_class->finalize = table_subset_finalize; - table_class = E_TABLE_MODEL_CLASS (class); - table_class->column_count = table_subset_column_count; - table_class->row_count = table_subset_row_count; - table_class->append_row = table_subset_append_row; - table_class->value_at = table_subset_value_at; - table_class->set_value_at = table_subset_set_value_at; - table_class->is_cell_editable = table_subset_is_cell_editable; - table_class->has_save_id = table_subset_has_save_id; - table_class->get_save_id = table_subset_get_save_id; - table_class->duplicate_value = table_subset_duplicate_value; - table_class->free_value = table_subset_free_value; - table_class->initialize_value = table_subset_initialize_value; - table_class->value_is_empty = table_subset_value_is_empty; - table_class->value_to_string = table_subset_value_to_string; - class->proxy_model_pre_change = table_subset_proxy_model_pre_change_real; class->proxy_model_no_change = table_subset_proxy_model_no_change_real; class->proxy_model_changed = table_subset_proxy_model_changed_real; @@ -423,6 +417,27 @@ e_table_subset_class_init (ETableSubsetClass *class) } static void +e_table_subset_table_model_init (ETableModelInterface *interface) +{ + interface->column_count = table_subset_column_count; + interface->row_count = table_subset_row_count; + interface->append_row = table_subset_append_row; + + interface->value_at = table_subset_value_at; + interface->set_value_at = table_subset_set_value_at; + interface->is_cell_editable = table_subset_is_cell_editable; + + interface->has_save_id = table_subset_has_save_id; + interface->get_save_id = table_subset_get_save_id; + + interface->duplicate_value = table_subset_duplicate_value; + interface->free_value = table_subset_free_value; + interface->initialize_value = table_subset_initialize_value; + interface->value_is_empty = table_subset_value_is_empty; + interface->value_to_string = table_subset_value_to_string; +} + +static void e_table_subset_init (ETableSubset *table_subset) { table_subset->priv = E_TABLE_SUBSET_GET_PRIVATE (table_subset); diff --git a/e-util/e-table-subset.h b/e-util/e-table-subset.h index fc954f820c..f56997df0a 100644 --- a/e-util/e-table-subset.h +++ b/e-util/e-table-subset.h @@ -57,7 +57,7 @@ typedef struct _ETableSubsetClass ETableSubsetClass; typedef struct _ETableSubsetPrivate ETableSubsetPrivate; struct _ETableSubset { - ETableModel parent; + GObject parent; ETableSubsetPrivate *priv; /* protected - subclasses modify this directly */ @@ -66,7 +66,7 @@ struct _ETableSubset { }; struct _ETableSubsetClass { - ETableModelClass parent_class; + GObjectClass parent_class; void (*proxy_model_pre_change) (ETableSubset *table_subset, diff --git a/e-util/e-tree-table-adapter.c b/e-util/e-tree-table-adapter.c index 2950d60a33..8c49ec4283 100644 --- a/e-util/e-tree-table-adapter.c +++ b/e-util/e-tree-table-adapter.c @@ -97,12 +97,19 @@ enum { LAST_SIGNAL }; +/* Forward Declarations */ +static void e_tree_table_adapter_table_model_init + (ETableModelInterface *interface); + static guint signals[LAST_SIGNAL]; -G_DEFINE_TYPE ( +G_DEFINE_TYPE_WITH_CODE ( ETreeTableAdapter, e_tree_table_adapter, - E_TYPE_TABLE_MODEL) + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE ( + E_TYPE_TABLE_MODEL, + e_tree_table_adapter_table_model_init)) static GNode * lookup_gnode (ETreeTableAdapter *etta, @@ -732,7 +739,6 @@ static void e_tree_table_adapter_class_init (ETreeTableAdapterClass *class) { GObjectClass *object_class; - ETableModelClass *table_model_class; g_type_class_add_private (class, sizeof (ETreeTableAdapterPrivate)); @@ -740,26 +746,6 @@ e_tree_table_adapter_class_init (ETreeTableAdapterClass *class) object_class->dispose = tree_table_adapter_dispose; object_class->finalize = tree_table_adapter_finalize; - table_model_class = E_TABLE_MODEL_CLASS (class); - table_model_class->column_count = tree_table_adapter_column_count; - table_model_class->row_count = tree_table_adapter_row_count; - table_model_class->append_row = tree_table_adapter_append_row; - - table_model_class->value_at = tree_table_adapter_value_at; - table_model_class->set_value_at = tree_table_adapter_set_value_at; - table_model_class->is_cell_editable = tree_table_adapter_is_cell_editable; - - table_model_class->has_save_id = tree_table_adapter_has_save_id; - table_model_class->get_save_id = tree_table_adapter_get_save_id; - - table_model_class->duplicate_value = tree_table_adapter_duplicate_value; - table_model_class->free_value = tree_table_adapter_free_value; - table_model_class->initialize_value = tree_table_adapter_initialize_value; - table_model_class->value_is_empty = tree_table_adapter_value_is_empty; - table_model_class->value_to_string = tree_table_adapter_value_to_string; - - class->sorting_changed = NULL; - signals[SORTING_CHANGED] = g_signal_new ( "sorting_changed", G_OBJECT_CLASS_TYPE (object_class), @@ -772,6 +758,27 @@ e_tree_table_adapter_class_init (ETreeTableAdapterClass *class) } static void +e_tree_table_adapter_table_model_init (ETableModelInterface *interface) +{ + interface->column_count = tree_table_adapter_column_count; + interface->row_count = tree_table_adapter_row_count; + interface->append_row = tree_table_adapter_append_row; + + interface->value_at = tree_table_adapter_value_at; + interface->set_value_at = tree_table_adapter_set_value_at; + interface->is_cell_editable = tree_table_adapter_is_cell_editable; + + interface->has_save_id = tree_table_adapter_has_save_id; + interface->get_save_id = tree_table_adapter_get_save_id; + + interface->duplicate_value = tree_table_adapter_duplicate_value; + interface->free_value = tree_table_adapter_free_value; + interface->initialize_value = tree_table_adapter_initialize_value; + interface->value_is_empty = tree_table_adapter_value_is_empty; + interface->value_to_string = tree_table_adapter_value_to_string; +} + +static void e_tree_table_adapter_init (ETreeTableAdapter *etta) { etta->priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (etta); diff --git a/e-util/e-tree-table-adapter.h b/e-util/e-tree-table-adapter.h index 17f3304aa4..29ec1c740e 100644 --- a/e-util/e-tree-table-adapter.h +++ b/e-util/e-tree-table-adapter.h @@ -61,12 +61,12 @@ typedef struct _ETreeTableAdapterClass ETreeTableAdapterClass; typedef struct _ETreeTableAdapterPrivate ETreeTableAdapterPrivate; struct _ETreeTableAdapter { - ETableModel parent; + GObject parent; ETreeTableAdapterPrivate *priv; }; struct _ETreeTableAdapterClass { - ETableModelClass parent_class; + GObjectClass parent_class; /* Signals */ gboolean (*sorting_changed) (ETreeTableAdapter *etta); diff --git a/e-util/gal-define-views-model.c b/e-util/gal-define-views-model.c index 14bdac636f..d05ac53e67 100644 --- a/e-util/gal-define-views-model.c +++ b/e-util/gal-define-views-model.c @@ -38,10 +38,17 @@ enum { PROP_COLLECTION }; -G_DEFINE_TYPE ( +/* Forward Declarations */ +static void gal_define_views_model_table_model_init + (ETableModelInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( GalDefineViewsModel, gal_define_views_model, - E_TYPE_TABLE_MODEL) + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE ( + E_TYPE_TABLE_MODEL, + gal_define_views_model_table_model_init)) static void gal_define_views_model_set_property (GObject *object, @@ -240,12 +247,12 @@ gal_define_views_model_append (GalDefineViewsModel *model, static void gal_define_views_model_class_init (GalDefineViewsModelClass *class) { - ETableModelClass *model_class = E_TABLE_MODEL_CLASS (class); - GObjectClass *object_class = G_OBJECT_CLASS (class); + GObjectClass *object_class; - object_class->dispose = gdvm_dispose; - object_class->set_property = gal_define_views_model_set_property; - object_class->get_property = gal_define_views_model_get_property; + object_class = G_OBJECT_CLASS (class); + object_class->set_property = gal_define_views_model_set_property; + object_class->get_property = gal_define_views_model_get_property; + object_class->dispose = gdvm_dispose; g_object_class_install_property ( object_class, @@ -266,18 +273,24 @@ gal_define_views_model_class_init (GalDefineViewsModelClass *class) NULL, GAL_TYPE_VIEW_COLLECTION, G_PARAM_READWRITE)); +} - model_class->column_count = gdvm_col_count; - model_class->row_count = gdvm_row_count; - model_class->value_at = gdvm_value_at; - model_class->set_value_at = gdvm_set_value_at; - model_class->is_cell_editable = gdvm_is_cell_editable; - model_class->append_row = gdvm_append_row; - model_class->duplicate_value = gdvm_duplicate_value; - model_class->free_value = gdvm_free_value; - model_class->initialize_value = gdvm_initialize_value; - model_class->value_is_empty = gdvm_value_is_empty; - model_class->value_to_string = gdvm_value_to_string; +static void +gal_define_views_model_table_model_init (ETableModelInterface *interface) +{ + interface->column_count = gdvm_col_count; + interface->row_count = gdvm_row_count; + interface->append_row = gdvm_append_row; + + interface->value_at = gdvm_value_at; + interface->set_value_at = gdvm_set_value_at; + interface->is_cell_editable = gdvm_is_cell_editable; + + interface->duplicate_value = gdvm_duplicate_value; + interface->free_value = gdvm_free_value; + interface->initialize_value = gdvm_initialize_value; + interface->value_is_empty = gdvm_value_is_empty; + interface->value_to_string = gdvm_value_to_string; } static void diff --git a/e-util/gal-define-views-model.h b/e-util/gal-define-views-model.h index 8bc243d52c..cd4d44ccf7 100644 --- a/e-util/gal-define-views-model.h +++ b/e-util/gal-define-views-model.h @@ -57,7 +57,7 @@ typedef struct _GalDefineViewsModel GalDefineViewsModel; typedef struct _GalDefineViewsModelClass GalDefineViewsModelClass; struct _GalDefineViewsModel { - ETableModel parent; + GObject parent; /* item specific fields */ GalViewCollection *collection; @@ -66,7 +66,7 @@ struct _GalDefineViewsModel { }; struct _GalDefineViewsModelClass { - ETableModelClass parent_class; + GObjectClass parent_class; }; GType gal_define_views_model_get_type (void) G_GNUC_CONST; |