From 65269c688256d025bbd5da06af484dcc536c178d Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Mon, 4 Nov 2002 16:18:45 +0000 Subject: use GObject api for ETableHeader use GObject api on ETableHeader 2002-11-04 Mike Kestner * e-table-group.c : use GObject api for ETableHeader * e-table-header-item.c : use GObject api on ETableHeader * e-table-header.[ch] : GObjectify * e-table-item.c : use GObject api on ETableHeader * e-table-search.[ch] : GObjectify * e-table-sorted.c : use GObject api for ETableHeader * e-table-sorter.c : use GObject api for ETableHeader * e-table-specification.[ch] : GObjectify * e-table-utils.c : use GObject api for ETableHeader * e-tree-sorted.c : use GObject api for ETableHeader * e-tree.c : use GObject api on Header, Spec, and Search svn path=/trunk/; revision=18531 --- widgets/table/e-table-group.c | 8 +- widgets/table/e-table-header-item.c | 40 +++---- widgets/table/e-table-header.c | 208 ++++++++++++++++------------------ widgets/table/e-table-header.h | 18 +-- widgets/table/e-table-item.c | 36 +++--- widgets/table/e-table-search.c | 83 +++++--------- widgets/table/e-table-search.h | 15 +-- widgets/table/e-table-sorted.c | 4 +- widgets/table/e-table-sorter.c | 4 +- widgets/table/e-table-specification.c | 19 ++-- widgets/table/e-table-specification.h | 25 ++-- widgets/table/e-table-utils.c | 9 +- widgets/table/e-table.c | 91 ++++++++------- widgets/table/e-tree-sorted.c | 2 +- widgets/table/e-tree.c | 62 +++++----- 15 files changed, 297 insertions(+), 327 deletions(-) diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index 6123eb9862..7182dcfce6 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -58,12 +58,12 @@ etg_destroy (GtkObject *object) ETableGroup *etg = E_TABLE_GROUP(object); if (etg->header) { - gtk_object_unref (GTK_OBJECT(etg->header)); + g_object_unref (G_OBJECT(etg->header)); etg->header = NULL; } if (etg->full_header) { - gtk_object_unref (GTK_OBJECT(etg->full_header)); + g_object_unref (G_OBJECT(etg->full_header)); etg->full_header = NULL; } @@ -130,9 +130,9 @@ e_table_group_construct (GnomeCanvasGroup *parent, ETableModel *model) { etg->full_header = full_header; - gtk_object_ref (GTK_OBJECT(etg->full_header)); + g_object_ref (G_OBJECT(etg->full_header)); etg->header = header; - gtk_object_ref (GTK_OBJECT(etg->header)); + g_object_ref (G_OBJECT(etg->header)); etg->model = model; gtk_object_ref (GTK_OBJECT(etg->model)); gnome_canvas_item_construct (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 01718c2bf6..b2d8cdde2a 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -137,7 +137,7 @@ ethi_destroy (GtkObject *object){ } if (ethi->full_header) - gtk_object_unref (GTK_OBJECT(ethi->full_header)); + g_object_unref (G_OBJECT(ethi->full_header)); ethi->full_header = NULL; if (ethi->config) @@ -258,16 +258,16 @@ ethi_font_load (ETableHeaderItem *ethi, char *fontname) static void ethi_drop_table_header (ETableHeaderItem *ethi) { - GtkObject *header; + GObject *header; if (!ethi->eth) return; - header = GTK_OBJECT (ethi->eth); - gtk_signal_disconnect (header, ethi->structure_change_id); - gtk_signal_disconnect (header, ethi->dimension_change_id); + header = G_OBJECT (ethi->eth); + g_signal_handler_disconnect (header, ethi->structure_change_id); + g_signal_handler_disconnect (header, ethi->dimension_change_id); - gtk_object_unref (header); + g_object_unref (header); ethi->eth = NULL; ethi->width = 0; } @@ -288,16 +288,16 @@ static void ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header) { ethi->eth = header; - gtk_object_ref (GTK_OBJECT (ethi->eth)); + g_object_ref (G_OBJECT (ethi->eth)); ethi->height = e_table_header_item_get_height (ethi); - ethi->structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC(structure_changed), ethi); - ethi->dimension_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC(dimension_changed), ethi); + ethi->structure_change_id = g_signal_connect ( + G_OBJECT (header), "structure_change", + G_CALLBACK (structure_changed), ethi); + ethi->dimension_change_id = g_signal_connect ( + G_OBJECT (header), "dimension_change", + G_CALLBACK (dimension_changed), ethi); e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(ethi)); gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); } @@ -320,15 +320,15 @@ ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_TABLE_HEADER: ethi_drop_table_header (ethi); - ethi_add_table_header (ethi, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg))); + ethi_add_table_header (ethi, E_TABLE_HEADER(GTK_VALUE_POINTER (*arg))); break; case ARG_FULL_HEADER: if (ethi->full_header) - gtk_object_unref(GTK_OBJECT(ethi->full_header)); - ethi->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)); + g_object_unref(G_OBJECT(ethi->full_header)); + ethi->full_header = E_TABLE_HEADER(GTK_VALUE_POINTER (*arg)); if (ethi->full_header) - gtk_object_ref(GTK_OBJECT(ethi->full_header)); + g_object_ref(G_OBJECT(ethi->full_header)); break; case ARG_DND_CODE: @@ -389,7 +389,7 @@ ethi_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_FULL_HEADER: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (ethi->full_header); + GTK_VALUE_POINTER (*arg) = G_OBJECT (ethi->full_header); break; case ARG_DND_CODE: GTK_VALUE_STRING (*arg) = g_strdup (ethi->dnd_code); @@ -1727,9 +1727,9 @@ ethi_class_init (GtkObjectClass *object_class) item_class->point = ethi_point; item_class->event = ethi_event; - gtk_object_add_arg_type ("ETableHeaderItem::ETableHeader", GTK_TYPE_OBJECT, + gtk_object_add_arg_type ("ETableHeaderItem::ETableHeader", G_TYPE_OBJECT, GTK_ARG_WRITABLE, ARG_TABLE_HEADER); - gtk_object_add_arg_type ("ETableHeaderItem::full_header", GTK_TYPE_OBJECT, + gtk_object_add_arg_type ("ETableHeaderItem::full_header", G_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_FULL_HEADER); gtk_object_add_arg_type ("ETableHeaderItem::dnd_code", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_DND_CODE); diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index e57a8f38a0..e76bef6bd5 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -24,8 +24,7 @@ #include #include -#include -#include +#include #include #include #include "e-table-header.h" @@ -34,10 +33,10 @@ /* The arguments we take */ enum { - ARG_0, - ARG_SORT_INFO, - ARG_WIDTH, - ARG_WIDTH_EXTRAS + PROP_0, + PROP_SORT_INFO, + PROP_WIDTH, + PROP_WIDTH_EXTRAS }; enum { @@ -53,7 +52,7 @@ static void eth_calc_widths (ETableHeader *eth); static guint eth_signals [LAST_SIGNAL] = { 0, }; -static GtkObjectClass *e_table_header_parent_class; +static GObjectClass *e_table_header_parent_class; struct two_ints { int column; @@ -144,7 +143,7 @@ eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref) } static void -eth_destroy (GtkObject *object) +eth_finalize (GObject *object) { ETableHeader *eth = E_TABLE_HEADER (object); const int cols = eth->col_count; @@ -152,8 +151,8 @@ eth_destroy (GtkObject *object) if (eth->sort_info) { if (eth->sort_info_group_change_id) - gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), - eth->sort_info_group_change_id); + g_signal_handler_disconnect(GTK_OBJECT(eth->sort_info), + eth->sort_info_group_change_id); gtk_object_unref(GTK_OBJECT(eth->sort_info)); eth->sort_info = NULL; } @@ -179,8 +178,8 @@ eth_destroy (GtkObject *object) eth->col_count = 0; eth->columns = NULL; - if (e_table_header_parent_class->destroy) - e_table_header_parent_class->destroy (object); + if (e_table_header_parent_class->finalize) + e_table_header_parent_class->finalize (object); } static void @@ -190,31 +189,31 @@ eth_group_info_changed(ETableSortInfo *info, ETableHeader *eth) } static void -eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +eth_set_prop (GObject *object, guint prop_id, const GValue *val, GParamSpec *pspec) { ETableHeader *eth = E_TABLE_HEADER (object); - switch (arg_id) { - case ARG_WIDTH: - eth->nominal_width = GTK_VALUE_DOUBLE (*arg); - enqueue(eth, -1, GTK_VALUE_DOUBLE (*arg)); + switch (prop_id) { + case PROP_WIDTH: + eth->nominal_width = g_value_get_double (val); + enqueue(eth, -1, eth->nominal_width); break; - case ARG_WIDTH_EXTRAS: - eth->width_extras = GTK_VALUE_DOUBLE (*arg); + case PROP_WIDTH_EXTRAS: + eth->width_extras = g_value_get_double (val); enqueue(eth, -1, eth->nominal_width); break; - case ARG_SORT_INFO: + case PROP_SORT_INFO: if (eth->sort_info) { if (eth->sort_info_group_change_id) - gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id); - gtk_object_unref(GTK_OBJECT(eth->sort_info)); + g_signal_handler_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id); + g_object_unref (G_OBJECT(eth->sort_info)); } - eth->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg)); + eth->sort_info = E_TABLE_SORT_INFO(g_value_get_object (val)); if (eth->sort_info) { - gtk_object_ref(GTK_OBJECT(eth->sort_info)); + g_object_ref(G_OBJECT(eth->sort_info)); eth->sort_info_group_change_id - = gtk_signal_connect(GTK_OBJECT(eth->sort_info), "group_info_changed", - GTK_SIGNAL_FUNC(eth_group_info_changed), eth); + = g_signal_connect(G_OBJECT(eth->sort_info), "group_info_changed", + G_CALLBACK(eth_group_info_changed), eth); } enqueue(eth, -1, eth->nominal_width); break; @@ -224,74 +223,87 @@ eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) } static void -eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +eth_get_prop (GObject *object, guint prop_id, GValue *val, GParamSpec *pspec) { ETableHeader *eth = E_TABLE_HEADER (object); - switch (arg_id) { - case ARG_SORT_INFO: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(eth->sort_info); + switch (prop_id) { + case PROP_SORT_INFO: + g_value_set_object (val, G_OBJECT(eth->sort_info)); break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = eth->nominal_width; + case PROP_WIDTH: + g_value_set_double (val, eth->nominal_width); break; - case ARG_WIDTH_EXTRAS: - GTK_VALUE_DOUBLE (*arg) = eth->width_extras; + case PROP_WIDTH_EXTRAS: + g_value_set_double (val, eth->width_extras); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void -e_table_header_class_init (GtkObjectClass *object_class) +e_table_header_class_init (GObjectClass *object_class) { ETableHeaderClass *klass = E_TABLE_HEADER_CLASS (object_class); - object_class->destroy = eth_destroy; - object_class->set_arg = eth_set_arg; - object_class->get_arg = eth_get_arg; + object_class->finalize = eth_finalize; + object_class->set_property = eth_set_prop; + object_class->get_property = eth_get_prop; + + e_table_header_parent_class = g_type_class_peek_parent (object_class); + + g_object_class_install_property ( + object_class, PROP_WIDTH, + g_param_spec_double ("width", "Width", "Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); - e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ())); + g_object_class_install_property ( + object_class, PROP_WIDTH_EXTRAS, + g_param_spec_double ("width_extras", "Width of Extras", "Width of Extras", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); - gtk_object_add_arg_type ("ETableHeader::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableHeader::width_extras", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH_EXTRAS); - gtk_object_add_arg_type ("ETableHeader::sort_info", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_SORT_INFO); + g_object_class_install_property ( + object_class, PROP_SORT_INFO, + g_param_spec_object ("sort_info", "Sort Info", "Sort Info", + E_TABLE_SORT_INFO_TYPE, + G_PARAM_READWRITE)); eth_signals [STRUCTURE_CHANGE] = - gtk_signal_new ("structure_change", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableHeaderClass, structure_change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("structure_change", + E_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableHeaderClass, structure_change), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); eth_signals [DIMENSION_CHANGE] = - gtk_signal_new ("dimension_change", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableHeaderClass, dimension_change), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); + g_signal_new ("dimension_change", + E_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableHeaderClass, dimension_change), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); eth_signals [EXPANSION_CHANGE] = - gtk_signal_new ("expansion_change", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableHeaderClass, expansion_change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("expansion_change", + E_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableHeaderClass, expansion_change), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); eth_signals [REQUEST_WIDTH] = - gtk_signal_new ("request_width", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableHeaderClass, request_width), - e_marshal_INT__INT, - GTK_TYPE_INT, 1, GTK_TYPE_INT); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, eth_signals, LAST_SIGNAL); + g_signal_new ("request_width", + E_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableHeaderClass, request_width), + (GSignalAccumulator) NULL, NULL, + e_marshal_INT__INT, + G_TYPE_INT, 1, G_TYPE_INT); klass->structure_change = NULL; klass->dimension_change = NULL; @@ -324,11 +336,8 @@ e_table_header_init (ETableHeader *eth) ETableHeader * e_table_header_new (void) { - ETableHeader *eth; - - eth = gtk_type_new (e_table_header_get_type ()); - return eth; + return (ETableHeader *) g_object_new (E_TABLE_HEADER_TYPE, NULL); } static void @@ -390,7 +399,7 @@ e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos) eth_do_insert (eth, pos, tc); enqueue(eth, -1, eth->nominal_width); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [STRUCTURE_CHANGE], 0); } /** @@ -631,8 +640,8 @@ e_table_header_move (ETableHeader *eth, int source_index, int target_index) eth_do_insert (eth, target_index, old); eth_update_offsets (eth); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], eth->width); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [DIMENSION_CHANGE], 0, eth->width); + g_signal_emit (G_OBJECT (eth), eth_signals [STRUCTURE_CHANGE], 0); } /** @@ -653,7 +662,7 @@ e_table_header_remove (ETableHeader *eth, int idx) eth_do_remove (eth, idx, TRUE); enqueue(eth, -1, eth->nominal_width); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [STRUCTURE_CHANGE], 0); } /* @@ -724,7 +733,7 @@ eth_set_size (ETableHeader *eth, int idx, int size) eth->columns[i]->expansion = 0; } - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); return; } @@ -734,7 +743,7 @@ eth_set_size (ETableHeader *eth, int idx, int size) for (i = idx; i < eth->col_count; i++) { eth->columns[i]->expansion = 0; } - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); return; } @@ -751,7 +760,7 @@ eth_set_size (ETableHeader *eth, int idx, int size) for (i = idx + 1; i < eth->col_count; i++) { eth->columns[i]->expansion = 0; } - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); return; } @@ -776,7 +785,7 @@ eth_set_size (ETableHeader *eth, int idx, int size) eth->columns[i]->expansion = expansion / expandable_count; } } - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); return; } @@ -788,7 +797,7 @@ eth_set_size (ETableHeader *eth, int idx, int size) eth->columns[i]->expansion *= expansion / old_expansion; } } - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); } /** @@ -870,7 +879,7 @@ eth_calc_widths (ETableHeader *eth) } g_free (widths); if (changed) - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], eth->width); + g_signal_emit (G_OBJECT (eth), eth_signals [DIMENSION_CHANGE], 0, eth->width); eth_update_offsets (eth); } @@ -885,38 +894,17 @@ e_table_header_update_horizontal (ETableHeader *eth) for (i = 0; i < cols; i++) { int width = 0; - gtk_signal_emit_by_name (GTK_OBJECT (eth), + g_signal_emit_by_name (G_OBJECT (eth), "request_width", i, &width); eth->columns[i]->min_width = width + 10; eth->columns[i]->expansion = 1; } enqueue(eth, -1, eth->nominal_width); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]); + g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); } -GtkType -e_table_header_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableHeader", - sizeof (ETableHeader), - sizeof (ETableHeaderClass), - (GtkClassInitFunc) e_table_header_class_init, - (GtkObjectInitFunc) e_table_header_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} +E_MAKE_TYPE(e_table_header, "ETableHeader", ETableHeader, e_table_header_class_init, e_table_header_init, G_TYPE_OBJECT) int e_table_header_prioritized_column (ETableHeader *eth) diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h index c2ce0b2d71..3a9ae6a0bf 100644 --- a/widgets/table/e-table-header.h +++ b/widgets/table/e-table-header.h @@ -25,7 +25,7 @@ #ifndef _E_TABLE_COLUMN_H_ #define _E_TABLE_COLUMN_H_ -#include +#include #include #include #include @@ -35,10 +35,11 @@ G_BEGIN_DECLS typedef struct _ETableHeader ETableHeader; #define E_TABLE_HEADER_TYPE (e_table_header_get_type ()) -#define E_TABLE_HEADER(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader)) -#define E_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass)) -#define E_IS_TABLE_HEADER(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_TYPE)) -#define E_IS_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE)) +#define E_TABLE_HEADER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader)) +#define E_TABLE_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass)) +#define E_IS_TABLE_HEADER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_HEADER_TYPE)) +#define E_IS_TABLE_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE)) +#define E_TABLE_HEADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_HEADER_TYPE, ETableHeaderClass)) typedef gboolean (*ETableColCheckFunc) (ETableCol *col, gpointer user_data); @@ -46,7 +47,7 @@ typedef gboolean (*ETableColCheckFunc) (ETableCol *col, gpointer user_data); * A Columnar header. */ struct _ETableHeader { - GtkObject base; + GObject base; int col_count; int width; @@ -63,7 +64,7 @@ struct _ETableHeader { }; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; void (*structure_change) (ETableHeader *eth); void (*dimension_change) (ETableHeader *eth, int width); @@ -71,7 +72,7 @@ typedef struct { int (*request_width) (ETableHeader *eth, int col); } ETableHeaderClass; -GtkType e_table_header_get_type (void); +GType e_table_header_get_type (void); ETableHeader *e_table_header_new (void); void e_table_header_add_column (ETableHeader *eth, @@ -113,7 +114,6 @@ ETableCol *e_table_header_prioritized_column_selected (ETableHeader *e ETableColCheckFunc check_func, gpointer user_data); - G_END_DECLS #endif /* _E_TABLE_HEADER_H_ */ diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index e85eeb7106..df2adedc01 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -566,18 +566,18 @@ eti_remove_header_model (ETableItem *eti) if (!eti->header) return; - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_structure_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_dim_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_request_width_id); + g_signal_handler_disconnect (G_OBJECT (eti->header), + eti->header_structure_change_id); + g_signal_handler_disconnect (G_OBJECT (eti->header), + eti->header_dim_change_id); + g_signal_handler_disconnect (G_OBJECT (eti->header), + eti->header_request_width_id); if (eti->cell_views){ eti_unrealize_cell_views (eti); eti_detach_cell_views (eti); } - gtk_object_unref (GTK_OBJECT (eti->header)); + g_object_unref (G_OBJECT (eti->header)); eti->header_structure_change_id = 0; @@ -1366,21 +1366,21 @@ eti_add_header_model (ETableItem *eti, ETableHeader *header) g_assert (eti->header == NULL); eti->header = header; - gtk_object_ref (GTK_OBJECT (header)); + g_object_ref (G_OBJECT (header)); eti_header_structure_changed (header, eti); - eti->header_dim_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC (eti_header_dim_changed), eti); + eti->header_dim_change_id = g_signal_connect ( + G_OBJECT (header), "dimension_change", + G_CALLBACK (eti_header_dim_changed), eti); - eti->header_structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC (eti_header_structure_changed), eti); + eti->header_structure_change_id = g_signal_connect ( + G_OBJECT (header), "structure_change", + G_CALLBACK (eti_header_structure_changed), eti); - eti->header_request_width_id = gtk_signal_connect - (GTK_OBJECT (header), "request_width", - GTK_SIGNAL_FUNC (eti_request_column_width), eti); + eti->header_request_width_id = g_signal_connect + (G_OBJECT (header), "request_width", + G_CALLBACK (eti_request_column_width), eti); } /* @@ -2955,7 +2955,7 @@ eti_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, style_set), - gtk_marshal_NONE__POINTER, + gtk_marshal_NONE__OBJECT, GTK_TYPE_NONE, 1, GTK_TYPE_STYLE); E_OBJECT_CLASS_ADD_SIGNALS (object_class, eti_signals, LAST_SIGNAL); diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 0348189446..c0460e4524 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -22,16 +22,11 @@ */ #include -#include #include "e-table-search.h" #include "gal/util/e-util.h" #include -#define ETS_CLASS(e) ((ETableSearchClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - #define d(x) d(static gint depth = 0); @@ -43,7 +38,7 @@ struct _ETableSearchPrivate { gunichar last_character; }; -static GtkObjectClass *e_table_search_parent_class; +static GObjectClass *e_table_search_parent_class; enum { SEARCH_SEARCH, @@ -60,8 +55,9 @@ e_table_search_search (ETableSearch *e_table_search, char *string, ETableSearchF g_return_val_if_fail (e_table_search != NULL, FALSE); g_return_val_if_fail (E_IS_TABLE_SEARCH (e_table_search), FALSE); - gtk_signal_emit (GTK_OBJECT (e_table_search), - e_table_search_signals [SEARCH_SEARCH], string, flags, &ret_val); + g_signal_emit (G_OBJECT (e_table_search), + e_table_search_signals [SEARCH_SEARCH], + 0, string, flags, &ret_val); return ret_val; } @@ -72,8 +68,8 @@ e_table_search_accept (ETableSearch *e_table_search) g_return_if_fail (e_table_search != NULL); g_return_if_fail (E_IS_TABLE_SEARCH (e_table_search)); - gtk_signal_emit (GTK_OBJECT (e_table_search), - e_table_search_signals [SEARCH_ACCEPT]); + g_signal_emit (G_OBJECT (e_table_search), + e_table_search_signals [SEARCH_ACCEPT], 0); } static gboolean @@ -107,7 +103,7 @@ add_timeout (ETableSearch *ets) } static void -e_table_search_destroy (GtkObject *object) +e_table_search_finalize (GObject *object) { ETableSearch *ets = (ETableSearch *) object; @@ -115,35 +111,35 @@ e_table_search_destroy (GtkObject *object) g_free (ets->priv->search_string); g_free (ets->priv); - if (e_table_search_parent_class->destroy) - (*e_table_search_parent_class->destroy)(object); + if (e_table_search_parent_class->finalize) + (*e_table_search_parent_class->finalize)(object); } static void -e_table_search_class_init (GtkObjectClass *object_class) +e_table_search_class_init (GObjectClass *object_class) { ETableSearchClass *klass = E_TABLE_SEARCH_CLASS(object_class); - e_table_search_parent_class = gtk_type_class (PARENT_TYPE); + e_table_search_parent_class = g_type_class_peek_parent (klass); - object_class->destroy = e_table_search_destroy; + object_class->finalize = e_table_search_finalize; e_table_search_signals [SEARCH_SEARCH] = - gtk_signal_new ("search", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableSearchClass, search), - e_marshal_BOOLEAN__STRING_INT, - GTK_TYPE_BOOL, 2, GTK_TYPE_STRING, GTK_TYPE_INT); + g_signal_new ("search", + E_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableSearchClass, search), + (GSignalAccumulator) NULL, NULL, + e_marshal_BOOLEAN__STRING_INT, + G_TYPE_BOOLEAN, 2, G_TYPE_STRING, G_TYPE_INT); e_table_search_signals [SEARCH_ACCEPT] = - gtk_signal_new ("accept", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETableSearchClass, accept), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_table_search_signals, LAST_SIGNAL); + g_signal_new ("accept", + E_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableSearchClass, accept), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); klass->search = NULL; klass->accept = NULL; @@ -160,35 +156,12 @@ e_table_search_init (ETableSearch *ets) } -GtkType -e_table_search_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "ETableSearch", - sizeof (ETableSearch), - sizeof (ETableSearchClass), - (GtkClassInitFunc) e_table_search_class_init, - (GtkObjectInitFunc) e_table_search_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} +E_MAKE_TYPE(e_table_search, "ETableSearch", ETableSearch, e_table_search_class_init, e_table_search_init, G_TYPE_OBJECT) ETableSearch * e_table_search_new (void) { - ETableSearch *ets = gtk_type_new (e_table_search_get_type()); + ETableSearch *ets = g_object_new (E_TABLE_SEARCH_TYPE, NULL); return ets; } diff --git a/widgets/table/e-table-search.h b/widgets/table/e-table-search.h index 0c3e8b9bd9..b3cdd9ff41 100644 --- a/widgets/table/e-table-search.h +++ b/widgets/table/e-table-search.h @@ -29,10 +29,11 @@ G_BEGIN_DECLS #define E_TABLE_SEARCH_TYPE (e_table_search_get_type ()) -#define E_TABLE_SEARCH(o) (GTK_CHECK_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch)) -#define E_TABLE_SEARCH_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SEARCH_TYPE, ETableSearchClass)) -#define E_IS_TABLE_SEARCH(o) (GTK_CHECK_TYPE ((o), E_TABLE_SEARCH_TYPE)) -#define E_IS_TABLE_SEARCH_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SEARCH_TYPE)) +#define E_TABLE_SEARCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch)) +#define E_TABLE_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SEARCH_TYPE, ETableSearchClass)) +#define E_IS_TABLE_SEARCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SEARCH_TYPE)) +#define E_IS_TABLE_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SEARCH_TYPE)) +#define E_TABLE_SEARCH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SEARCH_TYPE, ETableSearchClass)) typedef struct _ETableSearchPrivate ETableSearchPrivate; @@ -41,13 +42,13 @@ typedef enum { } ETableSearchFlags; typedef struct { - GtkObject base; + GObject base; ETableSearchPrivate *priv; } ETableSearch; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; /* * Signals @@ -56,7 +57,7 @@ typedef struct { void (*accept) (ETableSearch *ets); } ETableSearchClass; -GtkType e_table_search_get_type (void); +GType e_table_search_get_type (void); ETableSearch *e_table_search_new (void); /**/ diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c index c84d6c15c0..0062e03699 100644 --- a/widgets/table/e-table-sorted.c +++ b/widgets/table/e-table-sorted.c @@ -69,7 +69,7 @@ ets_destroy (GtkObject *object) } if (ets->full_header) - gtk_object_unref(GTK_OBJECT(ets->full_header)); + g_object_unref(G_OBJECT(ets->full_header)); ets->full_header = NULL; GTK_OBJECT_CLASS (ets_parent_class)->destroy (object); @@ -141,7 +141,7 @@ e_table_sorted_new (ETableModel *source, ETableHeader *full_header, ETableSortIn ets->sort_info = sort_info; gtk_object_ref(GTK_OBJECT(ets->sort_info)); ets->full_header = full_header; - gtk_object_ref(GTK_OBJECT(ets->full_header)); + g_object_ref(G_OBJECT(ets->full_header)); ets_proxy_model_changed(etss, source); diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c index 8c530dca90..673969b752 100644 --- a/widgets/table/e-table-sorter.c +++ b/widgets/table/e-table-sorter.c @@ -91,7 +91,7 @@ ets_destroy (GtkObject *object) ets->sort_info = NULL; if (ets->full_header) - gtk_object_unref(GTK_OBJECT(ets->full_header)); + g_object_unref(G_OBJECT(ets->full_header)); ets->full_header = NULL; if (ets->source) @@ -191,7 +191,7 @@ e_table_sorter_new (ETableModel *source, ETableHeader *full_header, ETableSortIn ets->sort_info = sort_info; gtk_object_ref(GTK_OBJECT(ets->sort_info)); ets->full_header = full_header; - gtk_object_ref(GTK_OBJECT(ets->full_header)); + g_object_ref(G_OBJECT(ets->full_header)); ets->source = source; gtk_object_ref(GTK_OBJECT(ets->source)); diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 6d8653b6d6..6c1b4d7b04 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -30,18 +30,15 @@ #include #include -#include #include #include #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *etsp_parent_class; +static GObjectClass *etsp_parent_class; static void -etsp_destroy (GtkObject *object) +etsp_finalize (GObject *object) { ETableSpecification *etsp = E_TABLE_SPECIFICATION (object); int i; @@ -64,15 +61,15 @@ etsp_destroy (GtkObject *object) g_free (etsp->domain); etsp->domain = NULL; - GTK_OBJECT_CLASS (etsp_parent_class)->destroy (object); + etsp_parent_class->finalize (object); } static void -etsp_class_init (GtkObjectClass *klass) +etsp_class_init (GObjectClass *klass) { - etsp_parent_class = gtk_type_class (PARENT_TYPE); + etsp_parent_class = g_type_class_peek_parent (klass); - klass->destroy = etsp_destroy; + klass->finalize = etsp_finalize; } static void @@ -99,7 +96,7 @@ etsp_init (ETableSpecification *etsp) etsp->domain = NULL; } -E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, PARENT_TYPE) +E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, G_TYPE_OBJECT) /** * e_table_specification_new: @@ -112,7 +109,7 @@ E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, ETableSpecification * e_table_specification_new (void) { - ETableSpecification *etsp = gtk_type_new (E_TABLE_SPECIFICATION_TYPE); + ETableSpecification *etsp = g_object_new (E_TABLE_SPECIFICATION_TYPE, NULL); return (ETableSpecification *) etsp; } diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index 92f52a4f42..961752b9b8 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -24,25 +24,24 @@ #ifndef _E_TABLE_SPECIFICATION_H_ #define _E_TABLE_SPECIFICATION_H_ -#include +#include #include #include #include #include #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define E_TABLE_SPECIFICATION_TYPE (e_table_specification_get_type ()) -#define E_TABLE_SPECIFICATION(o) (GTK_CHECK_CAST ((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecification)) -#define E_TABLE_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass)) -#define E_IS_TABLE_SPECIFICATION(o) (GTK_CHECK_TYPE ((o), E_TABLE_SPECIFICATION_TYPE)) -#define E_IS_TABLE_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SPECIFICATION_TYPE)) +#define E_TABLE_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecification)) +#define E_TABLE_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass)) +#define E_IS_TABLE_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SPECIFICATION_TYPE)) +#define E_IS_TABLE_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SPECIFICATION_TYPE)) +#define E_TABLE_SPECIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass)) typedef struct { - GtkObject base; + GObject base; ETableColumnSpecification **columns; ETableState *state; @@ -65,10 +64,10 @@ typedef struct { } ETableSpecification; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; } ETableSpecificationClass; -GtkType e_table_specification_get_type (void); +GType e_table_specification_get_type (void); ETableSpecification *e_table_specification_new (void); gboolean e_table_specification_load_from_file (ETableSpecification *specification, @@ -85,8 +84,6 @@ xmlNode *e_table_specification_save_to_node (ETableSpecificatio xmlDoc *doc); ETableSpecification *e_table_specification_duplicate (ETableSpecification *spec); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _E_TABLE_SPECIFICATION_H_ */ diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index 3af68ea2a3..b896ae3944 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -34,16 +34,17 @@ e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableSta ETableHeader *nh; const int max_cols = e_table_header_count (full_header); int column; + GValue *val = g_new0 (GValue, 1); g_return_val_if_fail (widget, NULL); g_return_val_if_fail (full_header, NULL); g_return_val_if_fail (state, NULL); nh = e_table_header_new (); - - gtk_object_set(GTK_OBJECT(nh), - "width_extras", e_table_header_width_extras(widget->style), - NULL); + g_value_init (val, G_TYPE_DOUBLE); + g_value_set_double (val, e_table_header_width_extras (widget->style)); + g_object_set_property (G_OBJECT(nh), "width_extras", val); + g_free (val); for (column = 0; column < state->col_count; column++) { int col; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 5772c26fc7..a97e291bfe 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -269,16 +269,16 @@ disconnect_header (ETable *e_table) return; if (e_table->structure_change_id) - gtk_signal_disconnect (GTK_OBJECT (e_table->header), - e_table->structure_change_id); + g_signal_handler_disconnect (G_OBJECT (e_table->header), + e_table->structure_change_id); if (e_table->expansion_change_id) - gtk_signal_disconnect (GTK_OBJECT (e_table->header), - e_table->expansion_change_id); + g_signal_handler_disconnect (G_OBJECT (e_table->header), + e_table->expansion_change_id); if (e_table->dimension_change_id) - gtk_signal_disconnect (GTK_OBJECT (e_table->header), - e_table->dimension_change_id); + g_signal_handler_disconnect (G_OBJECT (e_table->header), + e_table->dimension_change_id); - gtk_object_unref(GTK_OBJECT(e_table->header)); + g_object_unref(G_OBJECT(e_table->header)); e_table->header = NULL; } @@ -291,14 +291,14 @@ connect_header (ETable *e_table, ETableState *state) e_table->header = e_table_state_to_header (GTK_WIDGET(e_table), e_table->full_header, state); e_table->structure_change_id = - gtk_signal_connect (GTK_OBJECT (e_table->header), "structure_change", - GTK_SIGNAL_FUNC (structure_changed), e_table); + g_signal_connect (G_OBJECT (e_table->header), "structure_change", + G_CALLBACK (structure_changed), e_table); e_table->expansion_change_id = - gtk_signal_connect (GTK_OBJECT (e_table->header), "expansion_change", - GTK_SIGNAL_FUNC (expansion_changed), e_table); + g_signal_connect (G_OBJECT (e_table->header), "expansion_change", + G_CALLBACK (expansion_changed), e_table); e_table->dimension_change_id = - gtk_signal_connect (GTK_OBJECT (e_table->header), "dimension_change", - GTK_SIGNAL_FUNC (dimension_changed), e_table); + g_signal_connect (G_OBJECT (e_table->header), "dimension_change", + G_CALLBACK (dimension_changed), e_table); } static void @@ -310,12 +310,12 @@ et_destroy (GtkObject *object) if (et->search) { if (et->search_search_id) - gtk_signal_disconnect (GTK_OBJECT (et->search), - et->search_search_id); + g_signal_handler_disconnect (G_OBJECT (et->search), + et->search_search_id); if (et->search_accept_id) - gtk_signal_disconnect (GTK_OBJECT (et->search), - et->search_accept_id); - gtk_object_unref (GTK_OBJECT (et->search)); + g_signal_handler_disconnect (G_OBJECT (et->search), + et->search_accept_id); + g_object_unref (G_OBJECT (et->search)); et->search = NULL; } @@ -346,7 +346,7 @@ et_destroy (GtkObject *object) } if (et->full_header) { - gtk_object_unref (GTK_OBJECT (et->full_header)); + g_object_unref (G_OBJECT (et->full_header)); et->full_header = NULL; } @@ -366,7 +366,7 @@ et_destroy (GtkObject *object) } if (et->spec) { - gtk_object_unref (GTK_OBJECT (et->spec)); + g_object_unref (G_OBJECT (et->spec)); et->spec = NULL; } @@ -486,11 +486,11 @@ init_search (ETable *e_table) e_table->search = e_table_search_new(); e_table->search_search_id = - gtk_signal_connect (GTK_OBJECT (e_table->search), "search", - GTK_SIGNAL_FUNC (et_search_search), e_table); + g_signal_connect (G_OBJECT (e_table->search), "search", + G_CALLBACK (et_search_search), e_table); e_table->search_accept_id = - gtk_signal_connect (GTK_OBJECT (e_table->search), "accept", - GTK_SIGNAL_FUNC (et_search_accept), e_table); + g_signal_connect (G_OBJECT (e_table->search), "accept", + G_CALLBACK (et_search_accept), e_table); } static void @@ -718,8 +718,11 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, gdouble width; gdouble height; gdouble item_height; + GValue *val = g_new0 (GValue, 1); + g_value_init (val, G_TYPE_DOUBLE); width = alloc->width; + g_value_set_double (val, width); gtk_object_get (GTK_OBJECT (e_table->canvas_vbox), "height", &height, NULL); @@ -729,9 +732,8 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, gtk_object_set (GTK_OBJECT (e_table->canvas_vbox), "width", width, NULL); - gtk_object_set (GTK_OBJECT (e_table->header), - "width", width, - NULL); + g_object_set_property (G_OBJECT (e_table->header), "width", val); + g_free (val); if (e_table->reflow_idle_id) g_source_remove(e_table->reflow_idle_id); table_canvas_reflow_idle(e_table); @@ -1238,10 +1240,14 @@ e_table_fill_table (ETable *e_table, ETableModel *model) void e_table_set_state_object(ETable *e_table, ETableState *state) { + GValue *val = g_new0 (GValue, 1); + g_value_init (val, G_TYPE_DOUBLE); + connect_header (e_table, state); - gtk_object_set (GTK_OBJECT (e_table->header), - "width", (double) (GTK_WIDGET(e_table->table_canvas)->allocation.width), - NULL); + + g_value_set_double (val, (double) (GTK_WIDGET(e_table->table_canvas)->allocation.width)); + g_object_set_property (G_OBJECT (e_table->header), "width", val); + g_free (val); if (e_table->sort_info) { if (e_table->group_info_change_id) @@ -1444,13 +1450,14 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, { int row = 0; int col_count, i; + GValue *val = g_new0 (GValue, 1); + g_value_init (val, G_TYPE_OBJECT); if (ete) - gtk_object_ref(GTK_OBJECT(ete)); + g_object_ref(G_OBJECT(ete)); else { ete = e_table_extras_new(); - gtk_object_ref(GTK_OBJECT(ete)); - gtk_object_sink(GTK_OBJECT(ete)); + g_object_ref(G_OBJECT(ete)); } e_table->domain = g_strdup (specification->domain); @@ -1466,8 +1473,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->draw_focus = specification->draw_focus; e_table->cursor_mode = specification->cursor_mode; e_table->full_header = e_table_spec_to_full_header(specification, ete); - gtk_object_ref (GTK_OBJECT (e_table->full_header)); - gtk_object_sink (GTK_OBJECT (e_table->full_header)); + g_object_ref (G_OBJECT (e_table->full_header)); col_count = e_table_header_count (e_table->full_header); for (i = 0; i < col_count; i++) { @@ -1502,9 +1508,9 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, GTK_SIGNAL_FUNC (sort_info_changed), e_table); - gtk_object_set(GTK_OBJECT(e_table->header), - "sort_info", e_table->sort_info, - NULL); + g_value_set_object (val, e_table->sort_info); + g_object_set_property (G_OBJECT(e_table->header), "sort_info", val); + g_free (val); e_table->sorter = e_table_sorter_new(etm, e_table->full_header, e_table->sort_info); gtk_object_ref (GTK_OBJECT (e_table->sorter)); @@ -1552,7 +1558,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, gtk_widget_pop_colormap (); - gtk_object_unref(GTK_OBJECT(ete)); + g_object_unref(G_OBJECT(ete)); return e_table; } @@ -1589,10 +1595,9 @@ e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, gtk_object_sink (GTK_OBJECT (etm)); specification = e_table_specification_new(); - gtk_object_ref (GTK_OBJECT (specification)); - gtk_object_sink (GTK_OBJECT (specification)); + g_object_ref (G_OBJECT (specification)); if (!e_table_specification_load_from_string(specification, spec_str)) { - gtk_object_unref(GTK_OBJECT(specification)); + g_object_unref(G_OBJECT(specification)); return NULL; } @@ -1650,7 +1655,7 @@ e_table_construct_from_spec_file (ETable *e_table, ETableModel *etm, ETableExtra specification = e_table_specification_new(); if (!e_table_specification_load_from_file(specification, spec_fn)) { - gtk_object_unref(GTK_OBJECT(specification)); + g_object_unref(G_OBJECT(specification)); return NULL; } diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 0e6cf3ebf9..13f32f54a1 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -1330,7 +1330,7 @@ e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *ful ets->priv->full_header = full_header; if (full_header) - gtk_object_ref(GTK_OBJECT(full_header)); + g_object_ref(G_OBJECT(full_header)); ets->priv->sort_info = sort_info; if (sort_info) diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index c4cb8173ce..9383de1646 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -321,11 +321,11 @@ disconnect_header (ETree *e_tree) return; if (e_tree->priv->structure_change_id) - gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->header), - e_tree->priv->structure_change_id); + g_signal_handler_disconnect (G_OBJECT (e_tree->priv->header), + e_tree->priv->structure_change_id); if (e_tree->priv->expansion_change_id) - gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->header), - e_tree->priv->expansion_change_id); + g_signal_handler_disconnect (G_OBJECT (e_tree->priv->header), + 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), @@ -336,7 +336,7 @@ disconnect_header (ETree *e_tree) gtk_object_unref(GTK_OBJECT(e_tree->priv->sort_info)); } - gtk_object_unref(GTK_OBJECT(e_tree->priv->header)); + g_object_unref(G_OBJECT(e_tree->priv->header)); e_tree->priv->header = NULL; e_tree->priv->sort_info = NULL; } @@ -344,17 +344,19 @@ disconnect_header (ETree *e_tree) static void connect_header (ETree *e_tree, ETableState *state) { + GValue *val = g_new0 (GValue, 1); + if (e_tree->priv->header != NULL) disconnect_header (e_tree); e_tree->priv->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->priv->full_header, state); e_tree->priv->structure_change_id = - gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "structure_change", - GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); + g_signal_connect (G_OBJECT (e_tree->priv->header), "structure_change", + G_CALLBACK (search_col_change_trigger), e_tree); e_tree->priv->expansion_change_id = - gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "expansion_change", - GTK_SIGNAL_FUNC (change_trigger), e_tree); + g_signal_connect (G_OBJECT (e_tree->priv->header), "expansion_change", + G_CALLBACK (change_trigger), e_tree); if (state->sort_info) { e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info); @@ -368,9 +370,10 @@ connect_header (ETree *e_tree, ETableState *state) } else e_tree->priv->sort_info = NULL; - gtk_object_set(GTK_OBJECT(e_tree->priv->header), - "sort_info", e_tree->priv->sort_info, - NULL); + g_value_init (val, G_TYPE_OBJECT); + g_value_set_object (val, e_tree->priv->sort_info); + g_object_set_property (G_OBJECT(e_tree->priv->header), "sort_info", val); + g_free (val); } static void @@ -382,12 +385,12 @@ et_destroy (GtkObject *object) if (et->priv->search) { if (et->priv->search_search_id) - gtk_signal_disconnect (GTK_OBJECT (et->priv->search), - et->priv->search_search_id); + g_signal_handler_disconnect (G_OBJECT (et->priv->search), + et->priv->search_search_id); if (et->priv->search_accept_id) - gtk_signal_disconnect (GTK_OBJECT (et->priv->search), - et->priv->search_accept_id); - gtk_object_unref (GTK_OBJECT (et->priv->search)); + g_signal_handler_disconnect (G_OBJECT (et->priv->search), + et->priv->search_accept_id); + g_object_unref (G_OBJECT (et->priv->search)); } if (et->priv->reflow_idle_id) @@ -403,17 +406,20 @@ et_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (et->priv->etta)); gtk_object_unref (GTK_OBJECT (et->priv->model)); gtk_object_unref (GTK_OBJECT (et->priv->sorted)); - gtk_object_unref (GTK_OBJECT (et->priv->full_header)); + g_object_unref (G_OBJECT (et->priv->full_header)); disconnect_header (et); gtk_object_unref (GTK_OBJECT (et->priv->selection)); if (et->priv->spec) - gtk_object_unref (GTK_OBJECT (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)); + et->priv->sorter = NULL; if (et->priv->header_canvas) gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas)); + et->priv->header_canvas = NULL; if (et->priv->site) e_tree_drag_source_unset (et); @@ -603,11 +609,11 @@ e_tree_init (GtkObject *object) e_tree->priv->search = e_table_search_new(); e_tree->priv->search_search_id = - gtk_signal_connect (GTK_OBJECT (e_tree->priv->search), "search", - GTK_SIGNAL_FUNC (et_search_search), e_tree); + g_signal_connect (G_OBJECT (e_tree->priv->search), "search", + G_CALLBACK (et_search_search), e_tree); e_tree->priv->search_accept_id = - gtk_signal_connect (GTK_OBJECT (e_tree->priv->search), "accept", - GTK_SIGNAL_FUNC (et_search_accept), e_tree); + g_signal_connect (G_OBJECT (e_tree->priv->search), "accept", + G_CALLBACK (et_search_accept), e_tree); e_tree->priv->current_search_col = NULL; e_tree->priv->search_col_set = FALSE; @@ -745,8 +751,11 @@ tree_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, gdouble width; gdouble height; gdouble item_height; + GValue *val = g_new0 (GValue, 1); + g_value_init (val, G_TYPE_DOUBLE); width = alloc->width; + g_value_set_double (val, width); gtk_object_get (GTK_OBJECT (e_tree->priv->item), "height", &height, NULL); @@ -756,9 +765,8 @@ tree_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, gtk_object_set (GTK_OBJECT (e_tree->priv->item), "width", width, NULL); - gtk_object_set (GTK_OBJECT (e_tree->priv->header), - "width", width, - NULL); + g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val); + g_free (val); if (e_tree->priv->reflow_idle_id) g_source_remove(e_tree->priv->reflow_idle_id); tree_canvas_reflow_idle(e_tree); @@ -1529,7 +1537,7 @@ e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *e specification = e_table_specification_new(); if (!e_table_specification_load_from_file(specification, spec_fn)) { - gtk_object_unref(GTK_OBJECT(specification)); + g_object_unref(G_OBJECT(specification)); return NULL; } -- cgit v1.2.3