aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/table/e-table-item.c74
-rw-r--r--widgets/table/e-table-memory-callbacks.c65
-rw-r--r--widgets/table/e-table-memory-callbacks.h19
-rw-r--r--widgets/table/e-table-memory-store.c59
-rw-r--r--widgets/table/e-table-memory-store.h11
-rw-r--r--widgets/table/e-table-memory.c36
-rw-r--r--widgets/table/e-table-memory.h20
-rw-r--r--widgets/table/e-table-model.c168
-rw-r--r--widgets/table/e-table-model.h25
-rw-r--r--widgets/table/e-table-one.c43
-rw-r--r--widgets/table/e-table-one.h20
-rw-r--r--widgets/table/e-table-simple.c32
-rw-r--r--widgets/table/e-table-simple.h11
-rw-r--r--widgets/table/e-tree-memory-callbacks.c2
-rw-r--r--widgets/table/e-tree-memory.c45
-rw-r--r--widgets/table/e-tree-memory.h20
-rw-r--r--widgets/table/e-tree-model.c175
-rw-r--r--widgets/table/e-tree-model.h17
-rw-r--r--widgets/table/e-tree-selection-model.c86
-rw-r--r--widgets/table/e-tree-simple.c11
-rw-r--r--widgets/table/e-tree-simple.h19
-rw-r--r--widgets/table/e-tree-sorted.c248
-rw-r--r--widgets/table/e-tree-sorted.h23
-rw-r--r--widgets/table/e-tree-table-adapter.c114
-rw-r--r--widgets/table/e-tree-table-adapter.h21
-rw-r--r--widgets/table/e-tree.c126
26 files changed, 623 insertions, 867 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index df2adedc01..afaf28586c 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -498,23 +498,23 @@ eti_remove_table_model (ETableItem *eti)
if (!eti->table_model)
return;
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_row_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_cell_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_rows_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
+ g_signal_handler_disconnect (G_OBJECT (eti->table_model),
eti->table_model_rows_deleted_id);
- gtk_object_unref (GTK_OBJECT (eti->table_model));
+ g_object_unref (G_OBJECT (eti->table_model));
if (eti->source_model)
- gtk_object_unref (GTK_OBJECT (eti->source_model));
+ g_object_unref (G_OBJECT (eti->source_model));
eti->table_model_pre_change_id = 0;
eti->table_model_no_change_id = 0;
@@ -999,7 +999,7 @@ eti_idle_show_cursor_cb (gpointer data)
eti_check_cursor_bounds (eti);
}
- gtk_object_unref (GTK_OBJECT (eti));
+ g_object_unref (G_OBJECT (eti));
return FALSE;
}
@@ -1008,7 +1008,7 @@ eti_idle_maybe_show_cursor(ETableItem *eti)
{
d(g_print ("%s: cursor on screen: %s\n", __FUNCTION__, eti->cursor_on_screen ? "TRUE" : "FALSE"));
if (eti->cursor_on_screen) {
- gtk_object_ref (GTK_OBJECT (eti));
+ g_object_ref (G_OBJECT (eti));
g_idle_add (eti_idle_show_cursor_cb, eti);
}
}
@@ -1237,35 +1237,35 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
g_assert (eti->table_model == NULL);
eti->table_model = table_model;
- gtk_object_ref (GTK_OBJECT (eti->table_model));
+ g_object_ref (G_OBJECT (eti->table_model));
- eti->table_model_pre_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_pre_change",
- GTK_SIGNAL_FUNC (eti_table_model_pre_change), eti);
+ eti->table_model_pre_change_id = g_signal_connect (
+ G_OBJECT (table_model), "model_pre_change",
+ G_CALLBACK (eti_table_model_pre_change), eti);
- eti->table_model_no_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_no_change",
- GTK_SIGNAL_FUNC (eti_table_model_no_change), eti);
+ eti->table_model_no_change_id = g_signal_connect (
+ G_OBJECT (table_model), "model_no_change",
+ G_CALLBACK (eti_table_model_no_change), eti);
- eti->table_model_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_changed",
- GTK_SIGNAL_FUNC (eti_table_model_changed), eti);
+ eti->table_model_change_id = g_signal_connect (
+ G_OBJECT (table_model), "model_changed",
+ G_CALLBACK (eti_table_model_changed), eti);
- eti->table_model_row_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_row_changed",
- GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti);
+ eti->table_model_row_change_id = g_signal_connect (
+ G_OBJECT (table_model), "model_row_changed",
+ G_CALLBACK (eti_table_model_row_changed), eti);
- eti->table_model_cell_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_cell_changed",
- GTK_SIGNAL_FUNC (eti_table_model_cell_changed), eti);
+ eti->table_model_cell_change_id = g_signal_connect (
+ G_OBJECT (table_model), "model_cell_changed",
+ G_CALLBACK (eti_table_model_cell_changed), eti);
- eti->table_model_rows_inserted_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_rows_inserted",
- GTK_SIGNAL_FUNC (eti_table_model_rows_inserted), eti);
+ eti->table_model_rows_inserted_id = g_signal_connect (
+ G_OBJECT (table_model), "model_rows_inserted",
+ G_CALLBACK (eti_table_model_rows_inserted), eti);
- eti->table_model_rows_deleted_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_rows_deleted",
- GTK_SIGNAL_FUNC (eti_table_model_rows_deleted), eti);
+ eti->table_model_rows_deleted_id = g_signal_connect (
+ G_OBJECT (table_model), "model_rows_deleted",
+ G_CALLBACK (eti_table_model_rows_deleted), eti);
if (eti->header) {
eti_detach_cell_views (eti);
@@ -1276,7 +1276,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
eti->uses_source_model = 1;
eti->source_model = E_TABLE_SUBSET(table_model)->source;
if (eti->source_model)
- gtk_object_ref(GTK_OBJECT(eti->source_model));
+ g_object_ref(G_OBJECT(eti->source_model));
}
eti_freeze (eti);
@@ -1290,7 +1290,7 @@ eti_add_selection_model (ETableItem *eti, ESelectionModel *selection)
g_assert (eti->selection == NULL);
eti->selection = selection;
- gtk_object_ref (GTK_OBJECT (eti->selection));
+ g_object_ref (G_OBJECT (eti->selection));
eti->selection_change_id = gtk_signal_connect (
GTK_OBJECT (selection), "selection_changed",
@@ -3527,7 +3527,7 @@ static void
e_table_item_printable_destroy (GtkObject *object,
ETableItemPrintContext *itemcontext)
{
- gtk_object_unref(GTK_OBJECT(itemcontext->item));
+ g_object_unref(G_OBJECT(itemcontext->item));
g_free(itemcontext);
}
@@ -3548,7 +3548,7 @@ e_table_item_get_printable (ETableItem *item)
itemcontext = g_new(ETableItemPrintContext, 1);
itemcontext->item = item;
- gtk_object_ref(GTK_OBJECT(item));
+ g_object_ref(G_OBJECT(item));
itemcontext->rows_printed = 0;
gtk_signal_connect (GTK_OBJECT(printable),
diff --git a/widgets/table/e-table-memory-callbacks.c b/widgets/table/e-table-memory-callbacks.c
index 3b804ab9cc..6cd1b9c8a1 100644
--- a/widgets/table/e-table-memory-callbacks.c
+++ b/widgets/table/e-table-memory-callbacks.c
@@ -23,13 +23,7 @@
#include <config.h>
#include "e-table-memory-callbacks.h"
-
-enum {
- ARG_0,
- ARG_APPEND_ROW
-};
-
-#define PARENT_TYPE e_table_memory_get_type ()
+#include "gal/util/e-util.h"
static int
etmc_column_count (ETableModel *etm)
@@ -137,39 +131,10 @@ etmc_append_row (ETableModel *etm, ETableModel *source, int row)
}
static void
-etmc_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (o);
-
- switch (arg_id){
- case ARG_APPEND_ROW:
- GTK_VALUE_POINTER(*arg) = (gpointer)etmc->append_row;
- break;
- }
-}
-
-static void
-etmc_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (o);
-
- switch (arg_id){
- case ARG_APPEND_ROW:
- etmc->append_row = (ETableMemoryCalbacksAppendRowFn)GTK_VALUE_POINTER(*arg);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- }
-}
-
-static void
-e_table_memory_callbacks_class_init (GtkObjectClass *object_class)
+e_table_memory_callbacks_class_init (GObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
- object_class->set_arg = etmc_set_arg;
- object_class->get_arg = etmc_get_arg;
-
model_class->column_count = etmc_column_count;
model_class->value_at = etmc_value_at;
model_class->set_value_at = etmc_set_value_at;
@@ -181,32 +146,10 @@ e_table_memory_callbacks_class_init (GtkObjectClass *object_class)
model_class->value_to_string = etmc_value_to_string;
model_class->append_row = etmc_append_row;
- gtk_object_add_arg_type ("ETableMemoryCalbacks::append_row", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_APPEND_ROW);
}
-GtkType
-e_table_memory_callbacks_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableMemoryCalbacks",
- sizeof (ETableMemoryCalbacks),
- sizeof (ETableMemoryCalbacksClass),
- (GtkClassInitFunc) e_table_memory_callbacks_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
+E_MAKE_TYPE(e_table_memory_callbacks, "ETableMemoryCalbacks", ETableMemoryCalbacks, e_table_memory_callbacks_class_init, NULL, E_TABLE_MEMORY_TYPE)
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
/**
* e_table_memory_callbacks_new:
@@ -248,7 +191,7 @@ e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col_count,
{
ETableMemoryCalbacks *et;
- et = gtk_type_new (e_table_memory_callbacks_get_type ());
+ et = g_object_new (E_TABLE_MEMORY_CALLBACKS_TYPE, NULL);
et->col_count = col_count;
et->value_at = value_at;
diff --git a/widgets/table/e-table-memory-callbacks.h b/widgets/table/e-table-memory-callbacks.h
index a90e3ab9bb..599ffa01f3 100644
--- a/widgets/table/e-table-memory-callbacks.h
+++ b/widgets/table/e-table-memory-callbacks.h
@@ -26,15 +26,14 @@
#include <gal/e-table/e-table-memory.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
#define E_TABLE_MEMORY_CALLBACKS_TYPE (e_table_memory_callbacks_get_type ())
-#define E_TABLE_MEMORY_CALLBACKS(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacks))
-#define E_TABLE_MEMORY_CALLBACKS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass))
-#define E_IS_TABLE_MEMORY_CALLBACKS(o) (GTK_CHECK_TYPE ((o), E_TABLE_MEMORY_CALLBACKS_TYPE))
-#define E_IS_TABLE_MEMORY_CALLBACKS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_CALLBACKS_TYPE))
+#define E_TABLE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacks))
+#define E_TABLE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass))
+#define E_IS_TABLE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_CALLBACKS_TYPE))
+#define E_IS_TABLE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_CALLBACKS_TYPE))
+#define E_TABLE_MEMORY_CALLBACKS_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass))
typedef int (*ETableMemoryCalbacksColumnCountFn) (ETableModel *etm, void *data);
typedef void (*ETableMemoryCalbacksAppendRowFn) (ETableModel *etm, ETableModel *model, int row, void *data);
@@ -71,7 +70,7 @@ typedef struct {
ETableMemoryClass parent_class;
} ETableMemoryCalbacksClass;
-GtkType e_table_memory_callbacks_get_type (void);
+GType e_table_memory_callbacks_get_type (void);
ETableModel *e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col_count,
@@ -86,9 +85,7 @@ ETableModel *e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col
ETableMemoryCalbacksValueToStringFn value_to_string,
void *data);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TABLE_MEMORY_CALLBACKS_H_ */
diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c
index 8f9e2ae688..128be8efd3 100644
--- a/widgets/table/e-table-memory-store.c
+++ b/widgets/table/e-table-memory-store.c
@@ -24,11 +24,12 @@
#include <config.h>
#include <string.h>
#include "e-table-memory-store.h"
-
-#define PARENT_TYPE e_table_memory_get_type ()
+#include "gal/util/e-util.h"
#define STORE_LOCATOR(etms, col, row) (*((etms)->priv->store + (row) * (etms)->priv->col_count + (col)))
+static ETableMemoryClass *parent_class;
+
struct _ETableMemoryStorePrivate {
int col_count;
ETableMemoryStoreColumnInfo *columns;
@@ -47,7 +48,7 @@ duplicate_value (ETableMemoryStore *etms, int col, const void *val)
return (void *) val;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (val)
- gtk_object_ref ((void *) val);
+ g_object_ref ((void *) val);
return (void *) val;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.duplicate_value)
@@ -72,7 +73,7 @@ free_value (ETableMemoryStore *etms, int col, void *value)
break;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (value)
- gtk_object_unref (value);
+ g_object_unref (value);
break;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.free_value)
@@ -219,6 +220,21 @@ etms_append_row (ETableModel *etm, ETableModel *source, int row)
}
static void
+etms_finalize (GObject *obj)
+{
+ ETableMemoryStore *etms = (ETableMemoryStore *) obj;
+
+ if (etms->priv) {
+ g_free (etms->priv->columns);
+ g_free (etms->priv->store);
+ g_free (etms->priv);
+ }
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
e_table_memory_store_init (ETableMemoryStore *etms)
{
etms->priv = g_new (ETableMemoryStorePrivate, 1);
@@ -229,10 +245,14 @@ e_table_memory_store_init (ETableMemoryStore *etms)
}
static void
-e_table_memory_store_class_init (GtkObjectClass *object_class)
+e_table_memory_store_class_init (GObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
+ parent_class = g_type_class_peek_parent (object_class);
+
+ object_class->finalize = etms_finalize;
+
model_class->column_count = etms_column_count;
model_class->value_at = etms_value_at;
model_class->set_value_at = etms_set_value_at;
@@ -245,28 +265,7 @@ e_table_memory_store_class_init (GtkObjectClass *object_class)
model_class->append_row = etms_append_row;
}
-GtkType
-e_table_memory_store_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableMemoryStore",
- sizeof (ETableMemoryStore),
- sizeof (ETableMemoryStoreClass),
- (GtkClassInitFunc) e_table_memory_store_class_init,
- (GtkObjectInitFunc) e_table_memory_store_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(e_table_memory_store, "ETableMemoryStore", ETableMemoryStore, e_table_memory_store_class_init, e_table_memory_store_init, E_TABLE_MEMORY_TYPE)
/**
* e_table_memory_store_new:
@@ -297,14 +296,12 @@ e_table_memory_store_get_type (void)
ETableModel *
e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns)
{
- ETableMemoryStore *et;
-
- et = gtk_type_new (e_table_memory_store_get_type ());
+ ETableMemoryStore *et = g_object_new (E_TABLE_MEMORY_STORE_TYPE, NULL);
if (e_table_memory_store_construct (et, columns)) {
return (ETableModel *) et;
} else {
- gtk_object_unref (GTK_OBJECT (et));
+ g_object_unref (G_OBJECT (et));
return NULL;
}
}
diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h
index 5368b39417..c4d312288b 100644
--- a/widgets/table/e-table-memory-store.h
+++ b/widgets/table/e-table-memory-store.h
@@ -30,10 +30,11 @@
G_BEGIN_DECLS
#define E_TABLE_MEMORY_STORE_TYPE (e_table_memory_store_get_type ())
-#define E_TABLE_MEMORY_STORE(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore))
-#define E_TABLE_MEMORY_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass))
-#define E_IS_TABLE_MEMORY_STORE(o) (GTK_CHECK_TYPE ((o), E_TABLE_MEMORY_STORE_TYPE))
-#define E_IS_TABLE_MEMORY_STORE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_STORE_TYPE))
+#define E_TABLE_MEMORY_STORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore))
+#define E_TABLE_MEMORY_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass))
+#define E_IS_TABLE_MEMORY_STORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_STORE_TYPE))
+#define E_IS_TABLE_MEMORY_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_STORE_TYPE))
+#define E_TABLE_MEMORY_STORE_GET_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass))
typedef enum {
E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR,
@@ -82,7 +83,7 @@ typedef struct {
ETableMemoryClass parent_class;
} ETableMemoryStoreClass;
-GtkType e_table_memory_store_get_type (void);
+GType e_table_memory_store_get_type (void);
/* Object Creation */
ETableModel *e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns);
diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c
index 0e53c80b09..7d9958bbd6 100644
--- a/widgets/table/e-table-memory.c
+++ b/widgets/table/e-table-memory.c
@@ -31,7 +31,6 @@
#include <unistd.h>
#include <fcntl.h>
-#include <gtk/gtksignal.h>
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
@@ -39,8 +38,6 @@
#include "gal/util/e-xml-utils.h"
#include <string.h>
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-
static ETableModel *parent_class;
struct ETableMemoryPriv {
@@ -53,7 +50,7 @@ struct ETableMemoryPriv {
/* virtual methods */
static void
-etmm_destroy (GtkObject *object)
+etmm_finalize (GObject *object)
{
ETableMemory *etmm = E_TABLE_MEMORY (object);
ETableMemoryPriv *priv = etmm->priv;
@@ -65,7 +62,7 @@ etmm_destroy (GtkObject *object)
}
etmm->priv = NULL;
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static int
@@ -78,19 +75,19 @@ etmm_row_count (ETableModel *etm)
static void
-e_table_memory_class_init (GtkObjectClass *klass)
+e_table_memory_class_init (GObjectClass *klass)
{
ETableModelClass *table_class = (ETableModelClass *) klass;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
- klass->destroy = etmm_destroy;
+ klass->finalize = etmm_finalize;
table_class->row_count = etmm_row_count;
}
static void
-e_table_memory_init (GtkObject *object)
+e_table_memory_init (GObject *object)
{
ETableMemory *etmm = (ETableMemory *)object;
@@ -104,22 +101,11 @@ e_table_memory_init (GtkObject *object)
priv->frozen = 0;
}
-E_MAKE_TYPE(e_table_memory, "ETableMemory", ETableMemory, e_table_memory_class_init, e_table_memory_init, PARENT_TYPE)
+E_MAKE_TYPE(e_table_memory, "ETableMemory", ETableMemory, e_table_memory_class_init, e_table_memory_init, E_TABLE_MODEL_TYPE)
/**
- * e_table_memory_construct:
- * @etable:
- *
- *
- **/
-void
-e_table_memory_construct (ETableMemory *etmm)
-{
-}
-
-/**
* e_table_memory_new
*
* XXX docs here.
@@ -129,13 +115,7 @@ e_table_memory_construct (ETableMemory *etmm)
ETableMemory *
e_table_memory_new (void)
{
- ETableMemory *etmm;
-
- etmm = gtk_type_new (e_table_memory_get_type ());
-
- e_table_memory_construct(etmm);
-
- return etmm;
+ return g_object_new (E_TABLE_MEMORY_TYPE, NULL);
}
/**
diff --git a/widgets/table/e-table-memory.h b/widgets/table/e-table-memory.h
index a251f0dc0b..c1b3cd45f8 100644
--- a/widgets/table/e-table-memory.h
+++ b/widgets/table/e-table-memory.h
@@ -27,16 +27,14 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gal/e-table/e-table-model.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
#define E_TABLE_MEMORY_TYPE (e_table_memory_get_type ())
-#define E_TABLE_MEMORY(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_TYPE, ETableMemory))
-#define E_TABLE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_TYPE, ETableMemoryClass))
-#define E_IS_TABLE_MEMORY(o) (GTK_CHECK_TYPE ((o), E_TABLE_MEMORY_TYPE))
-#define E_IS_TABLE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_TYPE))
+#define E_TABLE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_TYPE, ETableMemory))
+#define E_TABLE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_TYPE, ETableMemoryClass))
+#define E_IS_TABLE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_TYPE))
+#define E_IS_TABLE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_TYPE))
+#define E_TABLE_MEMORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_MEMORY_TYPE, ETableMemoryClass))
typedef struct ETableMemory ETableMemory;
typedef struct ETableMemoryPriv ETableMemoryPriv;
@@ -52,7 +50,7 @@ struct ETableMemoryClass {
};
-GtkType e_table_memory_get_type (void);
+GType e_table_memory_get_type (void);
void e_table_memory_construct (ETableMemory *etable);
ETableMemory *e_table_memory_new (void);
@@ -73,8 +71,6 @@ void e_table_memory_set_data (ETableMemory *etm,
int row,
gpointer data);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TABLE_MEMORY_H */
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c
index 93d8cfece8..dddcace5be 100644
--- a/widgets/table/e-table-model.c
+++ b/widgets/table/e-table-model.c
@@ -22,20 +22,19 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
+#include <glib-object.h>
#include "e-table-model.h"
#include "gal/util/e-util.h"
+#include "gal/util/e-marshal.h"
-#define ETM_CLASS(e) ((ETableModelClass *)(GTK_OBJECT_GET_CLASS (e)))
-
-#define PARENT_TYPE gtk_object_get_type ()
+#define ETM_CLASS(e) (E_TABLE_MODEL_GET_CLASS (e))
#define d(x)
d(static gint depth = 0;)
-static GtkObjectClass *e_table_model_parent_class;
+static GObjectClass *e_table_model_parent_class;
enum {
MODEL_NO_CHANGE,
@@ -265,78 +264,83 @@ e_table_model_value_to_string (ETableModel *e_table_model, int col, const void *
}
static void
-e_table_model_destroy (GtkObject *object)
+e_table_model_finalize (GObject *object)
{
- if (e_table_model_parent_class->destroy)
- (*e_table_model_parent_class->destroy)(object);
+ if (e_table_model_parent_class->finalize)
+ (*e_table_model_parent_class->finalize)(object);
}
static void
-e_table_model_class_init (GtkObjectClass *object_class)
+e_table_model_class_init (GObjectClass *object_class)
{
ETableModelClass *klass = E_TABLE_MODEL_CLASS(object_class);
- e_table_model_parent_class = gtk_type_class (PARENT_TYPE);
+ e_table_model_parent_class = g_type_class_peek_parent (object_class);
- object_class->destroy = e_table_model_destroy;
+ object_class->finalize = e_table_model_finalize;
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);
+ g_signal_new ("model_no_change",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_no_change),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
e_table_model_signals [MODEL_CHANGED] =
- gtk_signal_new ("model_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("model_changed",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_changed),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
e_table_model_signals [MODEL_PRE_CHANGE] =
- gtk_signal_new ("model_pre_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_pre_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("model_pre_change",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_pre_change),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
e_table_model_signals [MODEL_ROW_CHANGED] =
- gtk_signal_new ("model_row_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_row_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+ g_signal_new ("model_row_changed",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_row_changed),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
e_table_model_signals [MODEL_CELL_CHANGED] =
- gtk_signal_new ("model_cell_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_cell_changed),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
+ g_signal_new ("model_cell_changed",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_cell_changed),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
e_table_model_signals [MODEL_ROWS_INSERTED] =
- gtk_signal_new ("model_rows_inserted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_rows_inserted),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
+ g_signal_new ("model_rows_inserted",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
e_table_model_signals [MODEL_ROWS_DELETED] =
- gtk_signal_new ("model_rows_deleted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_rows_deleted),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_table_model_signals, LAST_SIGNAL);
+ g_signal_new ("model_rows_deleted",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
klass->column_count = NULL;
klass->row_count = NULL;
@@ -365,31 +369,7 @@ e_table_model_class_init (GtkObjectClass *object_class)
klass->model_rows_deleted = NULL;
}
-
-GtkType
-e_table_model_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "ETableModel",
- sizeof (ETableModel),
- sizeof (ETableModelClass),
- (GtkClassInitFunc) e_table_model_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(e_table_model, "ETableModel", ETableModel, e_table_model_class_init, NULL, G_TYPE_OBJECT)
#if d(!)0
static void
@@ -410,8 +390,8 @@ e_table_model_pre_change (ETableModel *e_table_model)
d(print_tabs());
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]);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_PRE_CHANGE], 0);
d(depth--);
}
@@ -437,8 +417,8 @@ e_table_model_no_change (ETableModel *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]);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_NO_CHANGE], 0);
d(depth--);
}
@@ -464,8 +444,8 @@ e_table_model_changed (ETableModel *e_table_model)
d(print_tabs());
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]);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_CHANGED], 0);
d(depth--);
}
@@ -488,8 +468,8 @@ e_table_model_row_changed (ETableModel *e_table_model, int row)
d(print_tabs());
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);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_ROW_CHANGED], 0, row);
d(depth--);
}
@@ -513,8 +493,8 @@ e_table_model_cell_changed (ETableModel *e_table_model, int col, int row)
d(print_tabs());
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);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_CELL_CHANGED], 0, col, row);
d(depth--);
}
@@ -538,8 +518,8 @@ e_table_model_rows_inserted (ETableModel *e_table_model, int row, int count)
d(print_tabs());
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);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_ROWS_INSERTED], 0, row, count);
d(depth--);
}
@@ -578,8 +558,8 @@ e_table_model_rows_deleted (ETableModel *e_table_model, int row, int count)
d(print_tabs());
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);
+ g_signal_emit (G_OBJECT (e_table_model),
+ e_table_model_signals [MODEL_ROWS_DELETED], 0, row, count);
d(depth--);
}
diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h
index 45731added..6244fa2e7a 100644
--- a/widgets/table/e-table-model.h
+++ b/widgets/table/e-table-model.h
@@ -24,24 +24,23 @@
#ifndef _E_TABLE_MODEL_H_
#define _E_TABLE_MODEL_H_
-#include <gtk/gtkobject.h>
+#include <glib-object.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
#define E_TABLE_MODEL_TYPE (e_table_model_get_type ())
-#define E_TABLE_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel))
-#define E_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass))
-#define E_IS_TABLE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_MODEL_TYPE))
-#define E_IS_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE))
+#define E_TABLE_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel))
+#define E_TABLE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass))
+#define E_IS_TABLE_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MODEL_TYPE))
+#define E_IS_TABLE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE))
+#define E_TABLE_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_MODEL_TYPE, ETableModelClass))
typedef struct {
- GtkObject base;
+ GObject base;
} ETableModel;
typedef struct {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/*
* Virtual methods
@@ -94,7 +93,7 @@ typedef struct {
void (*model_rows_deleted) (ETableModel *etm, int row, int count);
} ETableModelClass;
-GtkType e_table_model_get_type (void);
+GType e_table_model_get_type (void);
/**/
int e_table_model_column_count (ETableModel *e_table_model);
@@ -166,8 +165,6 @@ int row);
void e_table_model_row_deleted (ETableModel *e_table_model,
int row);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TABLE_MODEL_H_ */
diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c
index 15193c46d3..e25b13c263 100644
--- a/widgets/table/e-table-one.c
+++ b/widgets/table/e-table-one.c
@@ -23,8 +23,7 @@
#include <config.h>
#include "e-table-one.h"
-
-#define PARENT_TYPE e_table_model_get_type ()
+#include "gal/util/e-util.h"
static ETableModelClass *parent_class = NULL;
@@ -158,19 +157,18 @@ one_dispose (GObject *object)
ETableOne *one = E_TABLE_ONE (object);
if (one->source)
- gtk_object_unref(GTK_OBJECT(one->source));
+ g_object_unref(G_OBJECT(one->source));
one->source = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-e_table_one_class_init (GtkObjectClass *object_class)
+e_table_one_class_init (GObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
- GObjectClass *gobject_class = (GObjectClass *) object_class;
- parent_class = gtk_type_class (E_TABLE_MODEL_TYPE);
+ parent_class = g_type_class_peek_parent (object_class);
model_class->column_count = one_column_count;
model_class->row_count = one_row_count;
@@ -183,12 +181,12 @@ e_table_one_class_init (GtkObjectClass *object_class)
model_class->value_is_empty = one_value_is_empty;
model_class->value_to_string = one_value_to_string;
- gobject_class->dispose = one_dispose;
- gobject_class->finalize = one_finalize;
+ object_class->dispose = one_dispose;
+ object_class->finalize = one_finalize;
}
static void
-e_table_one_init (GtkObject *object)
+e_table_one_init (GObject *object)
{
ETableOne *one = E_TABLE_ONE(object);
@@ -196,28 +194,8 @@ e_table_one_init (GtkObject *object)
one->data = NULL;
}
-GtkType
-e_table_one_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableOne",
- sizeof (ETableOne),
- sizeof (ETableOneClass),
- (GtkClassInitFunc) e_table_one_class_init,
- (GtkObjectInitFunc) e_table_one_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
+E_MAKE_TYPE(e_table_one, "ETableOne", ETableOne, e_table_one_class_init, e_table_one_init, E_TABLE_MODEL_TYPE)
- return type;
-}
ETableModel *
e_table_one_new (ETableModel *source)
@@ -226,8 +204,7 @@ e_table_one_new (ETableModel *source)
int col_count;
int i;
- eto = gtk_type_new (e_table_one_get_type ());
-
+ eto = g_object_new (E_TABLE_ONE_TYPE, NULL);
eto->source = source;
col_count = e_table_model_column_count(source);
@@ -237,7 +214,7 @@ e_table_one_new (ETableModel *source)
}
if (source)
- gtk_object_ref(GTK_OBJECT(source));
+ g_object_ref(G_OBJECT(source));
return (ETableModel *) eto;
}
diff --git a/widgets/table/e-table-one.h b/widgets/table/e-table-one.h
index 40dedba16d..0835ba930c 100644
--- a/widgets/table/e-table-one.h
+++ b/widgets/table/e-table-one.h
@@ -26,16 +26,14 @@
#include <gal/e-table/e-table-model.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
#define E_TABLE_ONE_TYPE (e_table_one_get_type ())
-#define E_TABLE_ONE(o) (GTK_CHECK_CAST ((o), E_TABLE_ONE_TYPE, ETableOne))
-#define E_TABLE_ONE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ONE_TYPE, ETableOneClass))
-#define E_IS_TABLE_ONE(o) (GTK_CHECK_TYPE ((o), E_TABLE_ONE_TYPE))
-#define E_IS_TABLE_ONE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ONE_TYPE))
+#define E_TABLE_ONE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_ONE_TYPE, ETableOne))
+#define E_TABLE_ONE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_ONE_TYPE, ETableOneClass))
+#define E_IS_TABLE_ONE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_ONE_TYPE))
+#define E_IS_TABLE_ONE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_ONE_TYPE))
+#define E_TABLE_ONE_GET_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), E_TABLE_ONE_TYPE, ETableOneClass))
typedef struct {
ETableModel parent;
@@ -48,14 +46,12 @@ typedef struct {
ETableModelClass parent_class;
} ETableOneClass;
-GtkType e_table_one_get_type (void);
+GType e_table_one_get_type (void);
ETableModel *e_table_one_new (ETableModel *source);
void e_table_one_commit (ETableOne *one);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TABLE_ONE_H_ */
diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c
index c8a7d4fe16..b7cf8f66be 100644
--- a/widgets/table/e-table-simple.c
+++ b/widgets/table/e-table-simple.c
@@ -24,8 +24,7 @@
#include <config.h>
#include "e-table-simple.h"
-
-#define PARENT_TYPE e_table_model_get_type ()
+#include "gal/util/e-util.h"
static int
simple_column_count (ETableModel *etm)
@@ -166,7 +165,7 @@ simple_value_to_string (ETableModel *etm, int col, const void *value)
}
static void
-e_table_simple_class_init (GtkObjectClass *object_class)
+e_table_simple_class_init (GObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
@@ -188,28 +187,7 @@ e_table_simple_class_init (GtkObjectClass *object_class)
model_class->value_to_string = simple_value_to_string;
}
-GtkType
-e_table_simple_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableSimple",
- sizeof (ETableSimple),
- sizeof (ETableSimpleClass),
- (GtkClassInitFunc) e_table_simple_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(e_table_simple, "ETableSimple", ETableSimple, e_table_simple_class_init, NULL, E_TABLE_MODEL_TYPE)
/**
* e_table_simple_new:
@@ -257,9 +235,7 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count,
ETableSimpleValueToStringFn value_to_string,
void *data)
{
- ETableSimple *et;
-
- et = gtk_type_new (e_table_simple_get_type ());
+ ETableSimple *et = g_object_new (E_TABLE_SIMPLE_TYPE, NULL);
et->col_count = col_count;
et->row_count = row_count;
diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h
index 36ffa02de9..39800c3118 100644
--- a/widgets/table/e-table-simple.h
+++ b/widgets/table/e-table-simple.h
@@ -30,10 +30,11 @@
G_BEGIN_DECLS
#define E_TABLE_SIMPLE_TYPE (e_table_simple_get_type ())
-#define E_TABLE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple))
-#define E_TABLE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SIMPLE_TYPE, ETableSimpleClass))
-#define E_IS_TABLE_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SIMPLE_TYPE))
-#define E_IS_TABLE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SIMPLE_TYPE))
+#define E_TABLE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple))
+#define E_TABLE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SIMPLE_TYPE, ETableSimpleClass))
+#define E_IS_TABLE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SIMPLE_TYPE))
+#define E_IS_TABLE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SIMPLE_TYPE))
+#define E_TABLE_SIMPLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SIMPLE_TYPE, ETableSimpleClass))
typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
@@ -78,7 +79,7 @@ typedef struct {
ETableModelClass parent_class;
} ETableSimpleClass;
-GtkType e_table_simple_get_type (void);
+GType e_table_simple_get_type (void);
ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count,
ETableSimpleRowCountFn row_count,
ETableSimpleAppendRowFn append_row,
diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c
index bce925b335..b6fe3fc375 100644
--- a/widgets/table/e-tree-memory-callbacks.c
+++ b/widgets/table/e-tree-memory-callbacks.c
@@ -246,7 +246,7 @@ e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at,
{
ETreeMemoryCallbacks *etmc;
- etmc = gtk_type_new (e_tree_memory_callbacks_get_type ());
+ etmc = g_object_new (E_TREE_MEMORY_CALLBACKS_TYPE, NULL);
etmc->icon_at = icon_at;
diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c
index f8898903d6..5c37e939c8 100644
--- a/widgets/table/e-tree-memory.c
+++ b/widgets/table/e-tree-memory.c
@@ -33,13 +33,10 @@
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
-#include <gtk/gtksignal.h>
#include "gal/util/e-util.h"
#include "gal/util/e-xml-utils.h"
#include "e-tree-memory.h"
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
#define TREEPATH_CHUNK_AREA_SIZE (30 * sizeof (ETreeMemoryPath))
static ETreeModelClass *parent_class;
@@ -85,8 +82,7 @@ check_children (ETreeMemory *memory, ETreePath node)
{
ETreeMemoryPath *path = node;
if (!path->children_computed) {
- gtk_signal_emit (GTK_OBJECT (memory),
- signals[FILL_IN_CHILDREN], node);
+ g_signal_emit (G_OBJECT (memory), signals[FILL_IN_CHILDREN], 0, node);
path->children_computed = TRUE;
}
}
@@ -214,7 +210,7 @@ e_tree_memory_thaw(ETreeMemory *etmm)
/* virtual methods */
static void
-etmm_destroy (GtkObject *object)
+etmm_finalize (GObject *object)
{
ETreeMemory *etmm = E_TREE_MEMORY (object);
ETreeMemoryPriv *priv = etmm->priv;
@@ -229,7 +225,7 @@ etmm_destroy (GtkObject *object)
}
etmm->priv = NULL;
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static ETreePath
@@ -356,24 +352,23 @@ etmm_node_request_collapse (ETreeModel *etm, ETreePath node)
static void
e_tree_memory_class_init (ETreeMemoryClass *klass)
{
- ETreeModelClass *tree_class = (ETreeModelClass *) klass;
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ ETreeModelClass *tree_class = (ETreeModelClass *) klass;
+ GObjectClass *object_class = (GObjectClass *) klass;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
node_chunk = g_mem_chunk_create (ETreeMemoryPath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE);
signals [FILL_IN_CHILDREN] =
- gtk_signal_new ("fill_in_children",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeMemoryClass, fill_in_children),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, LAST_SIGNAL);
+ g_signal_new ("fill_in_children",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeMemoryClass, fill_in_children),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
- object_class->destroy = etmm_destroy;
+ object_class->finalize = etmm_finalize;
tree_class->get_root = etmm_get_root;
tree_class->get_prev = etmm_get_prev;
@@ -394,7 +389,7 @@ e_tree_memory_class_init (ETreeMemoryClass *klass)
}
static void
-e_tree_memory_init (GtkObject *object)
+e_tree_memory_init (GObject *object)
{
ETreeMemory *etmm = (ETreeMemory *)object;
@@ -410,7 +405,7 @@ e_tree_memory_init (GtkObject *object)
priv->destroy_user_data = NULL;
}
-E_MAKE_TYPE(e_tree_memory, "ETreeMemory", ETreeMemory, e_tree_memory_class_init, e_tree_memory_init, PARENT_TYPE)
+E_MAKE_TYPE(e_tree_memory, "ETreeMemory", ETreeMemory, e_tree_memory_class_init, e_tree_memory_init, E_TREE_MODEL_TYPE)
@@ -435,13 +430,7 @@ e_tree_memory_construct (ETreeMemory *etmm)
ETreeMemory *
e_tree_memory_new (void)
{
- ETreeMemory *etmm;
-
- etmm = gtk_type_new (e_tree_memory_get_type ());
-
- e_tree_memory_construct(etmm);
-
- return etmm;
+ return (ETreeMemory *) g_object_new (E_TREE_MEMORY_TYPE, NULL);
}
void
diff --git a/widgets/table/e-tree-memory.h b/widgets/table/e-tree-memory.h
index bd43c97fde..ce0003b60a 100644
--- a/widgets/table/e-tree-memory.h
+++ b/widgets/table/e-tree-memory.h
@@ -28,16 +28,14 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gal/e-table/e-tree-model.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
#define E_TREE_MEMORY_TYPE (e_tree_memory_get_type ())
-#define E_TREE_MEMORY(o) (GTK_CHECK_CAST ((o), E_TREE_MEMORY_TYPE, ETreeMemory))
-#define E_TREE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MEMORY_TYPE, ETreeMemoryClass))
-#define E_IS_TREE_MEMORY(o) (GTK_CHECK_TYPE ((o), E_TREE_MEMORY_TYPE))
-#define E_IS_TREE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_TYPE))
+#define E_TREE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MEMORY_TYPE, ETreeMemory))
+#define E_TREE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MEMORY_TYPE, ETreeMemoryClass))
+#define E_IS_TREE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MEMORY_TYPE))
+#define E_IS_TREE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_TYPE))
+#define E_TREE_MEMORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_MEMORY_TYPE, ETreeMemoryClass))
typedef struct ETreeMemory ETreeMemory;
typedef struct ETreeMemoryPriv ETreeMemoryPriv;
@@ -58,7 +56,7 @@ struct ETreeMemoryClass {
};
-GtkType e_tree_memory_get_type (void);
+GType e_tree_memory_get_type (void);
void e_tree_memory_construct (ETreeMemory *etree);
ETreeMemory *e_tree_memory_new (void);
@@ -97,9 +95,7 @@ void e_tree_memory_set_node_destroy_func (ETreeMemory *etmm
GFunc destroy_func,
gpointer user_data);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TREE_MEMORY_H */
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index 89de484496..242d5b4269 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -38,13 +38,11 @@
#include "gal/util/e-xml-utils.h"
#include "e-tree-model.h"
-#define ETM_CLASS(e) ((ETreeModelClass *)(GTK_OBJECT_GET_CLASS(e)))
-
-#define PARENT_TYPE (gtk_object_get_type())
+#define ETM_CLASS(e) (E_TREE_MODEL_GET_CLASS(e))
#define d(x)
-static GtkObjectClass *parent_class;
+static GObjectClass *parent_class;
enum {
PRE_CHANGE,
@@ -63,85 +61,92 @@ static guint e_tree_model_signals [LAST_SIGNAL] = {0, };
static void
-e_tree_model_class_init (GtkObjectClass *klass)
+e_tree_model_class_init (GObjectClass *klass)
{
ETreeModelClass *tree_class = (ETreeModelClass *) klass;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
e_tree_model_signals [PRE_CHANGE] =
- gtk_signal_new ("pre_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, pre_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("pre_change",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, pre_change),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
e_tree_model_signals [NO_CHANGE] =
- gtk_signal_new ("no_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, no_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("no_change",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, no_change),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
e_tree_model_signals [NODE_CHANGED] =
- gtk_signal_new ("node_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+ g_signal_new ("node_changed",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_changed),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
e_tree_model_signals [NODE_DATA_CHANGED] =
- gtk_signal_new ("node_data_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_data_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+ g_signal_new ("node_data_changed",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_data_changed),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
e_tree_model_signals [NODE_COL_CHANGED] =
- gtk_signal_new ("node_col_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_col_changed),
- e_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
+ g_signal_new ("node_col_changed",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_col_changed),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__POINTER_INT,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
e_tree_model_signals [NODE_INSERTED] =
- gtk_signal_new ("node_inserted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_inserted),
- e_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER);
+ g_signal_new ("node_inserted",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_inserted),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__POINTER_POINTER,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
e_tree_model_signals [NODE_REMOVED] =
- gtk_signal_new ("node_removed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_removed),
- e_marshal_NONE__POINTER_POINTER_INT,
- GTK_TYPE_NONE, 3, GTK_TYPE_POINTER, GTK_TYPE_POINTER, GTK_TYPE_INT);
+ g_signal_new ("node_removed",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_removed),
+ (GSignalAccumulator) NULL, NULL,
+ e_marshal_VOID__POINTER_POINTER_INT,
+ G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_INT);
e_tree_model_signals [NODE_DELETED] =
- gtk_signal_new ("node_deleted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_deleted),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+ g_signal_new ("node_deleted",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_deleted),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
e_tree_model_signals [NODE_REQUEST_COLLAPSE] =
- gtk_signal_new ("node_request_collapse",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_request_collapse),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (klass, e_tree_model_signals, LAST_SIGNAL);
+ g_signal_new ("node_request_collapse",
+ E_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeModelClass, node_request_collapse),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
tree_class->get_root = NULL;
@@ -189,12 +194,7 @@ e_tree_model_class_init (GtkObjectClass *klass)
tree_class->node_request_collapse = NULL;
}
-static void
-e_tree_init (GtkObject *object)
-{
-}
-
-E_MAKE_TYPE(e_tree_model, "ETreeModel", ETreeModel, e_tree_model_class_init, e_tree_init, PARENT_TYPE)
+E_MAKE_TYPE(e_tree_model, "ETreeModel", ETreeModel, e_tree_model_class_init, NULL, G_TYPE_OBJECT)
/* signals */
@@ -216,8 +216,7 @@ e_tree_model_pre_change (ETreeModel *tree_model)
d(g_print("Emitting pre_change on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [PRE_CHANGE]);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [PRE_CHANGE], 0);
}
/**
@@ -237,8 +236,7 @@ e_tree_model_no_change (ETreeModel *tree_model)
d(g_print("Emitting no_change on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NO_CHANGE]);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NO_CHANGE], 0);
}
/**
@@ -258,8 +256,7 @@ e_tree_model_node_changed (ETreeModel *tree_model, ETreePath node)
d(g_print("Emitting node_changed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_CHANGED], node);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_CHANGED], 0, node);
}
/**
@@ -279,8 +276,7 @@ e_tree_model_node_data_changed (ETreeModel *tree_model, ETreePath node)
d(g_print("Emitting node_data_changed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_DATA_CHANGED], node);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_DATA_CHANGED], 0, node);
}
/**
@@ -300,8 +296,7 @@ e_tree_model_node_col_changed (ETreeModel *tree_model, ETreePath node, int col)
d(g_print("Emitting node_col_changed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_COL_CHANGED], node, col);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_COL_CHANGED], 0, node, col);
}
/**
@@ -322,9 +317,8 @@ e_tree_model_node_inserted (ETreeModel *tree_model,
d(g_print("Emitting node_inserted on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_INSERTED],
- parent_node, inserted_node);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_INSERTED], 0,
+ parent_node, inserted_node);
}
/**
@@ -343,9 +337,8 @@ e_tree_model_node_removed (ETreeModel *tree_model, ETreePath parent_node, ETree
d(g_print("Emitting node_removed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_REMOVED],
- parent_node, removed_node, old_position);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_REMOVED], 0,
+ parent_node, removed_node, old_position);
}
/**
@@ -363,9 +356,7 @@ e_tree_model_node_deleted (ETreeModel *tree_model, ETreePath deleted_node)
d(g_print("Emitting node_deleted on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_DELETED],
- deleted_node);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_DELETED], 0, deleted_node);
}
/**
@@ -383,9 +374,7 @@ e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath collapsed
d(g_print("Emitting node_request_collapse on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_REQUEST_COLLAPSE],
- collapsed_node);
+ g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_REQUEST_COLLAPSE], 0, collapsed_node);
}
@@ -400,11 +389,7 @@ e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath collapsed
ETreeModel *
e_tree_model_new ()
{
- ETreeModel *et;
-
- et = gtk_type_new (e_tree_model_get_type ());
-
- return et;
+ return (ETreeModel *) g_object_new (E_TREE_MODEL_TYPE, NULL);
}
/**
diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h
index dac0f85505..c9574388e1 100644
--- a/widgets/table/e-tree-model.h
+++ b/widgets/table/e-tree-model.h
@@ -26,17 +26,18 @@
#define _E_TREE_MODEL_H_
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtkobject.h>
+#include <glib-object.h>
G_BEGIN_DECLS
#define E_TREE_MODEL_TYPE (e_tree_model_get_type ())
-#define E_TREE_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel))
-#define E_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass))
-#define E_IS_TREE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TREE_MODEL_TYPE))
-#define E_IS_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE))
+#define E_TREE_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel))
+#define E_TREE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass))
+#define E_IS_TREE_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MODEL_TYPE))
+#define E_IS_TREE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE))
+#define E_TREE_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_MODEL_TYPE, ETreeModelClass))
typedef void * ETreePath;
typedef struct ETreeModel ETreeModel;
@@ -45,11 +46,11 @@ typedef gint (*ETreePathCompareFunc)(ETreeModel *model, ETreePath path1, ETreePa
typedef gboolean (*ETreePathFunc)(ETreeModel *model, ETreePath path, gpointer data);
struct ETreeModel {
- GtkObject base;
+ GObject base;
};
struct ETreeModelClass {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/*
* Virtual methods
@@ -118,7 +119,7 @@ struct ETreeModelClass {
};
-GtkType e_tree_model_get_type (void);
+GType e_tree_model_get_type (void);
ETreeModel *e_tree_model_new (void);
/* tree traversal operations */
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index dc1a4610d1..f922603f05 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -128,9 +128,9 @@ e_tree_selection_model_node_free(ETreeSelectionModelNode *node)
int i;
if (node->all_children_selected_array)
- gtk_object_unref(GTK_OBJECT(node->all_children_selected_array));
+ g_object_unref(node->all_children_selected_array);
if (node->any_children_selected_array)
- gtk_object_unref(GTK_OBJECT(node->any_children_selected_array));
+ g_object_unref(node->any_children_selected_array);
for (i = 0; i < node->num_children; i++)
if (node->children[i])
@@ -537,23 +537,23 @@ add_model(ETreeSelectionModel *etsm, ETreeModel *model)
if (!priv->model)
return;
- gtk_object_ref(GTK_OBJECT(priv->model));
- priv->tree_model_pre_change_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "pre_change",
- GTK_SIGNAL_FUNC (etsm_pre_change), etsm);
- priv->tree_model_no_change_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "no_change",
- GTK_SIGNAL_FUNC (etsm_no_change), etsm);
- priv->tree_model_node_changed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_changed",
- GTK_SIGNAL_FUNC (etsm_node_changed), etsm);
- priv->tree_model_node_data_changed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_data_changed",
- GTK_SIGNAL_FUNC (etsm_node_data_changed), etsm);
- priv->tree_model_node_col_changed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_col_changed",
- GTK_SIGNAL_FUNC (etsm_node_col_changed), etsm);
- priv->tree_model_node_inserted_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_inserted",
- GTK_SIGNAL_FUNC (etsm_node_inserted), etsm);
- priv->tree_model_node_removed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_removed",
- GTK_SIGNAL_FUNC (etsm_node_removed), etsm);
- priv->tree_model_node_deleted_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_deleted",
- GTK_SIGNAL_FUNC (etsm_node_deleted), etsm);
+ g_object_ref(priv->model);
+ priv->tree_model_pre_change_id = g_signal_connect_after (G_OBJECT (priv->model), "pre_change",
+ G_CALLBACK (etsm_pre_change), etsm);
+ priv->tree_model_no_change_id = g_signal_connect_after (G_OBJECT (priv->model), "no_change",
+ G_CALLBACK (etsm_no_change), etsm);
+ priv->tree_model_node_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_changed",
+ G_CALLBACK (etsm_node_changed), etsm);
+ priv->tree_model_node_data_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_data_changed",
+ G_CALLBACK (etsm_node_data_changed), etsm);
+ priv->tree_model_node_col_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_col_changed",
+ G_CALLBACK (etsm_node_col_changed), etsm);
+ priv->tree_model_node_inserted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_inserted",
+ G_CALLBACK (etsm_node_inserted), etsm);
+ priv->tree_model_node_removed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_removed",
+ G_CALLBACK (etsm_node_removed), etsm);
+ priv->tree_model_node_deleted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_deleted",
+ G_CALLBACK (etsm_node_deleted), etsm);
}
static void
@@ -564,24 +564,24 @@ drop_model(ETreeSelectionModel *etsm)
if (!priv->model)
return;
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_data_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_col_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_removed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_deleted_id);
-
- gtk_object_unref (GTK_OBJECT (priv->model));
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_pre_change_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_no_change_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_node_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_node_data_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_node_col_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_node_inserted_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_node_removed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->model),
+ priv->tree_model_node_deleted_id);
+
+ g_object_unref (priv->model);
priv->model = NULL;
priv->tree_model_pre_change_id = 0;
@@ -605,9 +605,9 @@ add_ets(ETreeSelectionModel *etsm, ETreeSorted *ets)
if (!priv->ets)
return;
- gtk_object_ref(GTK_OBJECT(priv->ets));
- priv->sorted_model_node_resorted_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_resorted",
- GTK_SIGNAL_FUNC (etsm_sorted_node_resorted), etsm);
+ g_object_ref(priv->ets);
+ priv->sorted_model_node_resorted_id = g_signal_connect (G_OBJECT (priv->ets), "node_resorted",
+ G_CALLBACK (etsm_sorted_node_resorted), etsm);
}
static void
@@ -618,10 +618,10 @@ drop_ets(ETreeSelectionModel *etsm)
if (!priv->ets)
return;
- gtk_signal_disconnect (GTK_OBJECT (priv->ets),
- priv->sorted_model_node_resorted_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->ets),
+ priv->sorted_model_node_resorted_id);
- gtk_object_unref (GTK_OBJECT (priv->ets));
+ g_object_unref (priv->ets);
priv->ets = NULL;
priv->sorted_model_node_resorted_id = 0;
diff --git a/widgets/table/e-tree-simple.c b/widgets/table/e-tree-simple.c
index c2c8c4314f..e8dff1e05a 100644
--- a/widgets/table/e-tree-simple.c
+++ b/widgets/table/e-tree-simple.c
@@ -22,12 +22,9 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
#include "gal/util/e-util.h"
#include "e-tree-simple.h"
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
static int
simple_column_count (ETableModel *etm)
{
@@ -126,7 +123,7 @@ simple_is_editable (ETreeModel *etm, ETreePath *node, int col)
}
static void
-e_tree_simple_class_init (GtkObjectClass *object_class)
+e_tree_simple_class_init (GObjectClass *object_class)
{
ETreeModelClass *model_class = (ETreeModelClass *) object_class;
ETableModelClass *table_model_class = (ETableModelClass *) object_class;
@@ -144,7 +141,7 @@ e_tree_simple_class_init (GtkObjectClass *object_class)
model_class ->is_editable = simple_is_editable;
}
-E_MAKE_TYPE(e_tree_simple, "ETreeSimple", ETreeSimple, e_tree_simple_class_init, NULL, PARENT_TYPE)
+E_MAKE_TYPE(e_tree_simple, "ETreeSimple", ETreeSimple, e_tree_simple_class_init, NULL, E_TREE_MODEL_TYPE)
/**
* e_tree_simple_new:
@@ -190,9 +187,7 @@ e_tree_simple_new (ETableSimpleColumnCountFn col_count,
gpointer model_data)
{
- ETreeSimple *etg;
-
- etg = gtk_type_new (e_tree_simple_get_type ());
+ ETreeSimple *etg = g_object_new (E_TREE_SIMPLE_TYPE, NULL);
etg->col_count = col_count;
etg->duplicate_value = duplicate_value;
diff --git a/widgets/table/e-tree-simple.h b/widgets/table/e-tree-simple.h
index 212fc78176..f9980c9544 100644
--- a/widgets/table/e-tree-simple.h
+++ b/widgets/table/e-tree-simple.h
@@ -27,15 +27,14 @@
#include <gal/e-table/e-tree-model.h>
#include <gal/e-table/e-table-simple.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
#define E_TREE_SIMPLE_TYPE (e_tree_simple_get_type ())
-#define E_TREE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TREE_SIMPLE_TYPE, ETreeSimple))
-#define E_TREE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SIMPLE_TYPE, ETreeSimpleClass))
-#define E_IS_TREE_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_TREE_SIMPLE_TYPE))
-#define E_IS_TREE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SIMPLE_TYPE))
+#define E_TREE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SIMPLE_TYPE, ETreeSimple))
+#define E_TREE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SIMPLE_TYPE, ETreeSimpleClass))
+#define E_IS_TREE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SIMPLE_TYPE))
+#define E_IS_TREE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SIMPLE_TYPE))
+#define E_TREE_SIMPLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_SIMPLE_TYPE, ETreeSimpleClass))
typedef GdkPixbuf* (*ETreeSimpleIconAtFn) (ETreeModel *etree, ETreePath *path, void *model_data);
@@ -67,7 +66,7 @@ typedef struct {
ETreeModelClass parent_class;
} ETreeSimpleClass;
-GtkType e_tree_simple_get_type (void);
+GType e_tree_simple_get_type (void);
ETreeModel *e_tree_simple_new (ETableSimpleColumnCountFn col_count,
ETableSimpleDuplicateValueFn duplicate_value,
@@ -81,8 +80,6 @@ ETreeModel *e_tree_simple_new (ETableSimpleColumnCountFn col_count,
ETreeSimpleIsEditableFn is_editable,
gpointer model_data);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TREE_SIMPLE_H_ */
diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c
index 13f32f54a1..8acd093b9d 100644
--- a/widgets/table/e-tree-sorted.c
+++ b/widgets/table/e-tree-sorted.c
@@ -41,13 +41,10 @@
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
-#include <gtk/gtksignal.h>
#include "gal/util/e-util.h"
#include "gal/util/e-xml-utils.h"
#include "e-table-sorting-utils.h"
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
/* maximum insertions between an idle event that we will do without scheduling an idle sort */
#define ETS_INSERT_MAX (4)
@@ -588,41 +585,38 @@ schedule_resort (ETreeSorted *ets, ETreeSortedPath *path, gboolean needs_regen,
/* virtual methods */
static void
-ets_destroy (GtkObject *object)
+ets_dispose (GObject *object)
{
ETreeSorted *ets = E_TREE_SORTED (object);
ETreeSortedPriv *priv = ets->priv;
/* FIXME lots of stuff to free here */
if (!priv) {
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->dispose (object);
return;
}
- if (priv->root)
- free_path(priv->root);
-
if (priv->source) {
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_data_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_col_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_removed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_deleted_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_request_collapse_id);
-
- gtk_object_unref (GTK_OBJECT (priv->source));
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_pre_change_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_no_change_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_data_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_col_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_inserted_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_removed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_deleted_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->source),
+ priv->tree_model_node_request_collapse_id);
+
+ g_object_unref (G_OBJECT (priv->source));
priv->source = NULL;
priv->tree_model_pre_change_id = 0;
@@ -637,13 +631,12 @@ ets_destroy (GtkObject *object)
}
if (priv->sort_info) {
- gtk_signal_disconnect (GTK_OBJECT (priv->sort_info),
- priv->sort_info_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->sort_info),
+ priv->sort_info_changed_id);
+ priv->sort_info_changed_id = 0;
- gtk_object_unref (GTK_OBJECT (priv->sort_info));
+ g_object_unref (G_OBJECT (priv->sort_info));
priv->sort_info = NULL;
-
- priv->sort_info_changed_id = 0;
}
ets_stop_sort_idle (ets);
@@ -653,71 +646,22 @@ ets_destroy (GtkObject *object)
}
if (priv->full_header)
- gtk_object_unref(GTK_OBJECT(priv->full_header));
-
- g_free (priv);
+ g_object_unref(G_OBJECT(priv->full_header));
- ets->priv = NULL;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
-/* Set_arg handler for the text item */
static void
-ets_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+ets_finalize (GObject *object)
{
- ETreeSorted *ets;
-
- ets = E_TREE_SORTED (object);
-
- switch (arg_id) {
- case ARG_SORT_INFO:
- if (ets->priv->sort_info) {
- gtk_signal_disconnect (GTK_OBJECT (ets->priv->sort_info),
- ets->priv->sort_info_changed_id);
+ ETreeSorted *ets = (ETreeSorted *) object;
- gtk_object_unref (GTK_OBJECT (ets->priv->sort_info));
- ets->priv->sort_info_changed_id = 0;
- }
- if (GTK_VALUE_OBJECT (*arg))
- ets->priv->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg));
- else
- ets->priv->sort_info = NULL;
- if (ets->priv->sort_info) {
- gtk_object_ref(GTK_OBJECT(ets->priv->sort_info));
+ if (ets->priv->root)
+ free_path(ets->priv->root);
- ets->priv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (ets->priv->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
- }
- if (ets->priv->root)
- schedule_resort (ets, ets->priv->root, TRUE, TRUE);
- break;
-
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-ets_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETreeSorted *ets;
-
- ets = E_TREE_SORTED (object);
-
- switch (arg_id) {
- case ARG_SORT_INFO:
- if (ets->priv->sort_info)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->priv->sort_info);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
+ g_free (ets->priv);
+ ets->priv = NULL;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static ETreePath
@@ -1000,8 +944,6 @@ ets_value_to_string (ETreeModel *etm, int col, const void *value)
return e_tree_model_value_to_string (ets->priv->source, col, value);
}
-
-
/* Proxy functions */
static void
@@ -1212,17 +1154,16 @@ static void
e_tree_sorted_class_init (ETreeSortedClass *klass)
{
ETreeModelClass *tree_class = E_TREE_MODEL_CLASS (klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
node_chunk = g_mem_chunk_create (ETreeSortedPath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE);
klass->node_resorted = NULL;
- object_class->destroy = ets_destroy;
- object_class->set_arg = ets_set_arg;
- object_class->get_arg = ets_get_arg;
+ object_class->dispose = ets_dispose;
+ object_class->finalize = ets_finalize;
tree_class->get_root = ets_get_root;
tree_class->get_parent = ets_get_parent;
@@ -1249,9 +1190,6 @@ e_tree_sorted_class_init (ETreeSortedClass *klass)
tree_class->has_change_pending = ets_has_change_pending;
-
-
-
tree_class->value_at = ets_value_at;
tree_class->set_value_at = ets_set_value_at;
tree_class->is_editable = ets_is_editable;
@@ -1262,22 +1200,18 @@ e_tree_sorted_class_init (ETreeSortedClass *klass)
tree_class->value_is_empty = ets_value_is_empty;
tree_class->value_to_string = ets_value_to_string;
- gtk_object_add_arg_type ("ETreeSorted::sort_info", E_TABLE_SORT_INFO_TYPE,
- GTK_ARG_READWRITE, ARG_SORT_INFO);
-
signals [NODE_RESORTED] =
- gtk_signal_new ("node_resorted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeSortedClass, node_resorted),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, LAST_SIGNAL);
+ g_signal_new ("node_resorted",
+ E_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeSortedClass, node_resorted),
+ (GSignalAccumulator) NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
}
static void
-e_tree_sorted_init (GtkObject *object)
+e_tree_sorted_init (GObject *object)
{
ETreeSorted *ets = (ETreeSorted *)object;
@@ -1313,7 +1247,7 @@ e_tree_sorted_init (GtkObject *object)
priv->nested_resort_idle = 0;
}
-E_MAKE_TYPE(e_tree_sorted, "ETreeSorted", ETreeSorted, e_tree_sorted_class_init, e_tree_sorted_init, PARENT_TYPE)
+E_MAKE_TYPE(e_tree_sorted, "ETreeSorted", ETreeSorted, e_tree_sorted_class_init, e_tree_sorted_init, E_TREE_MODEL_TYPE)
/**
* e_tree_sorted_construct:
@@ -1326,37 +1260,33 @@ e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *ful
{
ets->priv->source = source;
if (source)
- gtk_object_ref(GTK_OBJECT(source));
+ g_object_ref(G_OBJECT(source));
ets->priv->full_header = full_header;
if (full_header)
g_object_ref(G_OBJECT(full_header));
- ets->priv->sort_info = sort_info;
- if (sort_info)
- gtk_object_ref(GTK_OBJECT(sort_info));
-
- ets->priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "pre_change",
- GTK_SIGNAL_FUNC (ets_proxy_pre_change), ets);
- ets->priv->tree_model_no_change_id = gtk_signal_connect (GTK_OBJECT (source), "no_change",
- GTK_SIGNAL_FUNC (ets_proxy_no_change), ets);
- ets->priv->tree_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_changed",
- GTK_SIGNAL_FUNC (ets_proxy_node_changed), ets);
- ets->priv->tree_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_data_changed",
- GTK_SIGNAL_FUNC (ets_proxy_node_data_changed), ets);
- ets->priv->tree_model_node_col_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_col_changed",
- GTK_SIGNAL_FUNC (ets_proxy_node_col_changed), ets);
- ets->priv->tree_model_node_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "node_inserted",
- GTK_SIGNAL_FUNC (ets_proxy_node_inserted), ets);
- ets->priv->tree_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (source), "node_removed",
- GTK_SIGNAL_FUNC (ets_proxy_node_removed), ets);
- ets->priv->tree_model_node_deleted_id = gtk_signal_connect (GTK_OBJECT (source), "node_deleted",
- GTK_SIGNAL_FUNC (ets_proxy_node_deleted), ets);
- ets->priv->tree_model_node_request_collapse_id = gtk_signal_connect (GTK_OBJECT (source), "node_request_collapse",
- GTK_SIGNAL_FUNC (ets_proxy_node_request_collapse), ets);
-
- ets->priv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
+ e_tree_sorted_set_sort_info (ets, sort_info);
+
+ ets->priv->tree_model_pre_change_id = g_signal_connect (G_OBJECT (source), "pre_change",
+ G_CALLBACK (ets_proxy_pre_change), ets);
+ ets->priv->tree_model_no_change_id = g_signal_connect (G_OBJECT (source), "no_change",
+ G_CALLBACK (ets_proxy_no_change), ets);
+ ets->priv->tree_model_node_changed_id = g_signal_connect (G_OBJECT (source), "node_changed",
+ G_CALLBACK (ets_proxy_node_changed), ets);
+ ets->priv->tree_model_node_data_changed_id = g_signal_connect (G_OBJECT (source), "node_data_changed",
+ G_CALLBACK (ets_proxy_node_data_changed), ets);
+ ets->priv->tree_model_node_col_changed_id = g_signal_connect (G_OBJECT (source), "node_col_changed",
+ G_CALLBACK (ets_proxy_node_col_changed), ets);
+ ets->priv->tree_model_node_inserted_id = g_signal_connect (G_OBJECT (source), "node_inserted",
+ G_CALLBACK (ets_proxy_node_inserted), ets);
+ ets->priv->tree_model_node_removed_id = g_signal_connect (G_OBJECT (source), "node_removed",
+ G_CALLBACK (ets_proxy_node_removed), ets);
+ ets->priv->tree_model_node_deleted_id = g_signal_connect (G_OBJECT (source), "node_deleted",
+ G_CALLBACK (ets_proxy_node_deleted), ets);
+ ets->priv->tree_model_node_request_collapse_id = g_signal_connect (G_OBJECT (source), "node_request_collapse",
+ G_CALLBACK (ets_proxy_node_request_collapse), ets);
+
}
/**
@@ -1369,9 +1299,7 @@ e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *ful
ETreeSorted *
e_tree_sorted_new (ETreeModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
{
- ETreeSorted *ets;
-
- ets = gtk_type_new (e_tree_sorted_get_type ());
+ ETreeSorted *ets = g_object_new (E_TREE_SORTED_TYPE, NULL);
e_tree_sorted_construct(ets, source, full_header, sort_info);
@@ -1425,6 +1353,38 @@ e_tree_sorted_node_resorted (ETreeSorted *sorted, ETreePath node)
g_return_if_fail (sorted != NULL);
g_return_if_fail (E_IS_TREE_SORTED (sorted));
- gtk_signal_emit (GTK_OBJECT (sorted),
- signals [NODE_RESORTED], node);
+ g_signal_emit (G_OBJECT (sorted), signals [NODE_RESORTED], 0, node);
+}
+
+void
+e_tree_sorted_set_sort_info (ETreeSorted *ets, ETableSortInfo *sort_info)
+{
+
+ g_return_if_fail (ets != NULL);
+
+
+ if (ets->priv->sort_info) {
+ if (ets->priv->sort_info_changed_id != 0)
+ g_signal_handler_disconnect (G_OBJECT (ets->priv->sort_info),
+ ets->priv->sort_info_changed_id);
+ ets->priv->sort_info_changed_id = 0;
+ g_object_unref (G_OBJECT (ets->priv->sort_info));
+ }
+
+ ets->priv->sort_info = sort_info;
+ if (sort_info) {
+ g_object_ref(G_OBJECT(sort_info));
+ ets->priv->sort_info_changed_id = g_signal_connect (G_OBJECT (ets->priv->sort_info), "sort_info_changed",
+ G_CALLBACK (ets_sort_info_changed), ets);
+ }
+
+ if (ets->priv->root)
+ schedule_resort (ets, ets->priv->root, TRUE, TRUE);
+}
+
+ETableSortInfo*
+e_tree_sorted_get_sort_info (ETreeSorted *ets)
+{
+ return ets->priv->sort_info;
}
+
diff --git a/widgets/table/e-tree-sorted.h b/widgets/table/e-tree-sorted.h
index 529e28257a..41f123dc0b 100644
--- a/widgets/table/e-tree-sorted.h
+++ b/widgets/table/e-tree-sorted.h
@@ -29,16 +29,14 @@
#include <gal/e-table/e-table-sort-info.h>
#include <gal/e-table/e-table-header.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
#define E_TREE_SORTED_TYPE (e_tree_sorted_get_type ())
-#define E_TREE_SORTED(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_TYPE, ETreeSorted))
-#define E_TREE_SORTED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SORTED_TYPE, ETreeSortedClass))
-#define E_IS_TREE_SORTED(o) (GTK_CHECK_TYPE ((o), E_TREE_SORTED_TYPE))
-#define E_IS_TREE_SORTED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_TYPE))
+#define E_TREE_SORTED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SORTED_TYPE, ETreeSorted))
+#define E_TREE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SORTED_TYPE, ETreeSortedClass))
+#define E_IS_TREE_SORTED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SORTED_TYPE))
+#define E_IS_TREE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_TYPE))
+#define E_TREE_SORTED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_SORTED_TYPE, ETreeSortedClass))
typedef struct ETreeSorted ETreeSorted;
typedef struct ETreeSortedPriv ETreeSortedPriv;
@@ -58,7 +56,7 @@ struct ETreeSortedClass {
};
-GtkType e_tree_sorted_get_type (void);
+GType e_tree_sorted_get_type (void);
void e_tree_sorted_construct (ETreeSorted *etree,
ETreeModel *source,
ETableHeader *full_header,
@@ -79,9 +77,10 @@ int e_tree_sorted_node_num_children (ETreeSorted *ets,
void e_tree_sorted_node_resorted (ETreeSorted *tree_model,
ETreePath node);
+ETableSortInfo* e_tree_sorted_get_sort_info (ETreeSorted *tree_model);
+void e_tree_sorted_set_sort_info (ETreeSorted *tree_model,
+ ETableSortInfo *sort_info);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TREE_SORTED_H */
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 201e121369..44c0b537d4 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -30,14 +30,12 @@
#include <stdlib.h>
#include <string.h>
-#include <gtk/gtksignal.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include "gal/util/e-util.h"
#include "gal/util/e-xml-utils.h"
#include "e-tree-table-adapter.h"
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
#define d(x)
#define INCREMENT_AMOUNT 100
@@ -401,39 +399,32 @@ free_string (gpointer key, gpointer value, gpointer data)
}
static void
-etta_destroy (GtkObject *object)
+etta_dispose (GObject *object)
{
ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object);
- if (!etta->priv) {
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
- return;
- }
-
- if (etta->priv->source && e_tree_model_has_save_id(etta->priv->source)) {
- g_hash_table_foreach(etta->priv->attributes, free_string, NULL);
- }
- g_hash_table_destroy (etta->priv->attributes);
-
if (etta->priv->source) {
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_data_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_col_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_removed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_request_collapse_id);
-
- gtk_object_unref (GTK_OBJECT (etta->priv->source));
+ if (e_tree_model_has_save_id(etta->priv->source))
+ g_hash_table_foreach(etta->priv->attributes, free_string, NULL);
+
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_pre_change_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_no_change_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_node_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_node_data_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_node_col_changed_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_node_inserted_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_node_removed_id);
+ g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
+ etta->priv->tree_model_node_request_collapse_id);
+
+ g_object_unref (G_OBJECT (etta->priv->source));
etta->priv->source = NULL;
etta->priv->tree_model_pre_change_id = 0;
@@ -446,12 +437,21 @@ etta_destroy (GtkObject *object)
etta->priv->tree_model_node_request_collapse_id = 0;
}
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+etta_finalize (GObject *object)
+{
+ ETreeTableAdapter *etta = (ETreeTableAdapter *) object;
+
+ g_hash_table_destroy (etta->priv->attributes);
g_free (etta->priv->map_table);
g_free (etta->priv);
etta->priv = NULL;
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static int
@@ -510,11 +510,6 @@ etta_value_at (ETableModel *etm, int col, int row)
{
ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-#if 0
- etta->priv->last_access = row;
- d(g_print("g) Setting last_access to %d\n", row));
-#endif
-
switch (col) {
case -1:
if (etta->priv->root_visible)
@@ -610,11 +605,12 @@ static void
etta_class_init (ETreeTableAdapterClass *klass)
{
ETableModelClass *table_class = (ETableModelClass *) klass;
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = (GObjectClass *) klass;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
- object_class->destroy = etta_destroy;
+ object_class->dispose = etta_dispose;
+ object_class->finalize = etta_finalize;
table_class->column_count = etta_column_count;
table_class->row_count = etta_row_count;
@@ -661,7 +657,7 @@ etta_init (ETreeTableAdapter *etta)
etta->priv->tree_model_node_request_collapse_id = 0;
}
-E_MAKE_TYPE(e_tree_table_adapter, "ETreeTableAdapter", ETreeTableAdapter, etta_class_init, etta_init, PARENT_TYPE)
+E_MAKE_TYPE(e_tree_table_adapter, "ETreeTableAdapter", ETreeTableAdapter, etta_class_init, etta_init, E_TABLE_MODEL_TYPE)
static void
etta_proxy_pre_change (ETreeModel *etm, ETreeTableAdapter *etta)
@@ -872,7 +868,7 @@ e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source)
ETreePath root;
etta->priv->source = source;
- gtk_object_ref (GTK_OBJECT (source));
+ g_object_ref (G_OBJECT (source));
if (e_tree_model_has_save_id(source))
etta->priv->attributes = g_hash_table_new(g_str_hash, g_str_equal);
@@ -888,22 +884,22 @@ e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source)
fill_array_from_path(etta, etta->priv->map_table, root);
}
- etta->priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "pre_change",
- GTK_SIGNAL_FUNC (etta_proxy_pre_change), etta);
- etta->priv->tree_model_no_change_id = gtk_signal_connect (GTK_OBJECT (source), "no_change",
- GTK_SIGNAL_FUNC (etta_proxy_no_change), etta);
- etta->priv->tree_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_changed",
- GTK_SIGNAL_FUNC (etta_proxy_node_changed), etta);
- etta->priv->tree_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_data_changed",
- GTK_SIGNAL_FUNC (etta_proxy_node_data_changed), etta);
- etta->priv->tree_model_node_col_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_col_changed",
- GTK_SIGNAL_FUNC (etta_proxy_node_col_changed), etta);
- etta->priv->tree_model_node_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "node_inserted",
- GTK_SIGNAL_FUNC (etta_proxy_node_inserted), etta);
- etta->priv->tree_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (source), "node_removed",
- GTK_SIGNAL_FUNC (etta_proxy_node_removed), etta);
- etta->priv->tree_model_node_request_collapse_id = gtk_signal_connect (GTK_OBJECT (source), "node_request_collapse",
- GTK_SIGNAL_FUNC (etta_proxy_node_request_collapse), etta);
+ etta->priv->tree_model_pre_change_id = g_signal_connect (G_OBJECT (source), "pre_change",
+ G_CALLBACK (etta_proxy_pre_change), etta);
+ etta->priv->tree_model_no_change_id = g_signal_connect (G_OBJECT (source), "no_change",
+ G_CALLBACK (etta_proxy_no_change), etta);
+ etta->priv->tree_model_node_changed_id = g_signal_connect (G_OBJECT (source), "node_changed",
+ G_CALLBACK (etta_proxy_node_changed), etta);
+ etta->priv->tree_model_node_data_changed_id = g_signal_connect (G_OBJECT (source), "node_data_changed",
+ G_CALLBACK (etta_proxy_node_data_changed), etta);
+ etta->priv->tree_model_node_col_changed_id = g_signal_connect (G_OBJECT (source), "node_col_changed",
+ G_CALLBACK (etta_proxy_node_col_changed), etta);
+ etta->priv->tree_model_node_inserted_id = g_signal_connect (G_OBJECT (source), "node_inserted",
+ G_CALLBACK (etta_proxy_node_inserted), etta);
+ etta->priv->tree_model_node_removed_id = g_signal_connect (G_OBJECT (source), "node_removed",
+ G_CALLBACK (etta_proxy_node_removed), etta);
+ etta->priv->tree_model_node_request_collapse_id = g_signal_connect (G_OBJECT (source), "node_request_collapse",
+ G_CALLBACK (etta_proxy_node_request_collapse), etta);
return E_TABLE_MODEL (etta);
}
@@ -911,7 +907,7 @@ e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source)
ETableModel *
e_tree_table_adapter_new (ETreeModel *source)
{
- ETreeTableAdapter *etta = gtk_type_new (E_TREE_TABLE_ADAPTER_TYPE);
+ ETreeTableAdapter *etta = g_object_new (E_TREE_TABLE_ADAPTER_TYPE, NULL);
e_tree_table_adapter_construct (etta, source);
diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h
index b60970a528..68cc433c7e 100644
--- a/widgets/table/e-tree-table-adapter.h
+++ b/widgets/table/e-tree-table-adapter.h
@@ -25,19 +25,18 @@
#ifndef _E_TREE_TABLE_ADAPTER_H_
#define _E_TREE_TABLE_ADAPTER_H_
-#include <gtk/gtkobject.h>
+#include <glib-object.h>
#include <gal/e-table/e-table-model.h>
#include <gal/e-table/e-tree-model.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
#define E_TREE_TABLE_ADAPTER_TYPE (e_tree_table_adapter_get_type ())
-#define E_TREE_TABLE_ADAPTER(o) (GTK_CHECK_CAST ((o), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapter))
-#define E_TREE_TABLE_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass))
-#define E_IS_TREE_TABLE_ADAPTER(o) (GTK_CHECK_TYPE ((o), E_TREE_TABLE_ADAPTER_TYPE))
-#define E_IS_TREE_TABLE_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_TABLE_ADAPTER_TYPE))
+#define E_TREE_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapter))
+#define E_TREE_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass))
+#define E_IS_TREE_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_TABLE_ADAPTER_TYPE))
+#define E_IS_TREE_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_TABLE_ADAPTER_TYPE))
+#define E_TREE_TABLE_ADAPTER_GET_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass))
typedef struct ETreeTableAdapterPriv ETreeTableAdapterPriv;
@@ -51,7 +50,7 @@ typedef struct {
ETableModelClass parent_class;
} ETreeTableAdapterClass;
-GtkType e_tree_table_adapter_get_type (void);
+GType e_tree_table_adapter_get_type (void);
ETableModel *e_tree_table_adapter_new (ETreeModel *source);
ETableModel *e_tree_table_adapter_construct (ETreeTableAdapter *ets,
ETreeModel *source);
@@ -80,8 +79,6 @@ void e_tree_table_adapter_save_expanded_state (ETreeTableAdapter
void e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta,
const char *filename);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* _E_TREE_TABLE_ADAPTER_H_ */
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 9383de1646..cb5d5fa3ba 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -251,20 +251,20 @@ static void
et_disconnect_from_etta (ETree *et)
{
if (et->priv->table_model_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_model_change_id);
+ g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
+ et->priv->table_model_change_id);
if (et->priv->table_row_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_row_change_id);
+ g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
+ et->priv->table_row_change_id);
if (et->priv->table_cell_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_cell_change_id);
+ g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
+ et->priv->table_cell_change_id);
if (et->priv->table_rows_inserted_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_rows_inserted_id);
+ g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
+ et->priv->table_rows_inserted_id);
if (et->priv->table_rows_deleted_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_rows_deleted_id);
+ g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
+ et->priv->table_rows_deleted_id);
et->priv->table_model_change_id = 0;
et->priv->table_row_change_id = 0;
@@ -297,8 +297,7 @@ current_search_col (ETree *et)
static void
e_tree_state_change (ETree *et)
{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [STATE_CHANGE]);
+ g_signal_emit (G_OBJECT (et), et_signals [STATE_CHANGE], 0);
}
static void
@@ -328,13 +327,13 @@ disconnect_header (ETree *e_tree)
e_tree->priv->expansion_change_id);
if (e_tree->priv->sort_info) {
if (e_tree->priv->sort_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->sort_info),
- e_tree->priv->sort_info_change_id);
+ g_signal_handler_disconnect (G_OBJECT (e_tree->priv->sort_info),
+ e_tree->priv->sort_info_change_id);
if (e_tree->priv->group_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->sort_info),
- e_tree->priv->group_info_change_id);
+ g_signal_handler_disconnect (G_OBJECT (e_tree->priv->sort_info),
+ e_tree->priv->group_info_change_id);
- gtk_object_unref(GTK_OBJECT(e_tree->priv->sort_info));
+ g_object_unref(G_OBJECT(e_tree->priv->sort_info));
}
g_object_unref(G_OBJECT(e_tree->priv->header));
e_tree->priv->header = NULL;
@@ -362,11 +361,11 @@ connect_header (ETree *e_tree, ETableState *state)
e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info);
e_table_sort_info_set_can_group (e_tree->priv->sort_info, FALSE);
e_tree->priv->sort_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree);
+ g_signal_connect (G_OBJECT (e_tree->priv->sort_info), "sort_info_changed",
+ G_CALLBACK (search_col_change_trigger), e_tree);
e_tree->priv->group_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "group_info_changed",
- GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree);
+ g_signal_connect (G_OBJECT (e_tree->priv->sort_info), "group_info_changed",
+ G_CALLBACK (search_col_change_trigger), e_tree);
} else
e_tree->priv->sort_info = NULL;
@@ -403,18 +402,18 @@ et_destroy (GtkObject *object)
et_disconnect_from_etta (et);
- gtk_object_unref (GTK_OBJECT (et->priv->etta));
- gtk_object_unref (GTK_OBJECT (et->priv->model));
- gtk_object_unref (GTK_OBJECT (et->priv->sorted));
+ g_object_unref (G_OBJECT (et->priv->etta));
+ g_object_unref (G_OBJECT (et->priv->model));
+ g_object_unref (G_OBJECT (et->priv->sorted));
g_object_unref (G_OBJECT (et->priv->full_header));
disconnect_header (et);
- gtk_object_unref (GTK_OBJECT (et->priv->selection));
+ g_object_unref (G_OBJECT (et->priv->selection));
if (et->priv->spec)
g_object_unref (G_OBJECT (et->priv->spec));
et->priv->spec = NULL;
if (et->priv->sorter)
- gtk_object_unref (GTK_OBJECT (et->priv->sorter));
+ g_object_unref (G_OBJECT (et->priv->sorter));
et->priv->sorter = NULL;
if (et->priv->header_canvas)
@@ -1142,11 +1141,14 @@ e_tree_set_search_column (ETree *e_tree, gint col)
void
e_tree_set_state_object(ETree *e_tree, ETableState *state)
{
+ GValue *val = g_new0 (GValue, 1);
+ g_value_init (val, G_TYPE_DOUBLE);
+
connect_header (e_tree, state);
- gtk_object_set (GTK_OBJECT (e_tree->priv->header),
- "width", (double) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width),
- NULL);
+ g_value_set_double (val, (double) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width));
+ g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val);
+ g_free (val);
if (e_tree->priv->header_item)
gtk_object_set(GTK_OBJECT(e_tree->priv->header_item),
@@ -1160,9 +1162,7 @@ e_tree_set_state_object(ETree *e_tree, ETableState *state)
NULL);
if (e_tree->priv->sorted)
- gtk_object_set(GTK_OBJECT(e_tree->priv->sorted),
- "sort_info", e_tree->priv->sort_info,
- NULL);
+ e_tree_sorted_set_sort_info (e_tree->priv->sorted, e_tree->priv->sort_info);
e_tree_state_change (e_tree);
}
@@ -1191,7 +1191,7 @@ e_tree_set_state (ETree *e_tree,
if (state->col_count > 0)
e_tree_set_state_object(e_tree, state);
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
}
/**
@@ -1218,7 +1218,7 @@ e_tree_load_state (ETree *e_tree,
if (state->col_count > 0)
e_tree_set_state_object(e_tree, state);
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
}
/**
@@ -1241,7 +1241,7 @@ e_tree_get_state_object (ETree *e_tree)
state = e_table_state_new();
state->sort_info = e_tree->priv->sort_info;
if (state->sort_info)
- gtk_object_ref(GTK_OBJECT(state->sort_info));
+ g_object_ref(G_OBJECT(state->sort_info));
state->col_count = e_table_header_count (e_tree->priv->header);
full_col_count = e_table_header_count (e_tree->priv->full_header);
@@ -1280,7 +1280,7 @@ e_tree_get_state (ETree *e_tree)
state = e_tree_get_state_object(e_tree);
string = e_table_state_save_to_string(state);
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
return string;
}
@@ -1300,7 +1300,7 @@ e_tree_save_state (ETree *e_tree,
state = e_tree_get_state_object(e_tree);
e_table_state_save_to_file(state, filename);
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
}
/**
@@ -1351,20 +1351,20 @@ et_table_rows_deleted (ETableModel *table_model, int row, int count, ETree *et)
static void
et_connect_to_etta (ETree *et)
{
- et->priv->table_model_change_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_changed",
- GTK_SIGNAL_FUNC (et_table_model_changed), et);
+ et->priv->table_model_change_id = g_signal_connect (G_OBJECT (et->priv->etta), "model_changed",
+ G_CALLBACK (et_table_model_changed), et);
- et->priv->table_row_change_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_row_changed",
- GTK_SIGNAL_FUNC (et_table_row_changed), et);
+ et->priv->table_row_change_id = g_signal_connect (G_OBJECT (et->priv->etta), "model_row_changed",
+ G_CALLBACK (et_table_row_changed), et);
- et->priv->table_cell_change_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_cell_changed",
- GTK_SIGNAL_FUNC (et_table_cell_changed), et);
+ et->priv->table_cell_change_id = g_signal_connect (G_OBJECT (et->priv->etta), "model_cell_changed",
+ G_CALLBACK (et_table_cell_changed), et);
- et->priv->table_rows_inserted_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_rows_inserted",
- GTK_SIGNAL_FUNC (et_table_rows_inserted), et);
+ et->priv->table_rows_inserted_id = g_signal_connect (G_OBJECT (et->priv->etta), "model_rows_inserted",
+ G_CALLBACK (et_table_rows_inserted), et);
- et->priv->table_rows_deleted_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_rows_deleted",
- GTK_SIGNAL_FUNC (et_table_rows_deleted), et);
+ et->priv->table_rows_deleted_id = g_signal_connect (G_OBJECT (et->priv->etta), "model_rows_deleted",
+ G_CALLBACK (et_table_rows_deleted), et);
}
@@ -1376,7 +1376,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
int i, col_count;
if (ete)
- gtk_object_ref(GTK_OBJECT(ete));
+ g_object_ref(G_OBJECT(ete));
else
ete = e_table_extras_new();
@@ -1392,7 +1392,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
e_tree->priv->horizontal_scrolling = specification->horizontal_scrolling;
e_tree->priv->model = etm;
- gtk_object_ref (GTK_OBJECT (etm));
+ g_object_ref (G_OBJECT (etm));
e_tree->priv->sorted = e_tree_sorted_new(etm, e_tree->priv->full_header, e_tree->priv->sort_info);
@@ -1489,19 +1489,19 @@ e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
state = e_table_state_new();
e_table_state_load_from_string(state, state_str);
if (state->col_count <= 0) {
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
+ g_object_ref(G_OBJECT(state));
}
} else {
state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
+ g_object_ref(G_OBJECT(state));
}
e_tree = et_real_construct (e_tree, etm, ete, specification, state);
e_tree->priv->spec = specification;
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
return e_tree;
}
@@ -1544,24 +1544,24 @@ e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *e
if (state_fn) {
state = e_table_state_new();
if (!e_table_state_load_from_file(state, state_fn)) {
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
+ g_object_ref(G_OBJECT(state));
}
if (state->col_count <= 0) {
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
+ g_object_ref(G_OBJECT(state));
}
} else {
state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
+ g_object_ref(G_OBJECT(state));
}
e_tree = et_real_construct (e_tree, etm, ete, specification, state);
e_tree->priv->spec = specification;
- gtk_object_unref(GTK_OBJECT(state));
+ g_object_unref(G_OBJECT(state));
return e_tree;
}
@@ -1602,7 +1602,7 @@ e_tree_new (ETreeModel *etm, ETableExtras *ete, const char *spec, const char *st
ret_val = e_tree_construct (e_tree, etm, ete, spec, state);
if (ret_val == NULL) {
- gtk_object_unref (GTK_OBJECT (e_tree));
+ g_object_unref (G_OBJECT (e_tree));
}
return (GtkWidget *) ret_val;
@@ -1643,7 +1643,7 @@ e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const char *spec_
ret_val = e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn);
if (ret_val == NULL) {
- gtk_object_unref (GTK_OBJECT (e_tree));
+ g_object_unref (G_OBJECT (e_tree));
}
return (GtkWidget *) ret_val;
@@ -2846,14 +2846,14 @@ context_destroyed (gpointer data)
scroll_off (et);
hover_off (et);
}
- gtk_object_unref (GTK_OBJECT (et));
+ g_object_unref (G_OBJECT (et));
}
static void
context_connect (ETree *et, GdkDragContext *context)
{
if (g_dataset_get_data (context, "e-tree") == NULL) {
- gtk_object_ref (GTK_OBJECT (et));
+ g_object_ref (G_OBJECT (et));
g_dataset_set_data_full (context, "e-tree", et, context_destroyed);
}
}