diff options
author | Hiroyuki Ikezoe <poincare@ikezoe.net> | 2007-07-28 05:14:15 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-07-28 05:14:15 +0800 |
commit | 6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f (patch) | |
tree | 64868338277e36a40c6b37106dfb8112fc278264 /widgets/table | |
parent | 08de5e9e147248b84bc1fa618f7cc9d892ddb136 (diff) | |
download | gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar.gz gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar.zst gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.zip |
Remove E_MAKE_TYPE macro.
2007-07-27 Hiroyuki Ikezoe <poincare@ikezoe.net>
* e-util/e-util.h: Remove E_MAKE_TYPE macro.
* e-util/e-bit-array.c:
* e-util/e-sorter-array.c:
* e-util/e-sorter.c:
* e-util/e-text-event-processor-emacs-like.c:
* e-util/e-text-event-processor.c:
* widgets/menus/gal-define-views-dialog.c:
* widgets/menus/gal-define-views-model.c:
* widgets/menus/gal-view-collection.c:
* widgets/menus/gal-view-etable.c:
* widgets/menus/gal-view-factory-etable.c:
* widgets/menus/gal-view-factory.c:
* widgets/menus/gal-view-instance-save-as-dialog.c:
* widgets/menus/gal-view-instance.c:
* widgets/menus/gal-view-new-dialog.c:
* widgets/menus/gal-view.c:
* widgets/misc/e-canvas-background.c:
* widgets/misc/e-canvas-vbox.c:
* widgets/misc/e-canvas.c:
* widgets/misc/e-printable.c:
* widgets/misc/e-reflow-model.c:
* widgets/misc/e-reflow.c:
* widgets/misc/e-selection-model-array.c:
* widgets/misc/e-selection-model-simple.c:
* widgets/misc/e-selection-model.c:
* widgets/table/e-cell-checkbox.c:
* widgets/table/e-cell-combo.c:
* widgets/table/e-cell-date.c:
* widgets/table/e-cell-float.c:
* widgets/table/e-cell-hbox.c:
* widgets/table/e-cell-number.c:
* widgets/table/e-cell-pixbuf.c:
* widgets/table/e-cell-popup.c:
* widgets/table/e-cell-progress.c:
* widgets/table/e-cell-size.c:
* widgets/table/e-cell-spin-button.c:
* widgets/table/e-cell-text.c:
* widgets/table/e-cell-toggle.c:
* widgets/table/e-cell-tree.c:
* widgets/table/e-cell-vbox.c:
* widgets/table/e-cell.c:
* widgets/table/e-table-click-to-add.c:
* widgets/table/e-table-col.c:
* widgets/table/e-table-column-specification.c:
* widgets/table/e-table-column.c:
* widgets/table/e-table-config-field.c:
* widgets/table/e-table-config.c:
* widgets/table/e-table-extras.c:
* widgets/table/e-table-field-chooser-dialog.c:
* widgets/table/e-table-field-chooser-item.c:
* widgets/table/e-table-field-chooser.c:
* widgets/table/e-table-group-container.c:
* widgets/table/e-table-group-leaf.c:
* widgets/table/e-table-group.c:
* widgets/table/e-table-header-item.c:
* widgets/table/e-table-header.c:
* widgets/table/e-table-item.c:
* widgets/table/e-table-memory-callbacks.c:
* widgets/table/e-table-memory-store.c:
* widgets/table/e-table-memory.c:
* widgets/table/e-table-model.c:
* widgets/table/e-table-one.c:
* widgets/table/e-table-scrolled.c:
* widgets/table/e-table-search.c:
* widgets/table/e-table-selection-model.c:
* widgets/table/e-table-simple.c:
* widgets/table/e-table-sort-info.c:
* widgets/table/e-table-sorted-variable.c:
* widgets/table/e-table-sorted.c:
* widgets/table/e-table-sorter.c:
* widgets/table/e-table-specification.c:
* widgets/table/e-table-state.c:
* widgets/table/e-table-subset-variable.c:
* widgets/table/e-table-subset.c:
* widgets/table/e-table-without.c:
* widgets/table/e-table.c:
* widgets/table/e-tree-memory-callbacks.c:
* widgets/table/e-tree-memory.c:
* widgets/table/e-tree-model.c:
* widgets/table/e-tree-scrolled.c:
* widgets/table/e-tree-selection-model.c:
* widgets/table/e-tree-simple.c:
* widgets/table/e-tree-sorted-variable.c:
* widgets/table/e-tree-sorted.c:
* widgets/table/e-tree-table-adapter.c:
* widgets/table/e-tree.c:
* widgets/text/e-completion-callbacks.c:
* widgets/text/e-completion-view.c:
* widgets/text/e-completion.c:
* widgets/text/e-entry.c:
* widgets/text/e-table-text-model.c:
* widgets/text/e-text-model-uri.c:
* widgets/text/e-text-model.c:
* widgets/text/e-text.c:
Use G_DEFINE_TYPE instead of E_MAKE_TYPE.
svn path=/trunk/; revision=33864
Diffstat (limited to 'widgets/table')
62 files changed, 555 insertions, 719 deletions
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index b0313a186b..b651b441bb 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,3 +1,67 @@ +2007-07-27 Hiroyuki Ikezoe <poincare@ikezoe.net> + + * e-cell-tree.c: + * e-cell-hbox.c: + * e-cell-popup.c: + * e-tree-simple.c: + * e-cell-date.c: + * e-tree-table-adapter.c: + * e-tree-scrolled.c: + * e-table-field-chooser.c: + * e-table-header-item.c: + * e-cell-pixbuf.c: + * e-table-subset-variable.c: + * e-tree-selection-model.c: + * e-tree-sorted-variable.c: + * e-tree-memory-callbacks.c: + * e-table-sorted.c: + * e-table-subset.c: + * e-table-search.c: + * e-table-extras.c: + * e-table-one.c: + * e-table-config-field.c: + * e-cell-combo.c: + * e-table-item.c: + * e-cell-toggle.c: + * e-tree.c: + * e-table-col.c: + * e-table-field-chooser-item.c: + * e-table-sort-info.c: + * e-table-simple.c: + * e-table-column.c: + * e-table-scrolled.c: + * e-tree-model.c: + * e-table-column-specification.c: + * e-table-group-container.c: + * e-cell-text.c: + * e-table-specification.c: + * e-cell-number.c: + * e-table-sorted-variable.c: + * e-table-selection-model.c: + * e-table-memory-callbacks.c: + * e-cell.c: + * e-table-click-to-add.c: + * e-cell-float.c: + * e-table-field-chooser-dialog.c: + * e-tree-memory.c: + * e-cell-progress.c: + * e-table-group-leaf.c: + * e-table.c: + * e-table-sorter.c: + * e-table-header.c: + * e-table-group.c: + * e-table-model.c: + * e-cell-size.c: + * e-table-without.c: + * e-table-config.c: + * e-cell-vbox.c: + * e-tree-sorted.c: + * e-table-state.c: + * e-table-memory-store.c: + * e-table-memory.c: + * e-cell-spin-button.c: + * e-cell-checkbox.c: Use G_DEFINE_TYPE instead of E_MAKE_TYPE. + 2007-07-27 Matthew Barnes <mbarnes@redhat.com> * Makefile.am: diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c index 8f3c8083fe..7054b9c27d 100644 --- a/widgets/table/e-cell-checkbox.c +++ b/widgets/table/e-cell-checkbox.c @@ -34,7 +34,7 @@ #include "check-empty.xpm" #include "check-filled.xpm" -#define PARENT_TYPE e_cell_toggle_get_type () +G_DEFINE_TYPE (ECellCheckbox, e_cell_checkbox, E_CELL_TOGGLE_TYPE) static GdkPixbuf *checks [2]; @@ -60,15 +60,19 @@ ecc_print (ECellView *ecell_view, GtkPrintContext *context, } static void -e_cell_checkbox_class_init (GtkObjectClass *object_class) +e_cell_checkbox_class_init (ECellCheckboxClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + ECellClass *ecc = E_CELL_CLASS (klass); + ecc->print = ecc_print; checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm); checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm); } -E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE) +static void +e_cell_checkbox_init (ECellCheckbox *eccb) +{ +} /** * e_cell_checkbox_new: diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index e7fc235a05..5a852d99bd 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -77,7 +77,7 @@ #define E_CELL_COMBO_UTF8_KEY "UTF-8-TEXT" -static void e_cell_combo_class_init (GObjectClass *object_class); +static void e_cell_combo_class_init (ECellComboClass *klass); static void e_cell_combo_init (ECellCombo *ecc); static void e_cell_combo_dispose (GObject *object); @@ -114,25 +114,17 @@ static int e_cell_combo_key_press (GtkWidget *popup_window, static void e_cell_combo_update_cell (ECellCombo *ecc); static void e_cell_combo_restart_edit (ECellCombo *ecc); - -static ECellPopupClass *parent_class; - - -E_MAKE_TYPE (e_cell_combo, "ECellCombo", ECellCombo, - e_cell_combo_class_init, e_cell_combo_init, - e_cell_popup_get_type()) - +G_DEFINE_TYPE (ECellCombo, e_cell_combo, E_CELL_POPUP_TYPE) static void -e_cell_combo_class_init (GObjectClass *object_class) +e_cell_combo_class_init (ECellComboClass *klass) { - ECellPopupClass *ecpc = (ECellPopupClass *) object_class; + ECellPopupClass *ecpc = E_CELL_POPUP_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = e_cell_combo_dispose; ecpc->popup = e_cell_combo_do_popup; - - parent_class = g_type_class_ref (E_CELL_POPUP_TYPE); } @@ -228,7 +220,7 @@ e_cell_combo_dispose (GObject *object) gtk_widget_destroy (ecc->popup_window); ecc->popup_window = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_combo_parent_class)->dispose (object); } diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c index 85f2324ad4..f40967c60e 100644 --- a/widgets/table/e-cell-date.c +++ b/widgets/table/e-cell-date.c @@ -33,15 +33,13 @@ #include "e-cell-date.h" -#define PARENT_TYPE e_cell_text_get_type () +G_DEFINE_TYPE (ECellDate, e_cell_date, E_CELL_TEXT_TYPE) #ifdef G_OS_WIN32 /* The localtime() in Microsoft's C library *is* thread-safe */ #define localtime_r(timep, result) (localtime (timep) ? memcpy ((result), localtime (timep), sizeof (*(result))) : 0) #endif -static ECellTextClass *parent_class; - static char * ecd_get_text(ECellText *cell, ETableModel *model, int col, int row) { @@ -118,18 +116,16 @@ ecd_free_text(ECellText *cell, char *text) } static void -e_cell_date_class_init (GtkObjectClass *object_class) +e_cell_date_class_init (ECellDateClass *klass) { - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); ectc->get_text = ecd_get_text; ectc->free_text = ecd_free_text; } static void -e_cell_date_init (GtkObject *object) +e_cell_date_init (ECellDate *ecd) { } @@ -168,4 +164,3 @@ e_cell_date_new (const char *fontname, GtkJustification justify) return (ECell *) ecd; } -E_MAKE_TYPE(e_cell_date, "ECellDate", ECellDate, e_cell_date_class_init, e_cell_date_init, PARENT_TYPE) diff --git a/widgets/table/e-cell-float.c b/widgets/table/e-cell-float.c index 2ab6111a33..10a1682be3 100644 --- a/widgets/table/e-cell-float.c +++ b/widgets/table/e-cell-float.c @@ -34,9 +34,7 @@ #include "e-cell-float.h" -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; +G_DEFINE_TYPE (ECellFloat, e_cell_float, E_CELL_TEXT_TYPE) static char * ecf_get_text(ECellText *cell, ETableModel *model, int col, int row) @@ -55,18 +53,16 @@ ecf_free_text(ECellText *cell, char *text) } static void -e_cell_float_class_init (GtkObjectClass *object_class) +e_cell_float_class_init (ECellFloatClass *klass) { - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); ectc->get_text = ecf_get_text; ectc->free_text = ecf_free_text; } static void -e_cell_float_init (GtkObject *object) +e_cell_float_init (ECellFloat *cell_float) { } @@ -93,4 +89,3 @@ e_cell_float_new (const char *fontname, GtkJustification justify) return (ECell *) ecn; } -E_MAKE_TYPE(e_cell_float, "ECellFloat", ECellFloat, e_cell_float_class_init, e_cell_float_init, PARENT_TYPE) diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c index f00ab3f4eb..58f8f7194b 100644 --- a/widgets/table/e-cell-hbox.c +++ b/widgets/table/e-cell-hbox.c @@ -41,9 +41,7 @@ #include "e-cell-hbox.h" #include "e-table-item.h" -#define PARENT_TYPE e_cell_get_type () - -static ECellClass *parent_class; +G_DEFINE_TYPE (ECellHbox, e_cell_hbox, E_CELL_TYPE) #define INDENT_AMOUNT 16 #define MAX_CELL_SIZE 25 @@ -117,8 +115,8 @@ ecv_realize (ECellView *ecell_view) for (i = 0; i < hbox_view->subcell_view_count; i++) e_cell_realize (hbox_view->subcell_views[i]); - if (parent_class->realize) - (* parent_class->realize) (ecell_view); + if (E_CELL_CLASS (e_cell_hbox_parent_class)->realize) + (* E_CELL_CLASS (e_cell_hbox_parent_class)->realize) (ecell_view); } /* @@ -134,8 +132,8 @@ ecv_unrealize (ECellView *ecv) for (i = 0; i < hbox_view->subcell_view_count; i++) e_cell_unrealize (hbox_view->subcell_views[i]); - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); + if (E_CELL_CLASS (e_cell_hbox_parent_class)->unrealize) + (* E_CELL_CLASS (e_cell_hbox_parent_class)->unrealize) (ecv); } /* @@ -260,13 +258,14 @@ ecv_dispose (GObject *object) ecv->subcells = NULL; ecv->subcell_count = 0; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_hbox_parent_class)->dispose (object); } static void -e_cell_hbox_class_init (GObjectClass *object_class) +e_cell_hbox_class_init (ECellHboxClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (klass); object_class->dispose = ecv_dispose; @@ -280,22 +279,16 @@ e_cell_hbox_class_init (GObjectClass *object_class) ecc->max_width = ecv_max_width; - parent_class = g_type_class_ref (PARENT_TYPE); - /* gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_HBOX_TYPE, gal_a11y_e_cell_hbox_new); */ } static void -e_cell_hbox_init (GtkObject *object) +e_cell_hbox_init (ECellHbox *ecv) { - ECellHbox *ecv = E_CELL_HBOX (object); - ecv->subcells = NULL; ecv->subcell_count = 0; } -E_MAKE_TYPE(e_cell_hbox, "ECellHbox", ECellHbox, e_cell_hbox_class_init, e_cell_hbox_init, PARENT_TYPE) - /** * e_cell_hbox_new: * diff --git a/widgets/table/e-cell-number.c b/widgets/table/e-cell-number.c index e32eca7fe3..02e3001a18 100644 --- a/widgets/table/e-cell-number.c +++ b/widgets/table/e-cell-number.c @@ -30,9 +30,7 @@ #include "e-cell-number.h" -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; +G_DEFINE_TYPE (ECellNumber, e_cell_number, E_CELL_TEXT_TYPE) static char * ecn_get_text(ECellText *cell, ETableModel *model, int col, int row) @@ -47,18 +45,16 @@ ecn_free_text(ECellText *cell, char *text) } static void -e_cell_number_class_init (GtkObjectClass *object_class) +e_cell_number_class_init (ECellNumberClass *klass) { - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); ectc->get_text = ecn_get_text; ectc->free_text = ecn_free_text; } static void -e_cell_number_init (GtkObject *object) +e_cell_number_init (ECellNumber *cell_number) { } @@ -85,4 +81,3 @@ e_cell_number_new (const char *fontname, GtkJustification justify) return (ECell *) ecn; } -E_MAKE_TYPE(e_cell_number, "ECellNumber", ECellNumber, e_cell_number_class_init, e_cell_number_init, PARENT_TYPE) diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index 8b341c48a9..d7a1c8c1e4 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -31,8 +31,7 @@ #include <gtk/gtk.h> #include "e-cell-pixbuf.h" -#define PARENT_TYPE E_CELL_TYPE -static ECellClass *parent_class; +G_DEFINE_TYPE (ECellPixbuf, e_cell_pixbuf, E_CELL_TYPE) typedef struct _ECellPixbufView ECellPixbufView; @@ -290,8 +289,8 @@ pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col) static void pixbuf_dispose (GObject *object) { - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_cell_pixbuf_parent_class)->dispose) + (* G_OBJECT_CLASS (e_cell_pixbuf_parent_class)->dispose) (object); } static void @@ -353,19 +352,18 @@ pixbuf_get_property (GObject *object, } static void -e_cell_pixbuf_init (GtkObject *object) +e_cell_pixbuf_init (ECellPixbuf *ecp) { - ECellPixbuf *ecp = E_CELL_PIXBUF (object); - ecp->selected_column = -1; ecp->focused_column = -1; ecp->unselected_column = -1; } static void -e_cell_pixbuf_class_init (GObjectClass *object_class) +e_cell_pixbuf_class_init (ECellPixbufClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (klass); object_class->dispose = pixbuf_dispose; object_class->set_property = pixbuf_set_property; @@ -380,8 +378,6 @@ e_cell_pixbuf_class_init (GObjectClass *object_class) ecc->print_height = pixbuf_print_height; ecc->max_width = pixbuf_max_width; - parent_class = g_type_class_ref (PARENT_TYPE); - g_object_class_install_property (object_class, PROP_SELECTED_COLUMN, g_param_spec_int ("selected_column", _("Selected Column"), @@ -404,9 +400,3 @@ e_cell_pixbuf_class_init (GObjectClass *object_class) G_PARAM_READWRITE)); } -E_MAKE_TYPE (e_cell_pixbuf, - "ECellPixbuf", - ECellPixbuf, - e_cell_pixbuf_class_init, - e_cell_pixbuf_init, - PARENT_TYPE) diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index c2c8c28554..a8a8d5c4ca 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -45,7 +45,7 @@ #define E_CELL_POPUP_ARROW_YPAD 3 -static void e_cell_popup_class_init (GtkObjectClass *object_class); +static void e_cell_popup_class_init (ECellPopupClass *klass); static void e_cell_popup_init (ECellPopup *ecp); static void e_cell_popup_dispose (GObject *object); @@ -115,19 +115,14 @@ static gint e_cell_popup_do_popup (ECellPopupView *ecp_view, int row, int model_col); -static ECellClass *parent_class; - - -E_MAKE_TYPE (e_cell_popup, "ECellPopup", ECellPopup, e_cell_popup_class_init, - e_cell_popup_init, e_cell_get_type()) - +G_DEFINE_TYPE (ECellPopup, e_cell_popup, E_CELL_TYPE) static void -e_cell_popup_class_init (GtkObjectClass *object_class) +e_cell_popup_class_init (ECellPopupClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + ECellClass *ecc = E_CELL_CLASS (klass); - G_OBJECT_CLASS (object_class)->dispose = e_cell_popup_dispose; + G_OBJECT_CLASS (klass)->dispose = e_cell_popup_dispose; ecc->new_view = ecp_new_view; ecc->kill_view = ecp_kill_view; @@ -144,7 +139,6 @@ e_cell_popup_class_init (GtkObjectClass *object_class) ecc->show_tooltip = ecp_show_tooltip; ecc->get_bg_color = ecp_get_bg_color; - parent_class = g_type_class_ref (E_CELL_TYPE); gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_POPUP_TYPE, gal_a11y_e_cell_popup_new); @@ -187,7 +181,7 @@ e_cell_popup_dispose (GObject *object) g_object_unref (ecp->child); ecp->child = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_popup_parent_class)->dispose (object); } @@ -249,8 +243,8 @@ ecp_realize (ECellView *ecv) e_cell_realize (ecp_view->child_view); - if (parent_class->realize) - (* parent_class->realize) (ecv); + if (E_CELL_CLASS (e_cell_popup_parent_class)->realize) + (* E_CELL_CLASS (e_cell_popup_parent_class)->realize) (ecv); } @@ -264,8 +258,8 @@ ecp_unrealize (ECellView *ecv) e_cell_unrealize (ecp_view->child_view); - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); + if (E_CELL_CLASS (e_cell_popup_parent_class)->unrealize) + (* E_CELL_CLASS (e_cell_popup_parent_class)->unrealize) (ecv); } diff --git a/widgets/table/e-cell-progress.c b/widgets/table/e-cell-progress.c index ee9b4c6f5c..c9b6b8baf8 100644 --- a/widgets/table/e-cell-progress.c +++ b/widgets/table/e-cell-progress.c @@ -39,7 +39,7 @@ #include "e-cell-progress.h" #include "e-table-item.h" -#define PARENT_TYPE e_cell_get_type () +G_DEFINE_TYPE (ECellProgress, e_cell_progress, E_CELL_TYPE) typedef struct { ECellView cell_view; @@ -47,8 +47,6 @@ typedef struct { GnomeCanvas *canvas; } ECellProgressView; -static ECellClass *parent_class; - static void eprog_queue_redraw (ECellProgressView *text_view, int view_col, int view_row) { @@ -299,13 +297,14 @@ eprog_dispose (GObject *object) g_free (eprog->image); g_free (eprog->buffer); - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_progress_parent_class)->dispose (object); } static void -e_cell_progress_class_init (GObjectClass *object_class) +e_cell_progress_class_init (ECellProgressClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = eprog_dispose; @@ -317,11 +316,13 @@ e_cell_progress_class_init (GObjectClass *object_class) ecc->event = eprog_event; ecc->height = eprog_height; ecc->max_width = eprog_max_width; - - parent_class = g_type_class_ref (PARENT_TYPE); } -E_MAKE_TYPE(e_cell_progress, "ECellProgress", ECellProgress, e_cell_progress_class_init, NULL, PARENT_TYPE) +static void +e_cell_progress_init (ECellProgress *eprog) +{ + /* nothing to do */ +} /** * e_cell_progress_construct: diff --git a/widgets/table/e-cell-size.c b/widgets/table/e-cell-size.c index e403bbc468..a945d3edd5 100644 --- a/widgets/table/e-cell-size.c +++ b/widgets/table/e-cell-size.c @@ -30,9 +30,7 @@ #include "e-cell-size.h" -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; +G_DEFINE_TYPE (ECellSize, e_cell_size, E_CELL_TEXT_TYPE) static char * ecd_get_text(ECellText *cell, ETableModel *model, int col, int row) @@ -60,18 +58,16 @@ ecd_free_text(ECellText *cell, char *text) } static void -e_cell_size_class_init (GtkObjectClass *object_class) +e_cell_size_class_init (ECellSizeClass *klass) { - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); ectc->get_text = ecd_get_text; ectc->free_text = ecd_free_text; } static void -e_cell_size_init (GtkObject *object) +e_cell_size_init (ECellSize *e_cell_size) { } @@ -110,4 +106,3 @@ e_cell_size_new (const char *fontname, GtkJustification justify) return (ECell *) ecd; } -E_MAKE_TYPE(e_cell_size, "ECellSize", ECellSize, e_cell_size_class_init, e_cell_size_init, PARENT_TYPE) diff --git a/widgets/table/e-cell-spin-button.c b/widgets/table/e-cell-spin-button.c index e7044a98a6..5cb1cac7ae 100644 --- a/widgets/table/e-cell-spin-button.c +++ b/widgets/table/e-cell-spin-button.c @@ -40,10 +40,10 @@ #include "e-cell-spin-button.h" #define E_CELL_SPIN_BUTTON_ARROW_WIDTH 16 -#define PARENT_TYPE e_cell_get_type () +G_DEFINE_TYPE (ECellSpinButton, e_cell_spin_button, E_CELL_TYPE) -static void e_cell_spin_button_class_init (GObjectClass *klass); -static void e_cell_spin_button_init (GtkObject *object); +static void e_cell_spin_button_class_init (ECellSpinButtonClass *klass); +static void e_cell_spin_button_init (ECellSpinButton *ecsb); static void ecsb_dispose (GObject *object); @@ -117,15 +117,14 @@ enum { }; static guint signals[LAST_SIGNAL] = { 0 }; -static ECell *parent_class; static void -e_cell_spin_button_class_init (GObjectClass *klass) +e_cell_spin_button_class_init (ECellSpinButtonClass *klass) { - ECellClass *ecc = (ECellClass *) klass; - ECellSpinButtonClass *ecsbc = (ECellSpinButtonClass *) klass; + ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - klass->dispose = ecsb_dispose; + object_class->dispose = ecsb_dispose; ecc->realize = ecsb_realize; ecc->unrealize = ecsb_unrealize; @@ -142,9 +141,7 @@ e_cell_spin_button_class_init (GObjectClass *klass) ecc->max_width = NULL; ecc->show_tooltip = ecsb_show_tooltip; - ecsbc->step = NULL; - - parent_class = g_type_class_ref (E_CELL_TYPE); + klass->step = NULL; signals[STEP] = g_signal_new ("step", @@ -159,15 +156,10 @@ e_cell_spin_button_class_init (GObjectClass *klass) } static void -e_cell_spin_button_init (GtkObject *object) +e_cell_spin_button_init (ECellSpinButton *ecsb) { - ECellSpinButton *ecsb; - - g_return_if_fail (object != NULL); - g_return_if_fail (M_IS_CELL_SPIN_BUTTON (object)); + g_return_if_fail (M_IS_CELL_SPIN_BUTTON (ecsb)); - ecsb = E_CELL_SPIN_BUTTON (object); - ecsb->up_pressed = FALSE; ecsb->down_pressed = FALSE; } @@ -512,7 +504,7 @@ ecsb_dispose (GObject *object) g_return_if_fail (object != NULL); g_return_if_fail (M_IS_CELL_SPIN_BUTTON (object)); - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_spin_button_parent_class)->dispose (object); } ECell * @@ -655,7 +647,3 @@ e_cell_spin_button_step_float (ECellSpinButton *ecsb, g_free (str_value); } -E_MAKE_TYPE (e_cell_spin_button, "ECellSpinButton", ECellSpinButton, - e_cell_spin_button_class_init, e_cell_spin_button_init, - PARENT_TYPE) - diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 90c9b4ac7e..b24f2240ef 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -108,7 +108,7 @@ static guint signals [LAST_SIGNAL] = { 0 }; static GdkAtom clipboard_atom = GDK_NONE; -#define PARENT_TYPE e_cell_get_type () +G_DEFINE_TYPE (ECellText, e_cell_text, E_CELL_TYPE) #define UTF8_ATOM gdk_atom_intern ("UTF8_STRING", FALSE) @@ -216,8 +216,6 @@ static void _insert (ECellTextView *text_view, char *string, int value); static void _delete_selection (ECellTextView *text_view); static PangoAttrList* build_attr_list (ECellTextView *text_view, int row, int text_length); -static ECellClass *parent_class; - char * e_cell_text_get_text (ECellText *cell, ETableModel *model, int col, int row) { @@ -400,8 +398,8 @@ ect_realize (ECellView *ecell_view) text_view->i_cursor = gdk_cursor_new (GDK_XTERM); - if (parent_class->realize) - (* parent_class->realize) (ecell_view); + if (E_CELL_CLASS (e_cell_text_parent_class)->realize) + (* E_CELL_CLASS (e_cell_text_parent_class)->realize) (ecell_view); } /* @@ -434,8 +432,8 @@ ect_unrealize (ECellView *ecv) ect->colors = NULL; } - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); + if (E_CELL_CLASS (e_cell_text_parent_class)->unrealize) + (* E_CELL_CLASS (e_cell_text_parent_class)->unrealize) (ecv); } @@ -1648,7 +1646,7 @@ ect_finalize (GObject *object) g_free (ect->font_name); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_cell_text_parent_class)->finalize (object); } /* Set_arg handler for the text item */ static void @@ -1737,13 +1735,13 @@ static char *ellipsis_default = NULL; static gboolean use_ellipsis_default = TRUE; static void -e_cell_text_class_init (GObjectClass *object_class) +e_cell_text_class_init (ECellTextClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; - ECellTextClass *ectc = (ECellTextClass *) object_class; + ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); const char *ellipsis_env; - G_OBJECT_CLASS (object_class)->finalize = ect_finalize; + object_class->finalize = ect_finalize; ecc->new_view = ect_new_view; ecc->kill_view = ect_kill_view; @@ -1764,15 +1762,13 @@ e_cell_text_class_init (GObjectClass *object_class) ecc->show_tooltip = ect_show_tooltip; ecc->get_bg_color = ect_get_bg_color; - ectc->get_text = ect_real_get_text; - ectc->free_text = ect_real_free_text; - ectc->set_value = ect_real_set_value; + klass->get_text = ect_real_get_text; + klass->free_text = ect_real_free_text; + klass->set_value = ect_real_set_value; object_class->get_property = ect_get_property; object_class->set_property = ect_set_property; - parent_class = g_type_class_ref (PARENT_TYPE); - signals [TEXT_INSERTED] = g_signal_new ("text_inserted", G_TYPE_FROM_CLASS (object_class), @@ -1948,8 +1944,6 @@ e_cell_text_init (ECellText *ect) ect->editable = TRUE; } -E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE) - /** * e_cell_text_construct: * @cell: The cell to construct diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index a5b396333d..ec5dc132f6 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -35,7 +35,7 @@ #include "e-cell-toggle.h" #include "e-table-item.h" -#define PARENT_TYPE e_cell_get_type () +G_DEFINE_TYPE (ECellToggle, e_cell_toggle, E_CELL_TYPE) typedef struct { ECellView cell_view; @@ -44,8 +44,6 @@ typedef struct { GdkPixmap **pixmap_cache; } ECellToggleView; -static ECellClass *parent_class; - #define CACHE_SEQ_COUNT 6 /* @@ -388,15 +386,15 @@ etog_finalize (GObject *object) etog->images = NULL; etog->n_states = 0; - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_cell_toggle_parent_class)->finalize (object); } static void -e_cell_toggle_class_init (GtkObjectClass *object_class) +e_cell_toggle_class_init (ECellToggleClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + ECellClass *ecc = E_CELL_CLASS (klass); - G_OBJECT_CLASS (object_class)->finalize = etog_finalize; + G_OBJECT_CLASS (klass)->finalize = etog_finalize; ecc->new_view = etog_new_view; ecc->kill_view = etog_kill_view; @@ -410,23 +408,18 @@ e_cell_toggle_class_init (GtkObjectClass *object_class) ecc->max_width = etog_max_width; ecc->style_set = etog_style_set; - parent_class = g_type_class_ref (PARENT_TYPE); gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_TOGGLE_TYPE, gal_a11y_e_cell_toggle_new); } static void -e_cell_toggle_init (GtkObject *object) +e_cell_toggle_init (ECellToggle *etog) { - ECellToggle *etog = (ECellToggle *) object; - etog->images = NULL; etog->n_states = 0; } -E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, e_cell_toggle_init, PARENT_TYPE) - /** * e_cell_toggle_construct: * @etog: a fresh ECellToggle object diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index 1751176637..860133dfa7 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -51,7 +51,8 @@ #include "tree-unexpanded.xpm" -#define PARENT_TYPE e_cell_get_type () +G_DEFINE_TYPE (ECellTree, e_cell_tree, E_CELL_TYPE) + typedef struct { ECellView cell_view; @@ -65,8 +66,6 @@ typedef struct { } ECellTreeView; -static ECellClass *parent_class; - #define INDENT_AMOUNT 16 ECellView * @@ -183,8 +182,8 @@ ect_realize (ECellView *ecell_view) GDK_JOIN_MITER); gdk_gc_set_dashes (tree_view->gc, 0, (gint8 *)"\1\1", 2); - if (parent_class->realize) - (* parent_class->realize) (ecell_view); + if (E_CELL_CLASS (e_cell_tree_parent_class)->realize) + (* E_CELL_CLASS (e_cell_tree_parent_class)->realize) (ecell_view); } /* @@ -201,8 +200,8 @@ ect_unrealize (ECellView *ecv) g_object_unref (tree_view->gc); tree_view->gc = NULL; - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); + if (E_CELL_CLASS (e_cell_tree_parent_class)->unrealize) + (* E_CELL_CLASS (e_cell_tree_parent_class)->unrealize) (ecv); } static void @@ -818,13 +817,14 @@ ect_dispose (GObject *object) g_object_unref (ect->closed_pixbuf); ect->closed_pixbuf = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_tree_parent_class)->dispose (object); } static void -e_cell_tree_class_init (GObjectClass *object_class) +e_cell_tree_class_init (ECellTreeClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (klass); object_class->dispose = ect_dispose; @@ -843,12 +843,14 @@ e_cell_tree_class_init (GObjectClass *object_class) ecc->show_tooltip = ect_show_tooltip; ecc->get_bg_color = ect_get_bg_color; - parent_class = g_type_class_ref (PARENT_TYPE); - gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_TREE_TYPE, gal_a11y_e_cell_tree_new); } -E_MAKE_TYPE(e_cell_tree, "ECellTree", ECellTree, e_cell_tree_class_init, NULL, PARENT_TYPE) +static void +e_cell_tree_init (ECellTree *ect) +{ + /* nothing to do */ +} /** * e_cell_tree_construct: diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c index 4327722b64..f915c3e0dd 100644 --- a/widgets/table/e-cell-vbox.c +++ b/widgets/table/e-cell-vbox.c @@ -42,9 +42,7 @@ #include "e-cell-vbox.h" #include "e-table-item.h" -#define PARENT_TYPE e_cell_get_type () - -static ECellClass *parent_class; +G_DEFINE_TYPE (ECellVbox, e_cell_vbox, E_CELL_TYPE) #define INDENT_AMOUNT 16 @@ -114,8 +112,8 @@ ecv_realize (ECellView *ecell_view) for (i = 0; i < vbox_view->subcell_view_count; i++) e_cell_realize (vbox_view->subcell_views[i]); - if (parent_class->realize) - (* parent_class->realize) (ecell_view); + if (E_CELL_CLASS (e_cell_vbox_parent_class)->realize) + (* E_CELL_CLASS (e_cell_vbox_parent_class)->realize) (ecell_view); } /* @@ -131,8 +129,8 @@ ecv_unrealize (ECellView *ecv) for (i = 0; i < vbox_view->subcell_view_count; i++) e_cell_unrealize (vbox_view->subcell_views[i]); - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); + if (E_CELL_CLASS (e_cell_vbox_parent_class)->unrealize) + (* E_CELL_CLASS (e_cell_vbox_parent_class)->unrealize) (ecv); } /* @@ -411,7 +409,7 @@ ecv_dispose (GObject *object) ecv->subcells = NULL; ecv->subcell_count = 0; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_cell_vbox_parent_class)->dispose (object); } static void @@ -421,13 +419,14 @@ ecv_finalize (GObject *object) g_free (ecv->model_cols); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_cell_vbox_parent_class)->finalize (object); } static void -e_cell_vbox_class_init (GObjectClass *object_class) +e_cell_vbox_class_init (ECellVboxClass *klass) { - ECellClass *ecc = (ECellClass *) object_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (klass); object_class->dispose = ecv_dispose; object_class->finalize = ecv_finalize; @@ -451,21 +450,16 @@ e_cell_vbox_class_init (GObjectClass *object_class) ecc->get_bg_color = ecv_get_bg_color; #endif - parent_class = g_type_class_ref (PARENT_TYPE); - gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_VBOX_TYPE, gal_a11y_e_cell_vbox_new); } static void -e_cell_vbox_init (GtkObject *object) +e_cell_vbox_init (ECellVbox *ecv) { - ECellVbox *ecv = E_CELL_VBOX (object); - ecv->subcells = NULL; ecv->subcell_count = 0; } -E_MAKE_TYPE(e_cell_vbox, "ECellVbox", ECellVbox, e_cell_vbox_class_init, e_cell_vbox_init, PARENT_TYPE) /** * e_cell_vbox_new: diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index 0679cffd53..6670b90a86 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -28,7 +28,7 @@ #include "e-cell.h" -#define PARENT_TYPE GTK_TYPE_OBJECT +G_DEFINE_TYPE (ECell, e_cell, GTK_TYPE_OBJECT) #define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell)) @@ -131,38 +131,34 @@ ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, in } static void -e_cell_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - ecc->realize = ec_realize; - ecc->unrealize = ec_unrealize; - ecc->new_view = ec_new_view; - ecc->kill_view = ec_kill_view; - ecc->draw = ec_draw; - ecc->event = ec_event; - ecc->focus = ec_focus; - ecc->unfocus = ec_unfocus; - ecc->height = ec_height; - ecc->enter_edit = ec_enter_edit; - ecc->leave_edit = ec_leave_edit; - ecc->save_state = ec_save_state; - ecc->load_state = ec_load_state; - ecc->free_state = ec_free_state; - ecc->print = NULL; - ecc->print_height = NULL; - ecc->max_width = NULL; - ecc->max_width_by_row = NULL; - ecc->show_tooltip = ec_show_tooltip; +e_cell_class_init (ECellClass *klass) +{ + klass->realize = ec_realize; + klass->unrealize = ec_unrealize; + klass->new_view = ec_new_view; + klass->kill_view = ec_kill_view; + klass->draw = ec_draw; + klass->event = ec_event; + klass->focus = ec_focus; + klass->unfocus = ec_unfocus; + klass->height = ec_height; + klass->enter_edit = ec_enter_edit; + klass->leave_edit = ec_leave_edit; + klass->save_state = ec_save_state; + klass->load_state = ec_load_state; + klass->free_state = ec_free_state; + klass->print = NULL; + klass->print_height = NULL; + klass->max_width = NULL; + klass->max_width_by_row = NULL; + klass->show_tooltip = ec_show_tooltip; } static void -e_cell_init (GtkObject *object) +e_cell_init (ECell *cell) { } -E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE) - /** * e_cell_event: * @ecell_view: The ECellView where the event will be dispatched diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index b58d027978..4e87457851 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -51,12 +51,12 @@ enum { static guint etcta_signals [LAST_SIGNAL] = { 0 }; -#define PARENT_OBJECT_TYPE gnome_canvas_group_get_type () +/* workaround for avoiding APi breakage */ +#define etcta_get_type e_table_click_to_add_get_type +G_DEFINE_TYPE (ETableClickToAdd, etcta, GNOME_TYPE_CANVAS_GROUP) #define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) -static GnomeCanvasGroupClass *etcta_parent_class; - enum { PROP_0, PROP_HEADER, @@ -477,8 +477,6 @@ etcta_class_init (ETableClickToAddClass *klass) GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS(klass); GObjectClass *object_class = G_OBJECT_CLASS(klass); - etcta_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); - klass->cursor_change = NULL; klass->style_set = etcta_style_set; @@ -547,9 +545,8 @@ etcta_class_init (ETableClickToAddClass *klass) } static void -etcta_init (GnomeCanvasItem *item) +etcta_init (ETableClickToAdd *etcta) { - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); AtkObject *a11y; etcta->one = NULL; @@ -566,7 +563,7 @@ etcta_init (GnomeCanvasItem *item) g_signal_connect(etcta->selection, "cursor_changed", G_CALLBACK (etcta_cursor_change), etcta); - e_canvas_item_set_reflow_callback(item, etcta_reflow); + e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (etcta), etcta_reflow); /* create its a11y object at this time if accessibility is enabled*/ if (atk_get_root () != NULL) { @@ -575,9 +572,6 @@ etcta_init (GnomeCanvasItem *item) } } -E_MAKE_TYPE(e_table_click_to_add, "ETableClickToAdd", ETableClickToAdd, etcta_class_init, etcta_init, PARENT_OBJECT_TYPE) - - /* The colors in this need to be themefied. */ /** * e_table_click_to_add_commit: diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c index b61d5b44cf..5025ee73e7 100644 --- a/widgets/table/e-table-col.c +++ b/widgets/table/e-table-col.c @@ -28,7 +28,7 @@ #include "e-table-col.h" -static GObjectClass *parent_class; +G_DEFINE_TYPE (ETableCol, e_table_col, G_TYPE_OBJECT) enum { PROP_0, @@ -52,7 +52,8 @@ etc_dispose (GObject *object) g_free (etc->text); etc->text = NULL; - parent_class->dispose (object); + if (G_OBJECT_CLASS (e_table_col_parent_class)->dispose) + G_OBJECT_CLASS (e_table_col_parent_class)->dispose (object); } static void @@ -85,9 +86,9 @@ etc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *psp } static void -e_table_col_class_init (GObjectClass *object_class) +e_table_col_class_init (ETableColClass *klass) { - parent_class = g_type_class_peek_parent (object_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = etc_dispose; object_class->set_property = etc_set_property; @@ -111,8 +112,6 @@ e_table_col_init (ETableCol *etc) etc->priority = 0; } -E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table_col_init, G_TYPE_OBJECT) - /** * e_table_col_new: * @col_idx: the column we represent in the model diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c index 9bfc4460b0..a7d4587022 100644 --- a/widgets/table/e-table-column-specification.c +++ b/widgets/table/e-table-column-specification.c @@ -33,7 +33,9 @@ #include "e-table-column-specification.h" -static GObjectClass *etcs_parent_class; +/* workaround for avoiding API breakage */ +#define etcs_get_type e_table_column_specification_get_type +G_DEFINE_TYPE (ETableColumnSpecification, etcs, G_TYPE_OBJECT) static void free_strings (ETableColumnSpecification *etcs) @@ -57,15 +59,15 @@ etcs_finalize (GObject *object) free_strings(etcs); - etcs_parent_class->finalize (object); + G_OBJECT_CLASS (etcs_parent_class)->finalize (object); } static void -etcs_class_init (GObjectClass *klass) +etcs_class_init (ETableColumnSpecificationClass *klass) { - etcs_parent_class = g_type_class_peek_parent (klass); - - klass->finalize = etcs_finalize; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = etcs_finalize; } static void @@ -87,8 +89,6 @@ etcs_init (ETableColumnSpecification *specification) specification->priority = 0; } -E_MAKE_TYPE(e_table_column_specification, "ETableColumnSpecification", ETableColumnSpecification, etcs_class_init, etcs_init, G_TYPE_OBJECT) - ETableColumnSpecification * e_table_column_specification_new (void) { diff --git a/widgets/table/e-table-column.c b/widgets/table/e-table-column.c index ae1171fb3d..76585f2836 100644 --- a/widgets/table/e-table-column.c +++ b/widgets/table/e-table-column.c @@ -33,8 +33,7 @@ enum { static guint etc_signals [LAST_SIGNAL] = { 0, }; -#define PARENT_CLASS GTK_TYPE_OBJECT -static GtkObjectClass *e_table_column_parent_class; +G_DEFINE_TYPE (ETableColumn, e_table_column, GTK_TYPE_OBJECT) static void e_table_column_finalize (GObject *object) @@ -83,13 +82,6 @@ e_table_column_class_init (GtkObjectClass *object_class) G_TYPE_NONE, 1, G_TYPE_INT); } -E_MAKE_TYPE (e_table_column, - "ETableColumn", - ETableColumn, - e_table_column_class_init, - NULL, - PARENT_TYPE); - static void etc_do_insert (ETableColumn *etc, int pos, ETableCol *val) { diff --git a/widgets/table/e-table-config-field.c b/widgets/table/e-table-config-field.c index d49cf08b53..d3c7fe6bc6 100644 --- a/widgets/table/e-table-config-field.c +++ b/widgets/table/e-table-config-field.c @@ -32,9 +32,7 @@ #include "e-table-config-field.h" -#define PARENT_TYPE (gtk_vbox_get_type()) - -static GtkVBoxClass *etcf_parent_class; +G_DEFINE_TYPE (ETableConfigField, etcf, GTK_TYPE_VBOX) static void etcf_dispose (GObject *object) @@ -53,11 +51,11 @@ etcf_dispose (GObject *object) } static void -etcf_class_init (GObjectClass *klass) +etcf_class_init (ETableConfigFieldClass *klass) { - etcf_parent_class = g_type_class_ref (PARENT_TYPE); - - klass->dispose = etcf_dispose; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = etcf_dispose; } static void @@ -72,8 +70,6 @@ etcf_init (ETableConfigField *etcf) etcf->child_fields = NULL; } -E_MAKE_TYPE(e_table_config_field, "ETableConfigField", ETableConfigField, etcf_class_init, etcf_init, PARENT_TYPE) - ETableConfigField * e_table_config_field_new (ETableSpecification *spec, ETableSortInfo *sort_info, diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 289007ba21..8e5e36e6d9 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -45,7 +45,7 @@ #include "e-table-scrolled.h" #include "e-table-without.h" -static GObjectClass *config_parent_class; +G_DEFINE_TYPE (ETableConfig, e_table_config, G_TYPE_OBJECT) enum { CHANGED, @@ -90,7 +90,7 @@ config_finalize (GObject *object) g_free (config->domain); config->domain = NULL; - config_parent_class->finalize (object); + G_OBJECT_CLASS (e_table_config_parent_class)->finalize (object); } static void @@ -129,11 +129,9 @@ config_get_property (GObject *object, } static void -config_class_init (GObjectClass *object_class) +e_table_config_class_init (ETableConfigClass *klass) { - ETableConfigClass *klass = E_TABLE_CONFIG_CLASS(object_class); - - config_parent_class = g_type_class_peek_parent (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); klass->changed = NULL; @@ -1257,7 +1255,7 @@ setup_gui (ETableConfig *config) } static void -config_init (ETableConfig *config) +e_table_config_init (ETableConfig *config) { config->domain = NULL; } @@ -1355,4 +1353,3 @@ e_table_config_raise (ETableConfig *config) gdk_window_raise (GTK_WIDGET (config->dialog_toplevel)->window); } -E_MAKE_TYPE(e_table_config, "ETableConfig", ETableConfig, config_class_init, config_init, G_TYPE_OBJECT) diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index 93013bbd78..5561eb9d36 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -39,7 +39,9 @@ #include "e-cell-tree.h" #include "e-table-extras.h" -static GObjectClass *ete_parent_class; +/* workaround for avoiding API breakage */ +#define ete_get_type e_table_extras_get_type +G_DEFINE_TYPE (ETableExtras, ete, G_TYPE_OBJECT) static void cell_hash_free(gchar *key, @@ -91,15 +93,15 @@ ete_finalize (GObject *object) ete->searches = NULL; ete->pixbufs = NULL; - ete_parent_class->finalize (object); + G_OBJECT_CLASS (ete_parent_class)->finalize (object); } static void -ete_class_init (GObjectClass *klass) +ete_class_init (ETableExtrasClass *klass) { - ete_parent_class = g_type_class_peek_parent (klass); - - klass->finalize = ete_finalize; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = ete_finalize; } static gint @@ -184,8 +186,6 @@ ete_init (ETableExtras *extras) e_table_extras_add_cell(extras, "tree-string", e_cell_tree_new (NULL, NULL, TRUE, e_cell_text_new (NULL, GTK_JUSTIFY_LEFT))); } -E_MAKE_TYPE(e_table_extras, "ETableExtras", ETableExtras, ete_class_init, ete_init, G_TYPE_OBJECT) - ETableExtras * e_table_extras_new (void) { diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c index db02b7eb83..ee94e12b2b 100644 --- a/widgets/table/e-table-field-chooser-dialog.c +++ b/widgets/table/e-table-field-chooser-dialog.c @@ -37,9 +37,6 @@ static void e_table_field_chooser_dialog_get_property (GObject *object, guint pr static void e_table_field_chooser_dialog_dispose (GObject *object); static void e_table_field_chooser_dialog_response (GtkDialog *dialog, gint id); -#define PARENT_TYPE GTK_TYPE_DIALOG -static GtkDialogClass *parent_class = NULL; - /* The arguments we take */ enum { PROP_0, @@ -48,12 +45,7 @@ enum { PROP_HEADER }; -E_MAKE_TYPE (e_table_field_chooser_dialog, - "ETableFieldChooserDialog", - ETableFieldChooserDialog, - e_table_field_chooser_dialog_class_init, - e_table_field_chooser_dialog_init, - PARENT_TYPE) +G_DEFINE_TYPE (ETableFieldChooserDialog, e_table_field_chooser_dialog, GTK_TYPE_DIALOG) static void e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass) @@ -64,8 +56,6 @@ e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass) object_class = (GObjectClass*) klass; dialog_class = GTK_DIALOG_CLASS (klass); - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->dispose = e_table_field_chooser_dialog_dispose; object_class->set_property = e_table_field_chooser_dialog_set_property; object_class->get_property = e_table_field_chooser_dialog_get_property; @@ -150,7 +140,7 @@ e_table_field_chooser_dialog_dispose (GObject *object) g_object_unref (etfcd->header); etfcd->header = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_table_field_chooser_dialog_parent_class)->dispose (object); } static void diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 75062051d9..15743655f9 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -54,12 +54,12 @@ enum { static guint etfci_signals [LAST_SIGNAL] = { 0, }; #endif -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () +/* workaround for avoiding API breakage */ +#define etfci_get_type e_table_field_chooser_item_get_type +G_DEFINE_TYPE (ETableFieldChooserItem, etfci, GNOME_TYPE_CANVAS_ITEM) #define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) -static GnomeCanvasItemClass *etfci_parent_class; - static void etfci_drop_table_header (ETableFieldChooserItem *etfci); static void etfci_drop_full_header (ETableFieldChooserItem *etfci); @@ -615,12 +615,11 @@ etfci_event (GnomeCanvasItem *item, GdkEvent *e) } static void -etfci_class_init (GObjectClass *object_class) +etfci_class_init (ETableFieldChooserItemClass *klass) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - etfci_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); - object_class->dispose = etfci_dispose; object_class->set_property = etfci_set_property; object_class->get_property = etfci_get_property; @@ -669,10 +668,8 @@ etfci_class_init (GObjectClass *object_class) } static void -etfci_init (GnomeCanvasItem *item) +etfci_init (ETableFieldChooserItem *etfci) { - ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - etfci->full_header = NULL; etfci->header = NULL; etfci->combined_header = NULL; @@ -691,12 +688,6 @@ etfci_init (GnomeCanvasItem *item) etfci->maybe_drag = 0; etfci->drag_end_id = 0; - e_canvas_item_set_reflow_callback(item, etfci_reflow); + e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM (etfci), etfci_reflow); } -E_MAKE_TYPE (e_table_field_chooser_item, - "ETableFieldChooserItem", - ETableFieldChooserItem, - etfci_class_init, - etfci_init, - PARENT_OBJECT_TYPE) diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index 294d90e212..bb3388431b 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -39,9 +39,6 @@ static void e_table_field_chooser_set_property (GObject *object, guint prop_id, static void e_table_field_chooser_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void e_table_field_chooser_dispose (GObject *object); -#define PARENT_TYPE GTK_TYPE_VBOX -static GtkVBoxClass *parent_class = NULL; - /* The arguments we take */ enum { PROP_0, @@ -50,12 +47,7 @@ enum { PROP_DND_CODE }; -E_MAKE_TYPE (e_table_field_chooser, - "ETableFieldChooser", - ETableFieldChooser, - e_table_field_chooser_class_init, - e_table_field_chooser_init, - PARENT_TYPE) +G_DEFINE_TYPE (ETableFieldChooser, e_table_field_chooser, GTK_TYPE_VBOX) static void e_table_field_chooser_class_init (ETableFieldChooserClass *klass) @@ -66,8 +58,6 @@ e_table_field_chooser_class_init (ETableFieldChooserClass *klass) glade_init(); - parent_class = g_type_class_ref (GTK_TYPE_VBOX); - object_class->set_property = e_table_field_chooser_set_property; object_class->get_property = e_table_field_chooser_get_property; object_class->dispose = e_table_field_chooser_dispose; @@ -225,8 +215,8 @@ e_table_field_chooser_dispose (GObject *object) g_object_unref (etfc->gui); etfc->gui = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_table_field_chooser_parent_class)->dispose) + (* G_OBJECT_CLASS (e_table_field_chooser_parent_class)->dispose) (object); } GtkWidget* diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 4c900624a2..277e4f2b89 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -42,9 +42,9 @@ #define TITLE_HEIGHT 16 -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgc_parent_class; +/* workaround for avoiding API breakage */ +#define etgc_get_type e_table_group_container_get_type +G_DEFINE_TYPE (ETableGroupContainer, etgc, E_TABLE_GROUP_TYPE) /* The arguments we take */ enum { @@ -864,10 +864,11 @@ etgc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps } static void -etgc_class_init (GObjectClass *object_class) +etgc_class_init (ETableGroupContainerClass *klass) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS(object_class); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS (klass); object_class->dispose = etgc_dispose; object_class->set_property = etgc_set_property; @@ -877,8 +878,6 @@ etgc_class_init (GObjectClass *object_class) item_class->realize = etgc_realize; item_class->unrealize = etgc_unrealize; - etgc_parent_class = g_type_class_ref (PARENT_TYPE); - e_group_class->add = etgc_add; e_group_class->add_array = etgc_add_array; e_group_class->add_all = etgc_add_all; @@ -1069,12 +1068,11 @@ etgc_reflow (GnomeCanvasItem *item, gint flags) } static void -etgc_init (GtkObject *object) +etgc_init (ETableGroupContainer *container) { - ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object); container->children = FALSE; - e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgc_reflow); + e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(container), etgc_reflow); container->alternating_row_colors = 1; container->horizontal_draw_grid = 1; @@ -1086,8 +1084,6 @@ etgc_init (GtkObject *object) container->uniform_row_height = FALSE; } -E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE) - void e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *closure) { diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 9acf976021..9b044946f6 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -35,9 +35,9 @@ #include "e-table-sorted.h" #include "e-table-sorted-variable.h" -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgl_parent_class; +/* workaround for avoiding APi breakage */ +#define etgl_get_type e_table_group_leaf_get_type +G_DEFINE_TYPE (ETableGroupLeaf, etgl, E_TABLE_GROUP_TYPE) /* The arguments we take */ enum { @@ -542,10 +542,11 @@ etgl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps } static void -etgl_class_init (GObjectClass *object_class) +etgl_class_init (ETableGroupLeafClass *klass) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS(object_class); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); + ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = etgl_dispose; object_class->set_property = etgl_set_property; @@ -553,8 +554,6 @@ etgl_class_init (GObjectClass *object_class) item_class->realize = etgl_realize; - etgl_parent_class = g_type_class_ref (PARENT_TYPE); - e_group_class->add = etgl_add; e_group_class->add_array = etgl_add_array; e_group_class->add_all = etgl_add_all; @@ -654,10 +653,8 @@ etgl_class_init (GObjectClass *object_class) } static void -etgl_init (GtkObject *object) +etgl_init (ETableGroupLeaf *etgl) { - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); - etgl->width = 1; etgl->height = 1; etgl->minimum_width = 0; @@ -683,7 +680,6 @@ etgl_init (GtkObject *object) etgl->selection_model = NULL; etgl->uniform_row_height = FALSE; - e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgl_reflow); + e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (etgl), etgl_reflow); } -E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE) diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index a7bb72db3e..a9cdcae468 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -33,12 +33,12 @@ #include "e-table-group-leaf.h" #include "e-table-item.h" -#define PARENT_TYPE gnome_canvas_group_get_type () +/* workaround for avoiding API breakage*/ +#define etg_get_type e_table_group_get_type +G_DEFINE_TYPE (ETableGroup, etg, GNOME_TYPE_CANVAS_GROUP) #define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT_GET_CLASS(e))) -static GnomeCanvasGroupClass *etg_parent_class; - enum { CURSOR_CHANGE, CURSOR_ACTIVATED, @@ -611,10 +611,10 @@ etg_get_focus (ETableGroup *etg) } static void -etg_class_init (GObjectClass *object_class) +etg_class_init (ETableGroupClass *klass) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *klass = (ETableGroupClass *) object_class; + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = etg_dispose; @@ -641,8 +641,6 @@ etg_class_init (GObjectClass *object_class) klass->compute_location = NULL; klass->get_cell_geometry = NULL; - etg_parent_class = g_type_class_ref (PARENT_TYPE); - etg_signals [CURSOR_CHANGE] = g_signal_new ("cursor_change", G_OBJECT_CLASS_TYPE (object_class), @@ -711,4 +709,8 @@ etg_class_init (GObjectClass *object_class) G_TYPE_INT, GDK_TYPE_EVENT); } -E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE) +static void +etg_init (ETableGroup *etg) +{ + /* nothing to do */ +} diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 5e45bb2e66..d6096e08c7 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -74,13 +74,12 @@ static guint ethi_signals [LAST_SIGNAL] = { 0, }; #define ETHI_RESIZING(x) ((x)->resize_col != -1) -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () +#define ethi_get_type e_table_header_item_get_type +G_DEFINE_TYPE (ETableHeaderItem, ethi, GNOME_TYPE_CANVAS_ITEM) #define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) #define d(x) -static GnomeCanvasItemClass *ethi_parent_class; - static void ethi_drop_table_header (ETableHeaderItem *ethi); /* @@ -1855,12 +1854,11 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) } static void -ethi_class_init (GObjectClass *object_class) +ethi_class_init (ETableHeaderItemClass *klass) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - ethi_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); - object_class->dispose = ethi_dispose; object_class->set_property = ethi_set_property; object_class->get_property = ethi_get_property; @@ -1944,9 +1942,9 @@ ethi_class_init (GObjectClass *object_class) } static void -ethi_init (GnomeCanvasItem *item) +ethi_init (ETableHeaderItem *ethi) { - ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); + GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ethi); ethi->resize_col = -1; @@ -1970,9 +1968,3 @@ ethi_init (GnomeCanvasItem *item) ethi->selected_col = 0; } -E_MAKE_TYPE (e_table_header_item, - "ETableHeaderItem", - ETableHeaderItem, - ethi_class_init, - ethi_init, - PARENT_OBJECT_TYPE) diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index 5e7d28300b..ae76c7002a 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -55,7 +55,7 @@ static void eth_calc_widths (ETableHeader *eth); static guint eth_signals [LAST_SIGNAL] = { 0, }; -static GObjectClass *e_table_header_parent_class; +G_DEFINE_TYPE (ETableHeader, e_table_header, G_TYPE_OBJECT) struct two_ints { int column; @@ -181,8 +181,8 @@ eth_finalize (GObject *object) eth->col_count = 0; eth->columns = NULL; - if (e_table_header_parent_class->finalize) - e_table_header_parent_class->finalize (object); + if (G_OBJECT_CLASS (e_table_header_parent_class)->finalize) + G_OBJECT_CLASS (e_table_header_parent_class)->finalize (object); } static void @@ -247,9 +247,9 @@ eth_get_property (GObject *object, guint prop_id, GValue *val, GParamSpec *pspec } static void -e_table_header_class_init (GObjectClass *object_class) +e_table_header_class_init (ETableHeaderClass *klass) { - ETableHeaderClass *klass = E_TABLE_HEADER_CLASS (object_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = eth_finalize; object_class->set_property = eth_set_property; @@ -906,8 +906,6 @@ e_table_header_update_horizontal (ETableHeader *eth) g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0); } -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-item.c b/widgets/table/e-table-item.c index 026d9d11a3..457f1ad778 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -48,7 +48,9 @@ #include "e-table-item.h" #include "e-table-subset.h" -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () +/* workaround for avoiding API breakage */ +#define eti_get_type e_table_item_get_type +G_DEFINE_TYPE (ETableItem, eti, GNOME_TYPE_CANVAS_ITEM) #define FOCUSED_BORDER 2 @@ -67,8 +69,6 @@ static void eti_cancel_drag_due_to_model_change (ETableItem *eti); realize and make sure that all of them are doable by all the cells and that all of the others are only done after realization. */ -static GnomeCanvasItemClass *eti_parent_class; - enum { CURSOR_CHANGE, CURSOR_ACTIVATED, @@ -1577,10 +1577,8 @@ eti_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *psp } static void -eti_init (GnomeCanvasItem *item) +eti_init (ETableItem *eti) { - ETableItem *eti = E_TABLE_ITEM (item); - eti->motion_row = -1; eti->motion_col = -1; eti->editing_col = -1; @@ -2922,13 +2920,11 @@ eti_style_set (ETableItem *eti, GtkStyle *previous_style) } static void -eti_class_init (GObjectClass *object_class) +eti_class_init (ETableItemClass *klass) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableItemClass *eti_class = (ETableItemClass *) object_class; - - eti_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); - + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = eti_dispose; object_class->set_property = eti_set_property; object_class->get_property = eti_get_property; @@ -2940,16 +2936,16 @@ eti_class_init (GObjectClass *object_class) item_class->point = eti_point; item_class->event = eti_event; - eti_class->cursor_change = NULL; - eti_class->cursor_activated = NULL; - eti_class->double_click = NULL; - eti_class->right_click = NULL; - eti_class->click = NULL; - eti_class->key_press = NULL; - eti_class->start_drag = NULL; - eti_class->style_set = eti_style_set; - eti_class->selection_model_removed = NULL; - eti_class->selection_model_added = NULL; + klass->cursor_change = NULL; + klass->cursor_activated = NULL; + klass->double_click = NULL; + klass->right_click = NULL; + klass->click = NULL; + klass->key_press = NULL; + klass->start_drag = NULL; + klass->style_set = eti_style_set; + klass->selection_model_removed = NULL; + klass->selection_model_added = NULL; g_object_class_install_property (object_class, PROP_TABLE_HEADER, g_param_spec_object ("ETableHeader", @@ -3149,13 +3145,6 @@ eti_class_init (GObjectClass *object_class) gal_a11y_e_table_item_init (); } -E_MAKE_TYPE (e_table_item, - "ETableItem", - ETableItem, - eti_class_init, - eti_init, - PARENT_OBJECT_TYPE) - /** * e_table_item_set_cursor: * @eti: %ETableItem which will have the cursor set. diff --git a/widgets/table/e-table-memory-callbacks.c b/widgets/table/e-table-memory-callbacks.c index fe25b3742b..806bab3c8a 100644 --- a/widgets/table/e-table-memory-callbacks.c +++ b/widgets/table/e-table-memory-callbacks.c @@ -27,6 +27,8 @@ #include "e-table-memory-callbacks.h" +G_DEFINE_TYPE (ETableMemoryCalbacks, e_table_memory_callbacks, E_TABLE_MEMORY_TYPE) + static int etmc_column_count (ETableModel *etm) { @@ -133,9 +135,9 @@ etmc_append_row (ETableModel *etm, ETableModel *source, int row) } static void -e_table_memory_callbacks_class_init (GObjectClass *object_class) +e_table_memory_callbacks_class_init (ETableMemoryCalbacksClass *klass) { - ETableModelClass *model_class = (ETableModelClass *) object_class; + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); model_class->column_count = etmc_column_count; model_class->value_at = etmc_value_at; @@ -150,8 +152,11 @@ e_table_memory_callbacks_class_init (GObjectClass *object_class) } -E_MAKE_TYPE(e_table_memory_callbacks, "ETableMemoryCalbacks", ETableMemoryCalbacks, e_table_memory_callbacks_class_init, NULL, E_TABLE_MEMORY_TYPE) - +static void +e_table_memory_callbacks_init (ETableMemoryCalbacks *etmc) +{ + /* nothing to do */ +} /** * e_table_memory_callbacks_new: diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c index c51d637681..27c2617d94 100644 --- a/widgets/table/e-table-memory-store.c +++ b/widgets/table/e-table-memory-store.c @@ -31,14 +31,14 @@ #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; void **store; }; +G_DEFINE_TYPE (ETableMemoryStore, e_table_memory_store, E_TABLE_MEMORY_TYPE) + static void * duplicate_value (ETableMemoryStore *etms, int col, const void *val) { @@ -236,8 +236,8 @@ etms_finalize (GObject *obj) g_free (etms->priv); } - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (obj); + if (G_OBJECT_CLASS (e_table_memory_store_parent_class)->finalize) + G_OBJECT_CLASS (e_table_memory_store_parent_class)->finalize (obj); } static void @@ -251,11 +251,10 @@ e_table_memory_store_init (ETableMemoryStore *etms) } static void -e_table_memory_store_class_init (GObjectClass *object_class) +e_table_memory_store_class_init (ETableMemoryStoreClass *klass) { - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = g_type_class_peek_parent (object_class); + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = etms_finalize; @@ -271,8 +270,6 @@ e_table_memory_store_class_init (GObjectClass *object_class) model_class->append_row = etms_append_row; } -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: * @col_count: diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c index cb0223c788..90e9d1fb47 100644 --- a/widgets/table/e-table-memory.c +++ b/widgets/table/e-table-memory.c @@ -38,7 +38,7 @@ #include "e-table-memory.h" -static ETableModel *parent_class; +G_DEFINE_TYPE (ETableMemory, e_table_memory, E_TABLE_MODEL_TYPE) struct ETableMemoryPriv { gpointer *data; @@ -62,7 +62,7 @@ etmm_finalize (GObject *object) } etmm->priv = NULL; - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_table_memory_parent_class)->finalize (object); } static int @@ -75,22 +75,19 @@ etmm_row_count (ETableModel *etm) static void -e_table_memory_class_init (GObjectClass *klass) +e_table_memory_class_init (ETableMemoryClass *klass) { - ETableModelClass *table_class = (ETableModelClass *) klass; + ETableModelClass *table_class = E_TABLE_MODEL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - klass->finalize = etmm_finalize; + object_class->finalize = etmm_finalize; table_class->row_count = etmm_row_count; } static void -e_table_memory_init (GObject *object) +e_table_memory_init (ETableMemory *etmm) { - ETableMemory *etmm = (ETableMemory *)object; - ETableMemoryPriv *priv; priv = g_new0 (ETableMemoryPriv, 1); @@ -101,10 +98,6 @@ e_table_memory_init (GObject *object) priv->frozen = 0; } -E_MAKE_TYPE(e_table_memory, "ETableMemory", ETableMemory, e_table_memory_class_init, e_table_memory_init, E_TABLE_MODEL_TYPE) - - - /** * e_table_memory_new * diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index cef8846049..3fb38f51ed 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -38,7 +38,7 @@ d(static gint depth = 0;) -static GObjectClass *e_table_model_parent_class; +G_DEFINE_TYPE (ETableModel, e_table_model, G_TYPE_OBJECT) enum { MODEL_NO_CHANGE, @@ -270,15 +270,14 @@ e_table_model_value_to_string (ETableModel *e_table_model, int col, const void * static void e_table_model_finalize (GObject *object) { - if (e_table_model_parent_class->finalize) - (*e_table_model_parent_class->finalize)(object); + if (G_OBJECT_CLASS (e_table_model_parent_class)->finalize) + (* G_OBJECT_CLASS (e_table_model_parent_class)->finalize)(object); } static void -e_table_model_class_init (GObjectClass *object_class) +e_table_model_class_init (ETableModelClass *klass) { - ETableModelClass *klass = E_TABLE_MODEL_CLASS(object_class); - e_table_model_parent_class = g_type_class_peek_parent (object_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = e_table_model_finalize; @@ -373,7 +372,11 @@ e_table_model_class_init (GObjectClass *object_class) klass->model_rows_deleted = NULL; } -E_MAKE_TYPE(e_table_model, "ETableModel", ETableModel, e_table_model_class_init, NULL, G_TYPE_OBJECT) +static void +e_table_model_init (ETableModel *e_table_model) +{ + /* nothing to do */ +} #if d(!)0 static void diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c index 7bcbc37853..436f999c01 100644 --- a/widgets/table/e-table-one.c +++ b/widgets/table/e-table-one.c @@ -27,7 +27,7 @@ #include "e-table-one.h" -static ETableModelClass *parent_class = NULL; +G_DEFINE_TYPE (ETableOne, e_table_one, E_TABLE_MODEL_TYPE) static int one_column_count (ETableModel *etm) @@ -136,7 +136,7 @@ one_value_to_string (ETableModel *etm, int col, const void *value) static void one_finalize (GObject *object) { - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_table_one_parent_class)->finalize (object); } static void @@ -164,15 +164,14 @@ one_dispose (GObject *object) g_object_unref(one->source); one->source = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_table_one_parent_class)->dispose (object); } static void -e_table_one_class_init (GObjectClass *object_class) +e_table_one_class_init (ETableOneClass *klass) { - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = g_type_class_peek_parent (object_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); model_class->column_count = one_column_count; model_class->row_count = one_row_count; @@ -190,17 +189,12 @@ e_table_one_class_init (GObjectClass *object_class) } static void -e_table_one_init (GObject *object) +e_table_one_init (ETableOne *one) { - ETableOne *one = E_TABLE_ONE(object); - one->source = NULL; one->data = NULL; } -E_MAKE_TYPE(e_table_one, "ETableOne", ETableOne, e_table_one_class_init, e_table_one_init, E_TABLE_MODEL_TYPE) - - ETableModel * e_table_one_new (ETableModel *source) { diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c index 3d581cd8c2..88f6f9012b 100644 --- a/widgets/table/e-table-scrolled.c +++ b/widgets/table/e-table-scrolled.c @@ -39,9 +39,7 @@ #define COLUMN_HEADER_HEIGHT 16 -#define PARENT_TYPE gtk_scrolled_window_get_type () - -static GtkObjectClass *parent_class; +G_DEFINE_TYPE (ETableScrolled, e_table_scrolled, GTK_TYPE_SCROLLED_WINDOW) enum { PROP_0, @@ -49,13 +47,11 @@ enum { }; static void -e_table_scrolled_init (GtkObject *object) +e_table_scrolled_init (ETableScrolled *ets) { - ETableScrolled *ets; GtkScrolledWindow *scrolled_window; - ets = E_TABLE_SCROLLED (object); - scrolled_window = GTK_SCROLLED_WINDOW (object); + scrolled_window = GTK_SCROLLED_WINDOW (ets); GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS); @@ -209,8 +205,6 @@ e_table_scrolled_class_init (ETableScrolledClass *class) object_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->get_property = ets_get_property; widget_class->grab_focus = ets_grab_focus; @@ -225,5 +219,3 @@ e_table_scrolled_class_init (ETableScrolledClass *class) G_PARAM_READABLE)); } -E_MAKE_TYPE(e_table_scrolled, "ETableScrolled", ETableScrolled, e_table_scrolled_class_init, e_table_scrolled_init, PARENT_TYPE) - diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 0f014c1a76..100ad97a66 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -40,7 +40,7 @@ struct _ETableSearchPrivate { gunichar last_character; }; -static GObjectClass *e_table_search_parent_class; +G_DEFINE_TYPE (ETableSearch, e_table_search, G_TYPE_OBJECT) enum { SEARCH_SEARCH, @@ -113,15 +113,14 @@ e_table_search_finalize (GObject *object) g_free (ets->priv->search_string); g_free (ets->priv); - if (e_table_search_parent_class->finalize) - (*e_table_search_parent_class->finalize)(object); + if (G_OBJECT_CLASS (e_table_search_parent_class)->finalize) + (*G_OBJECT_CLASS (e_table_search_parent_class)->finalize)(object); } static void -e_table_search_class_init (GObjectClass *object_class) +e_table_search_class_init (ETableSearchClass *klass) { - ETableSearchClass *klass = E_TABLE_SEARCH_CLASS(object_class); - e_table_search_parent_class = g_type_class_peek_parent (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = e_table_search_finalize; @@ -157,9 +156,6 @@ e_table_search_init (ETableSearch *ets) ets->priv->last_character = 0; } - -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) { diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index a16285c392..8f31ff5897 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -32,9 +32,7 @@ #include "e-table-selection-model.h" -#define PARENT_TYPE e_selection_model_array_get_type () - -static ESelectionModelArray *parent_class; +G_DEFINE_TYPE (ETableSelectionModel, e_table_selection_model, E_SELECTION_MODEL_ARRAY_TYPE) static gint etsm_get_row_count (ESelectionModelArray *esm); @@ -244,8 +242,8 @@ etsm_dispose (GObject *object) drop_model(etsm); free_hash(etsm); - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose (object); + if (G_OBJECT_CLASS(e_table_selection_model_parent_class)->dispose) + G_OBJECT_CLASS(e_table_selection_model_parent_class)->dispose (object); } static void @@ -295,8 +293,6 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass) GObjectClass *object_class; ESelectionModelArrayClass *esma_class; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class = G_OBJECT_CLASS(klass); esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass); @@ -321,9 +317,6 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass) G_PARAM_READWRITE)); } -E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionModel, - e_table_selection_model_class_init, e_table_selection_model_init, PARENT_TYPE) - /** * e_table_selection_model_new * diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c index cdca4bbb44..574c002a85 100644 --- a/widgets/table/e-table-simple.c +++ b/widgets/table/e-table-simple.c @@ -28,6 +28,8 @@ #include "e-table-simple.h" +G_DEFINE_TYPE (ETableSimple, e_table_simple, E_TABLE_MODEL_TYPE) + static int simple_column_count (ETableModel *etm) { @@ -167,9 +169,9 @@ simple_value_to_string (ETableModel *etm, int col, const void *value) } static void -e_table_simple_class_init (GObjectClass *object_class) +e_table_simple_class_init (ETableSimpleClass *klass) { - ETableModelClass *model_class = (ETableModelClass *) object_class; + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); model_class->column_count = simple_column_count; model_class->row_count = simple_row_count; @@ -189,7 +191,11 @@ e_table_simple_class_init (GObjectClass *object_class) model_class->value_to_string = simple_value_to_string; } -E_MAKE_TYPE(e_table_simple, "ETableSimple", ETableSimple, e_table_simple_class_init, NULL, E_TABLE_MODEL_TYPE) +static void +e_table_simple_init (ETableSimple *simple) +{ + /* nothing to do */ +} /** * e_table_simple_new: diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c index cdd600de53..4488ebef88 100644 --- a/widgets/table/e-table-sort-info.c +++ b/widgets/table/e-table-sort-info.c @@ -32,7 +32,7 @@ #define ETM_CLASS(e) (E_TABLE_SORT_INFO_GET_CLASS (e)) -static GObjectClass *e_table_sort_info_parent_class; +G_DEFINE_TYPE (ETableSortInfo , e_table_sort_info, G_TYPE_OBJECT) enum { SORT_INFO_CHANGED, @@ -102,9 +102,6 @@ e_table_sort_info_class_init (ETableSortInfoClass *klass) klass->group_info_changed = NULL; } -E_MAKE_TYPE(e_table_sort_info, "ETableSortInfo", ETableSortInfo, - e_table_sort_info_class_init, e_table_sort_info_init, G_TYPE_OBJECT) - static void e_table_sort_info_sort_info_changed (ETableSortInfo *info) { diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index 9b0e772f94..929358e8a3 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -38,7 +38,9 @@ /* maximum insertions between an idle event that we will do without scheduling an idle sort */ #define ETSV_INSERT_MAX (4) -static ETableSubsetVariableClass *etsv_parent_class; +/* workaround for avoiding API breakage */ +#define etsv_get_type e_table_sorted_variable_get_type +G_DEFINE_TYPE (ETableSortedVariable, etsv, E_TABLE_SUBSET_VARIABLE_TYPE) static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv); static void etsv_sort (ETableSortedVariable *etsv); @@ -76,11 +78,10 @@ etsv_dispose (GObject *object) } static void -etsv_class_init (GObjectClass *object_class) +etsv_class_init (ETableSortedVariableClass *klass) { - ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - - etsv_parent_class = g_type_class_peek_parent (object_class); + ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = etsv_dispose; @@ -100,8 +101,6 @@ etsv_init (ETableSortedVariable *etsv) etsv->insert_count = 0; } -E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, etsv_init, E_TABLE_SUBSET_VARIABLE_TYPE) - static gboolean etsv_sort_idle(ETableSortedVariable *etsv) { diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c index c2c39517fa..7ef28d6941 100644 --- a/widgets/table/e-table-sorted.c +++ b/widgets/table/e-table-sorted.c @@ -35,11 +35,13 @@ #define INCREMENT_AMOUNT 100 +/* workaround for avoding API breakage */ +#define ets_get_type e_table_sorted_get_type +G_DEFINE_TYPE (ETableSorted, ets, E_TABLE_SUBSET_TYPE) + /* maximum insertions between an idle event that we will do without scheduling an idle sort */ #define ETS_INSERT_MAX (4) -static ETableSubsetClass *ets_parent_class; - static void ets_sort_info_changed (ETableSortInfo *info, ETableSorted *ets); static void ets_sort (ETableSorted *ets); static void ets_proxy_model_changed (ETableSubset *etss, ETableModel *source); @@ -76,11 +78,10 @@ ets_dispose (GObject *object) } static void -ets_class_init (GObjectClass *object_class) +ets_class_init (ETableSortedClass *klass) { - ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS(object_class); - - ets_parent_class = g_type_class_peek_parent (object_class); + ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); etss_class->proxy_model_changed = ets_proxy_model_changed; etss_class->proxy_model_row_changed = ets_proxy_model_row_changed; @@ -103,8 +104,6 @@ ets_init (ETableSorted *ets) ets->insert_count = 0; } -E_MAKE_TYPE(e_table_sorted, "ETableSorted", ETableSorted, ets_class_init, ets_init, E_TABLE_SUBSET_TYPE) - static gboolean ets_sort_idle(ETableSorted *ets) { @@ -130,8 +129,8 @@ e_table_sorted_new (ETableModel *source, ETableHeader *full_header, ETableSortIn ETableSorted *ets = g_object_new (E_TABLE_SORTED_TYPE, NULL); ETableSubset *etss = E_TABLE_SUBSET (ets); - if (ets_parent_class->proxy_model_pre_change) - (ets_parent_class->proxy_model_pre_change) (etss, source); + if (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_pre_change) + (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_pre_change) (etss, source); if (e_table_subset_construct (etss, source, 0) == NULL){ g_object_unref (ets); @@ -184,8 +183,8 @@ ets_proxy_model_row_changed (ETableSubset *subset, ETableModel *source, int row) if (!E_TABLE_SORTED(subset)->sort_idle_id) E_TABLE_SORTED(subset)->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, subset, NULL); - if (ets_parent_class->proxy_model_row_changed) - (ets_parent_class->proxy_model_row_changed) (subset, source, row); + if (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_row_changed) + (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_row_changed) (subset, source, row); } static void @@ -194,8 +193,8 @@ ets_proxy_model_cell_changed (ETableSubset *subset, ETableModel *source, int col ETableSorted *ets = E_TABLE_SORTED(subset); if (e_table_sorting_utils_affects_sort(ets->sort_info, ets->full_header, col)) ets_proxy_model_row_changed(subset, source, row); - else if (ets_parent_class->proxy_model_cell_changed) - (ets_parent_class->proxy_model_cell_changed) (subset, source, col, row); + else if (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_cell_changed) + (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_cell_changed) (subset, source, col, row); } static void diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c index 3874f29bb1..32b43ccc35 100644 --- a/widgets/table/e-table-sorter.c +++ b/widgets/table/e-table-sorter.c @@ -39,12 +39,12 @@ enum { PROP_SORT_INFO }; -#define PARENT_TYPE e_sorter_get_type() +/* workaround for avoiding API breakage */ +#define ets_get_type e_table_sorter_get_type +G_DEFINE_TYPE (ETableSorter, ets, E_SORTER_TYPE) #define INCREMENT_AMOUNT 100 -static ESorterClass *parent_class; - static void ets_model_changed (ETableModel *etm, ETableSorter *ets); static void ets_model_row_changed (ETableModel *etm, int row, ETableSorter *ets); static void ets_model_cell_changed (ETableModel *etm, int col, int row, ETableSorter *ets); @@ -109,7 +109,7 @@ ets_dispose (GObject *object) g_object_unref(ets->source); ets->source = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (ets_parent_class)->dispose (object); } static void @@ -158,8 +158,6 @@ ets_class_init (ETableSorterClass *klass) GObjectClass *object_class = G_OBJECT_CLASS(klass); ESorterClass *sorter_class = E_SORTER_CLASS(klass); - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = ets_dispose; object_class->set_property = ets_set_property; object_class->get_property = ets_get_property; @@ -196,8 +194,6 @@ ets_init (ETableSorter *ets) ets->group_info_changed_id = 0; } -E_MAKE_TYPE(e_table_sorter, "ETableSorter", ETableSorter, ets_class_init, ets_init, PARENT_TYPE) - ETableSorter * e_table_sorter_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 47a146405e..cd010dbd7b 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -38,7 +38,9 @@ #include "e-table-specification.h" -static GObjectClass *etsp_parent_class; +/* workaround for avoiding API breakage */ +#define etsp_get_type e_table_specification_get_type +G_DEFINE_TYPE (ETableSpecification, etsp, G_TYPE_OBJECT) static void etsp_finalize (GObject *object) @@ -64,15 +66,15 @@ etsp_finalize (GObject *object) g_free (etsp->domain); etsp->domain = NULL; - etsp_parent_class->finalize (object); + G_OBJECT_CLASS (etsp_parent_class)->finalize (object); } static void -etsp_class_init (GObjectClass *klass) +etsp_class_init (ETableSpecificationClass *klass) { - etsp_parent_class = g_type_class_peek_parent (klass); - - klass->finalize = etsp_finalize; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = etsp_finalize; } static void @@ -99,8 +101,6 @@ etsp_init (ETableSpecification *etsp) etsp->domain = NULL; } -E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, G_TYPE_OBJECT) - /** * e_table_specification_new: * diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index 1b9ecfd16d..7da8775c3b 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -38,7 +38,7 @@ #define STATE_VERSION 0.1 -static GObjectClass *etst_parent_class; +G_DEFINE_TYPE (ETableState, e_table_state, G_TYPE_OBJECT) static void etst_dispose (GObject *object) @@ -50,7 +50,7 @@ etst_dispose (GObject *object) etst->sort_info = NULL; } - G_OBJECT_CLASS (etst_parent_class)->dispose (object); + G_OBJECT_CLASS (e_table_state_parent_class)->dispose (object); } static void @@ -68,28 +68,26 @@ etst_finalize (GObject *object) etst->expansions = NULL; } - G_OBJECT_CLASS (etst_parent_class)->finalize (object); + G_OBJECT_CLASS (e_table_state_parent_class)->finalize (object); } static void -etst_class_init (GObjectClass *klass) +e_table_state_class_init (ETableStateClass *klass) { - etst_parent_class = g_type_class_peek_parent (klass); - - klass->dispose = etst_dispose; - klass->finalize = etst_finalize; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = etst_dispose; + object_class->finalize = etst_finalize; } static void -etst_init (ETableState *state) +e_table_state_init (ETableState *state) { state->columns = NULL; state->expansions = NULL; state->sort_info = e_table_sort_info_new(); } -E_MAKE_TYPE(e_table_state, "ETableState", ETableState, etst_class_init, etst_init, G_TYPE_OBJECT) - ETableState * e_table_state_new (void) { diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index 1adbd648c0..41fbae3feb 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -32,6 +32,10 @@ #define ETSSV_CLASS(e) (E_TABLE_SUBSET_VARIABLE_GET_CLASS (e)) +/* workaround for avoiding API breakage */ +#define etssv_get_type e_table_subset_variable_get_type +G_DEFINE_TYPE (ETableSubsetVariable, etssv, E_TABLE_SUBSET_TYPE) + #define INCREMENT_AMOUNT 10 static void @@ -117,17 +121,19 @@ etssv_remove (ETableSubsetVariable *etssv, } static void -etssv_class_init (GObjectClass *object_class) +etssv_class_init (ETableSubsetVariableClass *klass) { - ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - klass->add = etssv_add; klass->add_array = etssv_add_array; klass->add_all = etssv_add_all; klass->remove = etssv_remove; } -E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, E_TABLE_SUBSET_TYPE) +static void +etssv_init (ETableSubsetVariable *etssv) +{ + /* nothing to do */ +} ETableModel * e_table_subset_variable_construct (ETableSubsetVariable *etssv, diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index df3d5f6139..6ac3b59914 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -40,7 +40,9 @@ static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel #define d(x) -static ETableModelClass *etss_parent_class; +/* workaround for avoding API breakage */ +#define etss_get_type e_table_subset_get_type +G_DEFINE_TYPE (ETableSubset, etss, E_TABLE_MODEL_TYPE) #define ETSS_CLASS(object) (E_TABLE_SUBSET_GET_CLASS(object)) @@ -246,13 +248,11 @@ etss_value_to_string (ETableModel *etm, int col, const void *value) } static void -etss_class_init (GObjectClass *object_class) +etss_class_init (ETableSubsetClass *klass) { - ETableSubsetClass *klass = (ETableSubsetClass *) object_class; - ETableModelClass *table_class = (ETableModelClass *) object_class; + ETableModelClass *table_class = E_TABLE_MODEL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - etss_parent_class = g_type_class_peek_parent (klass); - object_class->dispose = etss_dispose; object_class->finalize = etss_finalize; @@ -288,8 +288,6 @@ etss_init (ETableSubset *etss) etss->last_access = 0; } -E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, etss_init, E_TABLE_MODEL_TYPE) - static void etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm) { diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index 6f43105703..95b3e3661b 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -30,12 +30,12 @@ #include "e-table-without.h" -#define PARENT_TYPE E_TABLE_SUBSET_TYPE +/* workaround for avoiding API breakage */ +#define etw_get_type e_table_without_get_type +G_DEFINE_TYPE (ETableWithout, etw, E_TABLE_SUBSET_TYPE) #define INCREMENT_AMOUNT 10 -static ETableSubsetClass *parent_class; - struct _ETableWithoutPrivate { GHashTable *hash; @@ -144,8 +144,8 @@ etw_dispose (GObject *object) etw->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (etw_parent_class)->dispose) + (* G_OBJECT_CLASS (etw_parent_class)->dispose) (object); } static void @@ -217,8 +217,8 @@ etw_proxy_model_changed (ETableSubset *etss, ETableModel *etm) } etss->n_map = j; - if (parent_class->proxy_model_changed) - parent_class->proxy_model_changed (etss, etm); + if (E_TABLE_SUBSET_CLASS (etw_parent_class)->proxy_model_changed) + E_TABLE_SUBSET_CLASS (etw_parent_class)->proxy_model_changed (etss, etm); } static void @@ -227,8 +227,6 @@ etw_class_init (ETableWithoutClass *klass) ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->dispose = etw_dispose; etss_class->proxy_model_rows_inserted = etw_proxy_model_rows_inserted; @@ -248,8 +246,6 @@ etw_init (ETableWithout *etw) etw->priv->free_duplicated_key_func = NULL; } -E_MAKE_TYPE(e_table_without, "ETableWithout", ETableWithout, etw_class_init, etw_init, PARENT_TYPE) - ETableModel * e_table_without_construct (ETableWithout *etw, ETableModel *source, diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 4a3e8efccc..1fb97dae7d 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -55,7 +55,7 @@ #define COLUMN_HEADER_HEIGHT 16 -#define PARENT_TYPE gtk_table_get_type () +G_DEFINE_TYPE (ETable, e_table, GTK_TYPE_TABLE) #define d(x) @@ -65,8 +65,6 @@ #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x))) #endif -static GtkObjectClass *parent_class; - enum { CURSOR_CHANGE, CURSOR_ACTIVATED, @@ -223,8 +221,8 @@ static void et_size_request (GtkWidget *widget, GtkRequisition *request) { ETable *et = E_TABLE (widget); - if (GTK_WIDGET_CLASS (parent_class)->size_request) - GTK_WIDGET_CLASS (parent_class)->size_request (widget, request); + if (GTK_WIDGET_CLASS (e_table_parent_class)->size_request) + GTK_WIDGET_CLASS (e_table_parent_class)->size_request (widget, request); if (et->horizontal_resize) request->width = MAX (request->width, et->header_width); } @@ -393,7 +391,7 @@ et_dispose (GObject *object) g_free(et->domain); et->domain = NULL; - (*G_OBJECT_CLASS (parent_class)->dispose)(object); + (*G_OBJECT_CLASS (e_table_parent_class)->dispose)(object); } static void @@ -401,8 +399,8 @@ et_unrealize (GtkWidget *widget) { scroll_off (E_TABLE (widget)); - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); + if (GTK_WIDGET_CLASS (e_table_parent_class)->unrealize) + GTK_WIDGET_CLASS (e_table_parent_class)->unrealize (widget); } static gboolean @@ -500,16 +498,15 @@ et_finalize (GObject *object) g_free(et->domain); et->domain = NULL; - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_table_parent_class)->finalize (object); } static void -e_table_init (GtkObject *object) +e_table_init (ETable *e_table) { - ETable *e_table = E_TABLE (object); - GtkTable *gtk_table = GTK_TABLE (object); + GtkTable *gtk_table = GTK_TABLE (e_table); - GTK_WIDGET_SET_FLAGS (e_table, GTK_CAN_FOCUS); + GTK_WIDGET_SET_FLAGS (GTK_WIDGET (e_table), GTK_CAN_FOCUS); gtk_table->homogeneous = FALSE; @@ -3062,8 +3059,6 @@ e_table_class_init (ETableClass *class) object_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = g_type_class_peek_parent (class); - object_class->dispose = et_dispose; object_class->finalize = et_finalize; object_class->set_property = et_set_property; @@ -3345,4 +3340,3 @@ e_table_class_init (ETableClass *class) gal_a11y_e_table_init (); } -E_MAKE_TYPE(e_table, "ETable", ETable, e_table_class_init, e_table_init, PARENT_TYPE) diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c index 8bd0c86e74..408c3930cd 100644 --- a/widgets/table/e-tree-memory-callbacks.c +++ b/widgets/table/e-tree-memory-callbacks.c @@ -29,7 +29,7 @@ #include "e-tree-memory-callbacks.h" -#define PARENT_TYPE E_TREE_MEMORY_TYPE +G_DEFINE_TYPE (ETreeMemoryCallbacks, e_tree_memory_callbacks, E_TREE_MEMORY_TYPE) static GdkPixbuf * etmc_icon_at (ETreeModel *etm, ETreePath node) @@ -186,9 +186,9 @@ etmc_value_to_string (ETreeModel *etm, int col, const void *value) } static void -e_tree_memory_callbacks_class_init (GtkObjectClass *object_class) +e_tree_memory_callbacks_class_init (ETreeMemoryCallbacksClass *klass) { - ETreeModelClass *model_class = (ETreeModelClass *) object_class; + ETreeModelClass *model_class = E_TREE_MODEL_CLASS (klass); model_class->icon_at = etmc_icon_at; @@ -212,7 +212,11 @@ e_tree_memory_callbacks_class_init (GtkObjectClass *object_class) model_class->value_to_string = etmc_value_to_string; } -E_MAKE_TYPE(e_tree_memory_callbacks, "ETreeMemoryCallbacks", ETreeMemoryCallbacks, e_tree_memory_callbacks_class_init, NULL, PARENT_TYPE) +static void +e_tree_memory_callbacks_init (ETreeMemoryCallbacks *etmc) +{ + /* nothing to do */ +} /** * e_tree_memory_callbacks_new: diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index b24aef5e72..a221512c18 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -38,7 +38,7 @@ #include "e-tree-memory.h" -static ETreeModelClass *parent_class; +G_DEFINE_TYPE (ETreeMemory, e_tree_memory, E_TREE_MODEL_TYPE) enum { FILL_IN_CHILDREN, @@ -223,7 +223,7 @@ etmm_dispose (GObject *object) } etmm->priv = NULL; - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_tree_memory_parent_class)->dispose (object); } static ETreePath @@ -341,8 +341,8 @@ etmm_node_request_collapse (ETreeModel *etm, ETreePath node) if (node) etmm_clear_children_computed (node); - if (parent_class->node_request_collapse) { - parent_class->node_request_collapse (etm, node); + if (E_TREE_MODEL_CLASS (e_tree_memory_parent_class)->node_request_collapse) { + E_TREE_MODEL_CLASS (e_tree_memory_parent_class)->node_request_collapse (etm, node); } } @@ -353,8 +353,6 @@ e_tree_memory_class_init (ETreeMemoryClass *klass) ETreeModelClass *tree_class = (ETreeModelClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; - parent_class = g_type_class_peek_parent (klass); - signals [FILL_IN_CHILDREN] = g_signal_new ("fill_in_children", G_TYPE_FROM_CLASS (object_class), @@ -385,10 +383,8 @@ e_tree_memory_class_init (ETreeMemoryClass *klass) } static void -e_tree_memory_init (GObject *object) +e_tree_memory_init (ETreeMemory *etmm) { - ETreeMemory *etmm = (ETreeMemory *)object; - ETreeMemoryPriv *priv; priv = g_new0 (ETreeMemoryPriv, 1); @@ -401,10 +397,6 @@ e_tree_memory_init (GObject *object) priv->destroy_user_data = NULL; } -E_MAKE_TYPE(e_tree_memory, "ETreeMemory", ETreeMemory, e_tree_memory_class_init, e_tree_memory_init, E_TREE_MODEL_TYPE) - - - /** * e_tree_memory_construct: * @etree: diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index fca271c5f4..e61636d1f5 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -42,7 +42,7 @@ #define d(x) -static GObjectClass *parent_class; +G_DEFINE_TYPE (ETreeModel, e_tree_model, G_TYPE_OBJECT) enum { PRE_CHANGE, @@ -61,15 +61,13 @@ static guint e_tree_model_signals [LAST_SIGNAL] = {0, }; static void -e_tree_model_class_init (GObjectClass *klass) +e_tree_model_class_init (ETreeModelClass *klass) { - ETreeModelClass *tree_class = (ETreeModelClass *) klass; - - parent_class = g_type_class_peek_parent (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); e_tree_model_signals [PRE_CHANGE] = g_signal_new ("pre_change", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, pre_change), (GSignalAccumulator) NULL, NULL, @@ -78,7 +76,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NO_CHANGE] = g_signal_new ("no_change", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, no_change), (GSignalAccumulator) NULL, NULL, @@ -87,7 +85,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_CHANGED] = g_signal_new ("node_changed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, node_changed), (GSignalAccumulator) NULL, NULL, @@ -96,7 +94,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_DATA_CHANGED] = g_signal_new ("node_data_changed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, node_data_changed), (GSignalAccumulator) NULL, NULL, @@ -105,7 +103,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_COL_CHANGED] = g_signal_new ("node_col_changed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, node_col_changed), (GSignalAccumulator) NULL, NULL, @@ -114,7 +112,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_INSERTED] = g_signal_new ("node_inserted", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, node_inserted), (GSignalAccumulator) NULL, NULL, @@ -123,7 +121,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_REMOVED] = g_signal_new ("node_removed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, node_removed), (GSignalAccumulator) NULL, NULL, @@ -132,7 +130,7 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_DELETED] = g_signal_new ("node_deleted", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETreeModelClass, node_deleted), (GSignalAccumulator) NULL, NULL, @@ -141,63 +139,66 @@ e_tree_model_class_init (GObjectClass *klass) e_tree_model_signals [NODE_REQUEST_COLLAPSE] = g_signal_new ("node_request_collapse", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (object_class), 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; - - tree_class->get_parent = NULL; - tree_class->get_first_child = NULL; - tree_class->get_last_child = NULL; - tree_class->get_next = NULL; - tree_class->get_prev = NULL; - - tree_class->is_root = NULL; - tree_class->is_expandable = NULL; - tree_class->get_children = NULL; - tree_class->depth = NULL; - - tree_class->icon_at = NULL; - - tree_class->get_expanded_default = NULL; - tree_class->column_count = NULL; - - tree_class->has_save_id = NULL; - tree_class->get_save_id = NULL; - tree_class->has_get_node_by_id = NULL; - tree_class->get_node_by_id = NULL; - - tree_class->has_change_pending = NULL; - - tree_class->sort_value_at = NULL; - tree_class->value_at = NULL; - tree_class->set_value_at = NULL; - tree_class->is_editable = NULL; - - tree_class->duplicate_value = NULL; - tree_class->free_value = NULL; - tree_class->initialize_value = NULL; - tree_class->value_is_empty = NULL; - tree_class->value_to_string = NULL; - - tree_class->pre_change = NULL; - tree_class->no_change = NULL; - tree_class->node_changed = NULL; - tree_class->node_data_changed = NULL; - tree_class->node_col_changed = NULL; - tree_class->node_inserted = NULL; - tree_class->node_removed = NULL; - tree_class->node_deleted = NULL; - tree_class->node_request_collapse = NULL; + klass->get_root = NULL; + + klass->get_parent = NULL; + klass->get_first_child = NULL; + klass->get_last_child = NULL; + klass->get_next = NULL; + klass->get_prev = NULL; + + klass->is_root = NULL; + klass->is_expandable = NULL; + klass->get_children = NULL; + klass->depth = NULL; + + klass->icon_at = NULL; + + klass->get_expanded_default = NULL; + klass->column_count = NULL; + + klass->has_save_id = NULL; + klass->get_save_id = NULL; + klass->has_get_node_by_id = NULL; + klass->get_node_by_id = NULL; + + klass->has_change_pending = NULL; + + klass->sort_value_at = NULL; + klass->value_at = NULL; + klass->set_value_at = NULL; + klass->is_editable = NULL; + + klass->duplicate_value = NULL; + klass->free_value = NULL; + klass->initialize_value = NULL; + klass->value_is_empty = NULL; + klass->value_to_string = NULL; + + klass->pre_change = NULL; + klass->no_change = NULL; + klass->node_changed = NULL; + klass->node_data_changed = NULL; + klass->node_col_changed = NULL; + klass->node_inserted = NULL; + klass->node_removed = NULL; + klass->node_deleted = NULL; + klass->node_request_collapse = NULL; } -E_MAKE_TYPE(e_tree_model, "ETreeModel", ETreeModel, e_tree_model_class_init, NULL, G_TYPE_OBJECT) +static void +e_tree_model_init (ETreeModel *tree_model) +{ + /* nothing to do */ +} - /* signals */ /** diff --git a/widgets/table/e-tree-scrolled.c b/widgets/table/e-tree-scrolled.c index ce85ea8dbc..fe34cd391e 100644 --- a/widgets/table/e-tree-scrolled.c +++ b/widgets/table/e-tree-scrolled.c @@ -39,9 +39,7 @@ #define COLUMN_HEADER_HEIGHT 16 -#define PARENT_TYPE gtk_scrolled_window_get_type () - -static GtkObjectClass *parent_class; +G_DEFINE_TYPE (ETreeScrolled, e_tree_scrolled, GTK_TYPE_SCROLLED_WINDOW) enum { PROP_0, @@ -49,13 +47,11 @@ enum { }; static void -e_tree_scrolled_init (GtkObject *object) +e_tree_scrolled_init (ETreeScrolled *ets) { - ETreeScrolled *ets; GtkScrolledWindow *scrolled_window; - ets = E_TREE_SCROLLED (object); - scrolled_window = GTK_SCROLLED_WINDOW (object); + scrolled_window = GTK_SCROLLED_WINDOW (ets); GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS); @@ -218,8 +214,6 @@ e_tree_scrolled_class_init (ETreeScrolledClass *class) object_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->get_property = ets_get_property; widget_class->grab_focus = ets_grab_focus; @@ -234,5 +228,3 @@ e_tree_scrolled_class_init (ETreeScrolledClass *class) G_PARAM_READABLE)); } -E_MAKE_TYPE(e_tree_scrolled, "ETreeScrolled", ETreeScrolled, e_tree_scrolled_class_init, e_tree_scrolled_init, PARENT_TYPE) - diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 6e69615aeb..7803c597a8 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -30,9 +30,7 @@ #include "e-tree-selection-model.h" -#define PARENT_TYPE e_selection_model_get_type () - -static ESelectionModelClass *parent_class; +G_DEFINE_TYPE (ETreeSelectionModel, e_tree_selection_model, E_SELECTION_MODEL_TYPE) enum { PROP_0, @@ -280,8 +278,8 @@ etsm_dispose (GObject *object) drop_model(etsm); - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_tree_selection_model_parent_class)->dispose) + (* G_OBJECT_CLASS (e_tree_selection_model_parent_class)->dispose) (object); } static void @@ -296,8 +294,8 @@ etsm_finalize (GObject *object) etsm->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + if (G_OBJECT_CLASS (e_tree_selection_model_parent_class)->finalize) + (* G_OBJECT_CLASS (e_tree_selection_model_parent_class)->finalize) (object); } static void @@ -778,8 +776,6 @@ e_tree_selection_model_class_init (ETreeSelectionModelClass *klass) GObjectClass *object_class; ESelectionModelClass *esm_class; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class = G_OBJECT_CLASS(klass); esm_class = E_SELECTION_MODEL_CLASS(klass); @@ -842,5 +838,3 @@ e_tree_selection_model_new (void) return g_object_new (E_TREE_SELECTION_MODEL_TYPE, NULL); } -E_MAKE_TYPE(e_tree_selection_model, "ETreeSelectionModel", ETreeSelectionModel, - e_tree_selection_model_class_init, e_tree_selection_model_init, PARENT_TYPE) diff --git a/widgets/table/e-tree-simple.c b/widgets/table/e-tree-simple.c index 54ffa894b8..11d26541ab 100644 --- a/widgets/table/e-tree-simple.c +++ b/widgets/table/e-tree-simple.c @@ -143,7 +143,7 @@ e_tree_simple_class_init (GObjectClass *object_class) model_class ->is_editable = simple_is_editable; } -E_MAKE_TYPE(e_tree_simple, "ETreeSimple", ETreeSimple, e_tree_simple_class_init, NULL, E_TREE_MODEL_TYPE) +G_DEFINE_TYPE (ETreeSimple, e_tree_simple, E_TREE_MODEL_TYPE) /** * e_tree_simple_new: diff --git a/widgets/table/e-tree-sorted-variable.c b/widgets/table/e-tree-sorted-variable.c index 61e87e36ff..381315c3d0 100644 --- a/widgets/table/e-tree-sorted-variable.c +++ b/widgets/table/e-tree-sorted-variable.c @@ -128,7 +128,7 @@ etsv_init (ETreeSortedVariable *etsv) etsv->insert_count = 0; } -E_MAKE_TYPE(e_tree_sorted_variable, "ETreeSortedVariable", ETreeSortedVariable, etsv_class_init, etsv_init, E_TREE_MODEL_TYPE) +G_DEFINE_TYPE (ETreeSortedVariable, etsv, E_TREE_MODEL_TYPE) static gboolean etsv_sort_idle(ETreeSortedVariable *etsv) diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 39e3a1cdfb..5a08e4a009 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -49,7 +49,7 @@ #define d(x) -static ETreeModel *parent_class; +G_DEFINE_TYPE (ETreeSorted, e_tree_sorted, E_TREE_MODEL_TYPE) enum { NODE_RESORTED, @@ -588,7 +588,7 @@ ets_dispose (GObject *object) /* FIXME lots of stuff to free here */ if (!priv) { - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_tree_sorted_parent_class)->dispose (object); return; } @@ -657,7 +657,7 @@ ets_finalize (GObject *object) g_free (ets->priv); ets->priv = NULL; - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_tree_sorted_parent_class)->finalize (object); } static ETreePath @@ -1152,8 +1152,6 @@ e_tree_sorted_class_init (ETreeSortedClass *klass) ETreeModelClass *tree_class = E_TREE_MODEL_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - klass->node_resorted = NULL; object_class->dispose = ets_dispose; @@ -1205,10 +1203,8 @@ e_tree_sorted_class_init (ETreeSortedClass *klass) } static void -e_tree_sorted_init (GObject *object) +e_tree_sorted_init (ETreeSorted *ets) { - ETreeSorted *ets = (ETreeSorted *)object; - ETreeSortedPriv *priv; priv = g_new0 (ETreeSortedPriv, 1); @@ -1241,8 +1237,6 @@ e_tree_sorted_init (GObject *object) priv->nested_resort_idle = 0; } -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: * @etree: diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 5979b37eb8..86e46b3121 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -38,13 +38,13 @@ #include "e-table-sorting-utils.h" #include "e-tree-table-adapter.h" -#define PARENT_TYPE E_TABLE_MODEL_TYPE +/* workaround for avoiding API breakage */ +#define etta_get_type e_tree_table_adapter_get_type +G_DEFINE_TYPE (ETreeTableAdapter, etta, E_TABLE_MODEL_TYPE) #define d(x) #define INCREMENT_AMOUNT 100 -static ETableModelClass *parent_class; - typedef struct { ETreePath path; guint32 num_visible_children; @@ -509,7 +509,7 @@ etta_finalize (GObject *object) g_free (etta->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (etta_parent_class)->finalize (object); } static void @@ -551,7 +551,7 @@ etta_dispose (GObject *object) etta->priv->source = NULL; } - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (etta_parent_class)->dispose (object); } static int @@ -681,8 +681,6 @@ etta_class_init (ETreeTableAdapterClass *klass) ETableModelClass *table_class = (ETableModelClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = etta_dispose; object_class->finalize = etta_finalize; @@ -732,8 +730,6 @@ etta_init (ETreeTableAdapter *etta) etta->priv->node_request_collapse_id = 0; } -E_MAKE_TYPE(e_tree_table_adapter, "ETreeTableAdapter", ETreeTableAdapter, etta_class_init, etta_init, PARENT_TYPE) - static void etta_proxy_pre_change (ETreeModel *etm, ETreeTableAdapter *etta) { diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index da60bc2a6a..d9cf019a6b 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -54,9 +54,7 @@ #define COLUMN_HEADER_HEIGHT 16 -#define PARENT_TYPE gtk_table_get_type () - -static GtkObjectClass *parent_class; +G_DEFINE_TYPE (ETree, e_tree, GTK_TYPE_TABLE) #define d(x) @@ -429,8 +427,8 @@ et_dispose (GObject *object) et->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); + if (G_OBJECT_CLASS (e_tree_parent_class)->dispose) + G_OBJECT_CLASS (e_tree_parent_class)->dispose (object); } static void @@ -439,8 +437,8 @@ et_unrealize (GtkWidget *widget) scroll_off (E_TREE (widget)); hover_off (E_TREE (widget)); - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); + if (GTK_WIDGET_CLASS (e_tree_parent_class)->unrealize) + GTK_WIDGET_CLASS (e_tree_parent_class)->unrealize (widget); } typedef struct { @@ -526,12 +524,11 @@ et_search_accept (ETableSearch *search, ETree *et) } static void -e_tree_init (GtkObject *object) +e_tree_init (ETree *e_tree) { - ETree *e_tree = E_TREE (object); - GtkTable *gtk_table = GTK_TABLE (object); + GtkTable *gtk_table = GTK_TABLE (e_tree); - GTK_WIDGET_SET_FLAGS (e_tree, GTK_CAN_FOCUS); + GTK_WIDGET_SET_FLAGS (GTK_WIDGET (e_tree), GTK_CAN_FOCUS); gtk_table->homogeneous = FALSE; @@ -3049,8 +3046,6 @@ e_tree_class_init (ETreeClass *class) object_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->dispose = et_dispose; object_class->set_property = et_set_property; object_class->get_property = et_get_property; @@ -3366,4 +3361,3 @@ e_tree_class_init (ETreeClass *class) gal_a11y_e_tree_init (); } -E_MAKE_TYPE(e_tree, "ETree", ETree, e_tree_class_init, e_tree_init, PARENT_TYPE) |