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 | |
parent | 08de5e9e147248b84bc1fa618f7cc9d892ddb136 (diff) | |
download | gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar.gz gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar.bz2 gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar.lz gsoc2013-evolution-6baf4d9bcc8fac7d3ac4442ffa54138f9670b20f.tar.xz 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
97 files changed, 754 insertions, 1176 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index b28edc8806..4e9a519b24 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,13 @@ +2007-07-27 Hiroyuki Ikezoe <poincare@ikezoe.net> + + * e-util.h: Remove E_MAKE_TYPE macro. + + * e-text-event-processor.c: + * e-sorter.c: + * e-text-event-processor-emacs-like.c: + * e-sorter-array.c: + * e-bit-array.c: Use G_DEFINE_TYPE instead of E_MAKE_TYPE. + 2007-07-26 Sankar P <psankar@novell.com> * e-plugin.c: (e_plugin_configure), (epl_configure), diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c index 8fa7af134e..07728b4134 100644 --- a/e-util/e-bit-array.c +++ b/e-util/e-bit-array.c @@ -28,8 +28,6 @@ #include "e-bit-array.h" #include "e-util.h" -#define PARENT_TYPE G_TYPE_OBJECT - #define ONES ((guint32) 0xffffffff) #define BOX(n) ((n) / 32) @@ -38,7 +36,7 @@ #define BITMASK_LEFT(n) ((((n) % 32) == 0) ? 0 : (ONES << (32 - ((n) % 32)))) #define BITMASK_RIGHT(n) ((guint32)(((guint32) ONES) >> ((n) % 32))) -static GObjectClass *parent_class; +G_DEFINE_TYPE (EBitArray, e_bit_array, G_TYPE_OBJECT) static void e_bit_array_insert_real(EBitArray *eba, int row) @@ -151,8 +149,8 @@ eba_dispose (GObject *object) g_free(eba->data); eba->data = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_bit_array_parent_class)->dispose) + (* G_OBJECT_CLASS (e_bit_array_parent_class)->dispose) (object); } /** @@ -411,16 +409,11 @@ e_bit_array_class_init (EBitArrayClass *klass) { GObjectClass *object_class; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class = G_OBJECT_CLASS(klass); object_class->dispose = eba_dispose; } -E_MAKE_TYPE(e_bit_array, "EBitArray", EBitArray, - e_bit_array_class_init, e_bit_array_init, PARENT_TYPE) - EBitArray * e_bit_array_new (int count) { diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c index 0f103a339a..894798f393 100644 --- a/e-util/e-sorter-array.c +++ b/e-util/e-sorter-array.c @@ -31,11 +31,9 @@ #define d(x) -#define PARENT_TYPE E_SORTER_TYPE - #define INCREMENT_AMOUNT 100 -static ESorterClass *parent_class; +G_DEFINE_TYPE (ESorterArray, e_sorter_array, E_SORTER_TYPE) static void esa_sort (ESorterArray *esa); static void esa_backsort (ESorterArray *esa); @@ -237,12 +235,10 @@ e_sorter_array_new (ECompareRowsFunc compare, gpointer closure) } static void -esa_class_init (ESorterArrayClass *klass) +e_sorter_array_class_init (ESorterArrayClass *klass) { ESorterClass *sorter_class = E_SORTER_CLASS(klass); - parent_class = g_type_class_ref (PARENT_TYPE); - sorter_class->model_to_sorted = esa_model_to_sorted ; sorter_class->sorted_to_model = esa_sorted_to_model ; sorter_class->get_model_to_sorted_array = esa_get_model_to_sorted_array ; @@ -251,7 +247,7 @@ esa_class_init (ESorterArrayClass *klass) } static void -esa_init (ESorterArray *esa) +e_sorter_array_init (ESorterArray *esa) { esa->rows = 0; esa->compare = NULL; @@ -260,4 +256,3 @@ esa_init (ESorterArray *esa) esa->backsorted = NULL; } -E_MAKE_TYPE(e_sorter_array, "ESorterArray", ESorterArray, esa_class_init, esa_init, PARENT_TYPE) diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c index 4ac07809be..624cf7660b 100644 --- a/e-util/e-sorter.c +++ b/e-util/e-sorter.c @@ -33,7 +33,7 @@ #define PARENT_TYPE G_TYPE_OBJECT -static GObjectClass *parent_class; +G_DEFINE_TYPE (ESorter, e_sorter, G_TYPE_OBJECT) static gint es_model_to_sorted (ESorter *es, int row); static gint es_sorted_to_model (ESorter *es, int row); @@ -42,10 +42,8 @@ static void es_get_sorted_to_model_array (ESorter *es, int **array, int *count); static gboolean es_needs_sorting(ESorter *es); static void -es_class_init (ESorterClass *klass) +e_sorter_class_init (ESorterClass *klass) { - parent_class = g_type_class_ref (PARENT_TYPE); - klass->model_to_sorted = es_model_to_sorted; klass->sorted_to_model = es_sorted_to_model; klass->get_model_to_sorted_array = es_get_model_to_sorted_array; @@ -54,12 +52,10 @@ es_class_init (ESorterClass *klass) } static void -es_init (ESorter *es) +e_sorter_init (ESorter *es) { } -E_MAKE_TYPE(e_sorter, "ESorter", ESorter, es_class_init, es_init, PARENT_TYPE) - ESorter * e_sorter_new (void) { diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c index b04ae724f5..a5935fde06 100644 --- a/e-util/e-text-event-processor-emacs-like.c +++ b/e-util/e-text-event-processor-emacs-like.c @@ -34,8 +34,7 @@ static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLik static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass); static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); -#define PARENT_TYPE E_TEXT_EVENT_PROCESSOR_TYPE -static ETextEventProcessorClass *parent_class = NULL; +G_DEFINE_TYPE (ETextEventProcessorEmacsLike, e_text_event_processor_emacs_like, E_TEXT_EVENT_PROCESSOR_TYPE) /* The arguments we take */ enum { @@ -103,13 +102,6 @@ static const ETextEventProcessorCommand alt_keys[26] = }; -E_MAKE_TYPE (e_text_event_processor_emacs_like, - "ETextEventProcessorEmacsLike", - ETextEventProcessorEmacsLike, - e_text_event_processor_emacs_like_class_init, - e_text_event_processor_emacs_like_init, - PARENT_TYPE) - static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) { @@ -117,8 +109,6 @@ e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass processor_class = (ETextEventProcessorClass*) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - processor_class->event = e_text_event_processor_emacs_like_event; } diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c index c5dc27cc7d..9f9ca211d2 100644 --- a/e-util/e-text-event-processor.c +++ b/e-util/e-text-event-processor.c @@ -41,9 +41,6 @@ static void e_text_event_processor_get_property (GObject *object, GValue *value, GParamSpec *pspec); -#define PARENT_TYPE G_TYPE_OBJECT -static GObjectClass *parent_class = NULL; - /* The arguments we take */ enum { PROP_0, @@ -57,12 +54,7 @@ enum { static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; -E_MAKE_TYPE (e_text_event_processor, - "ETextEventProcessor", - ETextEventProcessor, - e_text_event_processor_class_init, - e_text_event_processor_init, - PARENT_TYPE) +G_DEFINE_TYPE (ETextEventProcessor, e_text_event_processor, G_TYPE_OBJECT) static void e_text_event_processor_class_init (ETextEventProcessorClass *klass) @@ -71,8 +63,6 @@ e_text_event_processor_class_init (ETextEventProcessorClass *klass) object_class = (GObjectClass*) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->set_property = e_text_event_processor_set_property; object_class->get_property = e_text_event_processor_get_property; diff --git a/e-util/e-util.h b/e-util/e-util.h index 2cbae35cb8..ce2c685372 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -37,30 +37,6 @@ extern "C" { #include <e-util/e-util-marshal.h> -#define E_MAKE_TYPE(l,str,t,ci,i,parent) \ -GType l##_get_type(void)\ -{\ - static GType type = 0; \ - if (!type){ \ - static GTypeInfo const object_info = { \ - sizeof (t##Class), \ - \ - (GBaseInitFunc) NULL, \ - (GBaseFinalizeFunc) NULL, \ - \ - (GClassInitFunc) ci, \ - (GClassFinalizeFunc) NULL, \ - NULL, /* class_data */ \ - \ - sizeof (t), \ - 0, /* n_preallocs */ \ - (GInstanceInitFunc) i, \ - }; \ - type = g_type_register_static (parent, str, &object_info, 0); \ - } \ - return type; \ -} - typedef enum { E_FOCUS_NONE, E_FOCUS_CURRENT, diff --git a/widgets/ChangeLog b/widgets/ChangeLog index a58f6539e6..8ed846152c 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,34 @@ +2007-07-27 Hiroyuki Ikezoe <poincare@ikezoe.net> + + * text/e-text-model-uri.c: + * text/e-completion-view.c: + * text/e-text-model.c: + * text/e-text.c: + * text/e-completion-callbacks.c: + * text/e-entry.c: + * text/e-table-text-model.c: + * text/e-completion.c: + * menus/gal-view-new-dialog.c: + * menus/gal-view-collection.c: + * menus/gal-view-etable.c: + * menus/gal-view-instance-save-as-dialog.c: + * menus/gal-view-factory-etable.c: + * menus/gal-view.c: + * menus/gal-view-instance.c: + * menus/gal-view-factory.c: + * menus/gal-define-views-dialog.c: + * menus/gal-define-views-model.c: + * misc/e-canvas-vbox.c: + * misc/e-reflow-model.c: + * misc/e-selection-model-array.c: + * misc/e-reflow.c: + * misc/e-canvas.c: + * misc/e-selection-model.c: + * misc/e-printable.c: + * misc/e-canvas-background.c: + * misc/e-selection-model-simple.c: Use G_DEFINE_TYPE instead of + E_MAKE_TYPE. + 2007-07-27 Matthew Barnes <mbarnes@redhat.com> * text/Makefile.am: diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c index 8f7aec365f..9518d22143 100644 --- a/widgets/menus/gal-define-views-dialog.c +++ b/widgets/menus/gal-define-views-dialog.c @@ -40,9 +40,6 @@ static void gal_define_views_dialog_set_property (GObject *object, guint prop_id static void gal_define_views_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void gal_define_views_dialog_dispose (GObject *object); -static GtkDialogClass *parent_class = NULL; -#define PARENT_TYPE GTK_TYPE_DIALOG - /* The properties we support */ enum { PROP_0, @@ -63,8 +60,7 @@ typedef struct { GalDefineViewsDialog *names; } GalDefineViewsDialogChild; - -E_MAKE_TYPE(gal_define_views_dialog, "GalDefineViewsDialog", GalDefineViewsDialog, gal_define_views_dialog_class_init, gal_define_views_dialog_init, PARENT_TYPE) +G_DEFINE_TYPE (GalDefineViewsDialog, gal_define_views_dialog, GTK_TYPE_DIALOG) static void gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass) @@ -73,8 +69,6 @@ gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass) object_class = (GObjectClass*) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->set_property = gal_define_views_dialog_set_property; object_class->get_property = gal_define_views_dialog_get_property; object_class->dispose = gal_define_views_dialog_dispose; @@ -305,8 +299,8 @@ gal_define_views_dialog_dispose (GObject *object) g_object_unref(gal_define_views_dialog->gui); gal_define_views_dialog->gui = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (gal_define_views_dialog_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_define_views_dialog_parent_class)->dispose) (object); } static void diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c index b38dbbc4b2..912012935b 100644 --- a/widgets/menus/gal-define-views-model.c +++ b/widgets/menus/gal-define-views-model.c @@ -32,8 +32,7 @@ #include "gal-define-views-model.h" -#define PARENT_TYPE E_TABLE_MODEL_TYPE -static ETableModelClass *parent_class; +G_DEFINE_TYPE (GalDefineViewsModel, gal_define_views_model, E_TABLE_MODEL_TYPE) /* * GalDefineViewsModel callbacks @@ -57,8 +56,8 @@ gdvm_dispose(GObject *object) g_object_unref(model->collection); model->collection = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (gal_define_views_model_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_define_views_model_parent_class)->dispose) (object); } /* This function returns the number of columns in our ETableModel. */ @@ -166,11 +165,10 @@ gal_define_views_model_append (GalDefineViewsModel *model, } static void -gal_define_views_model_class_init (GObjectClass *object_class) +gal_define_views_model_class_init (GalDefineViewsModelClass *klass) { - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = gdvm_dispose; object_class->set_property = gal_define_views_model_set_property; @@ -204,10 +202,8 @@ gal_define_views_model_class_init (GObjectClass *object_class) } static void -gal_define_views_model_init (GObject *object) +gal_define_views_model_init (GalDefineViewsModel *model) { - GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object); - model->collection = NULL; } @@ -255,8 +251,6 @@ gal_define_views_model_get_property (GObject *object, guint prop_id, GValue *val } } -E_MAKE_TYPE(gal_define_views_model, "GalDefineViewsModel", GalDefineViewsModel, gal_define_views_model_class_init, gal_define_views_model_init, PARENT_TYPE) - /** * gal_define_views_model_new * diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c index b94fb02f5f..6d86b91c76 100644 --- a/widgets/menus/gal-view-collection.c +++ b/widgets/menus/gal-view-collection.c @@ -39,9 +39,7 @@ #include "gal-view-collection.h" -#define PARENT_TYPE G_TYPE_OBJECT - -static GObjectClass *gal_view_collection_parent_class; +G_DEFINE_TYPE (GalViewCollection, gal_view_collection, G_TYPE_OBJECT) #define d(x) @@ -191,16 +189,15 @@ gal_view_collection_dispose (GObject *object) g_free (collection->title); collection->title = NULL; - if (gal_view_collection_parent_class->dispose) - (*gal_view_collection_parent_class->dispose)(object); + if (G_OBJECT_CLASS (gal_view_collection_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_view_collection_parent_class)->dispose)(object); } static void -gal_view_collection_class_init (GObjectClass *object_class) +gal_view_collection_class_init (GalViewCollectionClass *klass) { - GalViewCollectionClass *klass = GAL_VIEW_COLLECTION_CLASS(object_class); - gal_view_collection_parent_class = g_type_class_ref (PARENT_TYPE); - + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = gal_view_collection_dispose; gal_view_collection_signals [DISPLAY_VIEW] = @@ -245,8 +242,6 @@ gal_view_collection_init (GalViewCollection *collection) collection->title = NULL; } -E_MAKE_TYPE(gal_view_collection, "GalViewCollection", GalViewCollection, gal_view_collection_class_init, gal_view_collection_init, PARENT_TYPE) - /** * gal_view_collection_new: * diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c index f35d94e5db..6a7576c311 100644 --- a/widgets/menus/gal-view-etable.c +++ b/widgets/menus/gal-view-etable.c @@ -27,9 +27,7 @@ #include "gal-view-etable.h" -#define PARENT_TYPE GAL_VIEW_TYPE - -static GalViewClass *gal_view_etable_parent_class; +G_DEFINE_TYPE (GalViewEtable, gal_view_etable, GAL_VIEW_TYPE) static void detach_table (GalViewEtable *view) @@ -163,10 +161,10 @@ gal_view_etable_dispose (GObject *object) } static void -gal_view_etable_class_init (GObjectClass *object_class) +gal_view_etable_class_init (GalViewEtableClass *klass) { - GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class); - gal_view_etable_parent_class = g_type_class_ref (PARENT_TYPE); + GalViewClass *gal_view_class = GAL_VIEW_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); gal_view_class->edit = gal_view_etable_edit ; gal_view_class->load = gal_view_etable_load ; @@ -187,8 +185,6 @@ gal_view_etable_init (GalViewEtable *gve) gve->title = NULL; } -E_MAKE_TYPE(gal_view_etable, "GalViewEtable", GalViewEtable, gal_view_etable_class_init, gal_view_etable_init, PARENT_TYPE) - /** * gal_view_etable_new * @spec: The ETableSpecification that this view will be based upon. diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c index 309cf2d5cb..655740f5ec 100644 --- a/widgets/menus/gal-view-factory-etable.c +++ b/widgets/menus/gal-view-factory-etable.c @@ -29,9 +29,7 @@ #include "gal-view-etable.h" #include "gal-view-factory-etable.h" -#define PARENT_TYPE GAL_VIEW_FACTORY_TYPE - -static GalViewFactoryClass *gal_view_factory_etable_parent_class; +G_DEFINE_TYPE (GalViewFactoryEtable, gal_view_factory_etable, GAL_VIEW_FACTORY_TYPE) static const char * gal_view_factory_etable_get_title (GalViewFactory *factory) @@ -66,10 +64,10 @@ gal_view_factory_etable_dispose (GObject *object) } static void -gal_view_factory_etable_class_init (GObjectClass *object_class) +gal_view_factory_etable_class_init (GalViewFactoryEtableClass *klass) { - GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_etable_parent_class = g_type_class_ref (PARENT_TYPE); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS (klass); view_factory_class->get_title = gal_view_factory_etable_get_title; view_factory_class->new_view = gal_view_factory_etable_new_view; @@ -119,4 +117,3 @@ gal_view_factory_etable_construct (GalViewFactoryEtable *factory, return GAL_VIEW_FACTORY(factory); } -E_MAKE_TYPE(gal_view_factory_etable, "GalViewFactoryEtable", GalViewFactoryEtable, gal_view_factory_etable_class_init, gal_view_factory_etable_init, PARENT_TYPE) diff --git a/widgets/menus/gal-view-factory.c b/widgets/menus/gal-view-factory.c index 6441d9ee24..f9f832d767 100644 --- a/widgets/menus/gal-view-factory.c +++ b/widgets/menus/gal-view-factory.c @@ -27,14 +27,12 @@ #include "gal-view-factory.h" -#define PARENT_TYPE G_TYPE_OBJECT +G_DEFINE_TYPE (GalViewFactory, gal_view_factory, G_TYPE_OBJECT) #define d(x) d(static gint depth = 0;) -static GObjectClass *gal_view_factory_parent_class; - /** * gal_view_factory_get_title: * @factory: The factory to query. @@ -92,11 +90,8 @@ gal_view_factory_get_type_code (GalViewFactory *factory) } static void -gal_view_factory_class_init (GObjectClass *object_class) +gal_view_factory_class_init (GalViewFactoryClass *klass) { - GalViewFactoryClass *klass = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_parent_class = g_type_class_ref (PARENT_TYPE); - klass->get_title = NULL; klass->new_view = NULL; } @@ -106,4 +101,3 @@ gal_view_factory_init (GalViewFactory *factory) { } -E_MAKE_TYPE(gal_view_factory, "GalViewFactory", GalViewFactory, gal_view_factory_class_init, gal_view_factory_init, PARENT_TYPE) diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c index 622b99a049..ba322563dc 100644 --- a/widgets/menus/gal-view-instance-save-as-dialog.c +++ b/widgets/menus/gal-view-instance-save-as-dialog.c @@ -33,8 +33,7 @@ #include "gal-view-instance-save-as-dialog.h" #include "gal-view-new-dialog.h" -static GtkDialogClass *parent_class = NULL; -#define PARENT_TYPE GTK_TYPE_DIALOG +G_DEFINE_TYPE (GalViewInstanceSaveAsDialog, gal_view_instance_save_as_dialog, GTK_TYPE_DIALOG) /* The arguments we take */ enum { @@ -159,8 +158,8 @@ gal_view_instance_save_as_dialog_dispose (GObject *object) g_object_unref(gal_view_instance_save_as_dialog->gui); gal_view_instance_save_as_dialog->gui = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (gal_view_instance_save_as_dialog_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_view_instance_save_as_dialog_parent_class)->dispose) (object); } /* Init functions */ @@ -171,8 +170,6 @@ gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *k object_class = (GObjectClass*) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->set_property = gal_view_instance_save_as_dialog_set_property; object_class->get_property = gal_view_instance_save_as_dialog_get_property; object_class->dispose = gal_view_instance_save_as_dialog_dispose; @@ -270,11 +267,6 @@ gal_view_instance_save_as_dialog_new (GalViewInstance *instance) return widget; } -E_MAKE_TYPE(gal_view_instance_save_as_dialog, "GalViewInstanceSaveAsDialog", - GalViewInstanceSaveAsDialog, - gal_view_instance_save_as_dialog_class_init, - gal_view_instance_save_as_dialog_init, PARENT_TYPE) - void gal_view_instance_save_as_dialog_save (GalViewInstanceSaveAsDialog *dialog) { diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index 521da6a6b3..c2fb24af20 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -45,9 +45,7 @@ #include "gal-view-instance.h" #include "gal-view-instance-save-as-dialog.h" -#define PARENT_TYPE G_TYPE_OBJECT - -static GObjectClass *gal_view_instance_parent_class; +G_DEFINE_TYPE (GalViewInstance, gal_view_instance, G_TYPE_OBJECT) static const EPopupMenu separator = E_POPUP_SEPARATOR; static const EPopupMenu terminator = E_POPUP_TERMINATOR; @@ -174,16 +172,15 @@ gal_view_instance_dispose (GObject *object) g_free (instance->default_view); - if (gal_view_instance_parent_class->dispose) - (*gal_view_instance_parent_class->dispose)(object); + if (G_OBJECT_CLASS (gal_view_instance_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_view_instance_parent_class)->dispose)(object); } static void -gal_view_instance_class_init (GObjectClass *object_class) +gal_view_instance_class_init (GalViewInstanceClass *klass) { - GalViewInstanceClass *klass = GAL_VIEW_INSTANCE_CLASS(object_class); - gal_view_instance_parent_class = g_type_class_ref (PARENT_TYPE); - + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = gal_view_instance_dispose; gal_view_instance_signals [DISPLAY_VIEW] = @@ -229,8 +226,6 @@ gal_view_instance_init (GalViewInstance *instance) instance->default_view = NULL; } -E_MAKE_TYPE(gal_view_instance, "GalViewInstance", GalViewInstance, gal_view_instance_class_init, gal_view_instance_init, PARENT_TYPE) - static void collection_changed (GalView *view, GalViewInstance *instance) { diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c index c41ce03123..49c96d4c2c 100644 --- a/widgets/menus/gal-view-new-dialog.c +++ b/widgets/menus/gal-view-new-dialog.c @@ -40,9 +40,6 @@ static void gal_view_new_dialog_set_property (GObject *object, guint prop_id, co static void gal_view_new_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void gal_view_new_dialog_dispose (GObject *object); -static GtkDialogClass *parent_class = NULL; -#define PARENT_TYPE GTK_TYPE_DIALOG - /* The arguments we take */ enum { PROP_0, @@ -50,10 +47,7 @@ enum { PROP_FACTORY }; -E_MAKE_TYPE(gal_view_new_dialog, "GalViewNewDialog", - GalViewNewDialog, - gal_view_new_dialog_class_init, - gal_view_new_dialog_init, PARENT_TYPE) +G_DEFINE_TYPE (GalViewNewDialog, gal_view_new_dialog, GTK_TYPE_DIALOG) static void gal_view_new_dialog_class_init (GalViewNewDialogClass *klass) @@ -62,8 +56,6 @@ gal_view_new_dialog_class_init (GalViewNewDialogClass *klass) object_class = (GObjectClass*) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->set_property = gal_view_new_dialog_set_property; object_class->get_property = gal_view_new_dialog_get_property; object_class->dispose = gal_view_new_dialog_dispose; @@ -127,8 +119,8 @@ gal_view_new_dialog_dispose (GObject *object) g_object_unref(gal_view_new_dialog->gui); gal_view_new_dialog->gui = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (gal_view_new_dialog_parent_class)->dispose) + (* G_OBJECT_CLASS (gal_view_new_dialog_parent_class)->dispose) (object); } GtkWidget* diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c index 36c325aefd..30b9a683f3 100644 --- a/widgets/menus/gal-view.c +++ b/widgets/menus/gal-view.c @@ -27,15 +27,13 @@ #include "gal-view.h" -#define PARENT_TYPE G_TYPE_OBJECT +G_DEFINE_TYPE (GalView, gal_view, G_TYPE_OBJECT) #define d(x) d(static gint depth = 0;) -static GObjectClass *gal_view_parent_class; - enum { CHANGED, LAST_SIGNAL @@ -177,11 +175,10 @@ gal_view_changed (GalView *view) } static void -gal_view_class_init (GObjectClass *object_class) +gal_view_class_init (GalViewClass *klass) { - GalViewClass *klass = GAL_VIEW_CLASS(object_class); - gal_view_parent_class = g_type_class_ref (PARENT_TYPE); - + GObjectClass *object_class = G_OBJECT_CLASS (klass); + klass->edit = NULL; klass->load = NULL; klass->save = NULL; @@ -205,4 +202,3 @@ gal_view_init (GalView *view) { } -E_MAKE_TYPE(gal_view, "GalView", GalView, gal_view_class_init, gal_view_init, PARENT_TYPE) diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c index 02f8f1675c..334b01f232 100644 --- a/widgets/misc/e-canvas-background.c +++ b/widgets/misc/e-canvas-background.c @@ -38,7 +38,9 @@ #include "e-canvas-background.h" -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () +/* workaround for avoiding API broken */ +#define ecb_get_type e_canvas_background_get_type +G_DEFINE_TYPE (ECanvasBackground, ecb, GNOME_TYPE_CANVAS_ITEM) #define d(x) @@ -55,8 +57,6 @@ struct _ECanvasBackgroundPrivate { guint needs_redraw : 1; }; -static GnomeCanvasItemClass *parent_class; - enum { STYLE_SET, LAST_SIGNAL @@ -131,8 +131,8 @@ ecb_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) ArtPoint o1, o2; ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - GNOME_CANVAS_ITEM_CLASS (parent_class)->update (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS (ecb_parent_class)->update) + GNOME_CANVAS_ITEM_CLASS (ecb_parent_class)->update (item, affine, clip_path, flags); o1.x = item->x1; o1.y = item->y1; @@ -191,8 +191,8 @@ ecb_dispose (GObject *object) ecb->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); + if (G_OBJECT_CLASS (ecb_parent_class)->dispose) + G_OBJECT_CLASS (ecb_parent_class)->dispose (object); } static void @@ -316,10 +316,8 @@ ecb_get_property (GObject *object, } static void -ecb_init (GnomeCanvasItem *item) +ecb_init (ECanvasBackground *ecb) { - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - ecb->priv = g_new (ECanvasBackgroundPrivate, 1); ecb->priv->color.pixel = 0; @@ -339,8 +337,8 @@ ecb_realize (GnomeCanvasItem *item) { ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) - GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item); + if (GNOME_CANVAS_ITEM_CLASS (ecb_parent_class)->realize) + GNOME_CANVAS_ITEM_CLASS (ecb_parent_class)->realize (item); ecb->priv->gc = gdk_gc_new (item->canvas->layout.bin_window); get_color (ecb); @@ -361,8 +359,8 @@ ecb_unrealize (GnomeCanvasItem *item) g_object_unref (ecb->priv->gc); ecb->priv->gc = NULL; - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) - GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize (item); + if (GNOME_CANVAS_ITEM_CLASS (ecb_parent_class)->unrealize) + GNOME_CANVAS_ITEM_CLASS (ecb_parent_class)->unrealize (item); } static void @@ -433,12 +431,10 @@ ecb_style_set (ECanvasBackground *ecb, GtkStyle *previous_style) } static void -ecb_class_init (GObjectClass *object_class) +ecb_class_init (ECanvasBackgroundClass *ecb_class) { - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ECanvasBackgroundClass *ecb_class = (ECanvasBackgroundClass *) object_class; - - parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (ecb_class); + GObjectClass *object_class = G_OBJECT_CLASS (ecb_class); object_class->dispose = ecb_dispose; object_class->set_property = ecb_set_property; @@ -517,9 +513,3 @@ ecb_class_init (GObjectClass *object_class) G_TYPE_NONE, 1, GTK_TYPE_STYLE); } -E_MAKE_TYPE (e_canvas_background, - "ECanvasBackground", - ECanvasBackground, - ecb_class_init, - ecb_init, - PARENT_OBJECT_TYPE) diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c index 20562bc039..a53da60710 100644 --- a/widgets/misc/e-canvas-vbox.c +++ b/widgets/misc/e-canvas-vbox.c @@ -50,9 +50,6 @@ static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasI static void e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); static void e_canvas_vbox_resize_children (GnomeCanvasItem *item); -#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP -static GnomeCanvasGroupClass *parent_class = NULL; - /* The arguments we take */ enum { PROP_0, @@ -62,12 +59,7 @@ enum { PROP_SPACING }; -E_MAKE_TYPE (e_canvas_vbox, - "ECanvasVbox", - ECanvasVbox, - e_canvas_vbox_class_init, - e_canvas_vbox_init, - PARENT_TYPE) +G_DEFINE_TYPE (ECanvasVbox, e_canvas_vbox, GNOME_TYPE_CANVAS_GROUP) static void e_canvas_vbox_class_init (ECanvasVboxClass *klass) @@ -78,8 +70,6 @@ e_canvas_vbox_class_init (ECanvasVboxClass *klass) object_class = (GObjectClass*) klass; item_class = (GnomeCanvasItemClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - klass->add_item = e_canvas_vbox_real_add_item; klass->add_item_start = e_canvas_vbox_real_add_item_start; @@ -206,7 +196,7 @@ e_canvas_vbox_dispose (GObject *object) vbox->items = NULL; } - G_OBJECT_CLASS(parent_class)->dispose (object); + G_OBJECT_CLASS(e_canvas_vbox_parent_class)->dispose (object); } static gint @@ -239,8 +229,8 @@ e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event) break; } if (!return_val) { - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event); + if (GNOME_CANVAS_ITEM_CLASS(e_canvas_vbox_parent_class)->event) + return GNOME_CANVAS_ITEM_CLASS (e_canvas_vbox_parent_class)->event (item, event); } return return_val; @@ -249,8 +239,8 @@ e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event) static void e_canvas_vbox_realize (GnomeCanvasItem *item) { - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); + if (GNOME_CANVAS_ITEM_CLASS(e_canvas_vbox_parent_class)->realize) + (* GNOME_CANVAS_ITEM_CLASS(e_canvas_vbox_parent_class)->realize) (item); e_canvas_vbox_resize_children(item); e_canvas_item_request_reflow(item); diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index dee5d27b6d..be6ae0d93c 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -53,9 +53,6 @@ static void e_canvas_style_set (GtkWidget *widget, static int emit_event (GnomeCanvas *canvas, GdkEvent *event); -#define PARENT_TYPE GNOME_TYPE_CANVAS -static GnomeCanvasClass *parent_class = NULL; - #define d(x) enum { @@ -65,12 +62,7 @@ enum { static guint e_canvas_signals [LAST_SIGNAL] = { 0, }; -E_MAKE_TYPE (e_canvas, - "ECanvas", - ECanvas, - e_canvas_class_init, - e_canvas_init, - PARENT_TYPE) +G_DEFINE_TYPE (ECanvas, e_canvas, GNOME_TYPE_CANVAS) static void e_canvas_class_init (ECanvasClass *klass) @@ -81,8 +73,6 @@ e_canvas_class_init (ECanvasClass *klass) object_class = (GObjectClass*) klass; widget_class = (GtkWidgetClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->dispose = e_canvas_dispose; widget_class->key_press_event = e_canvas_key; @@ -146,8 +136,8 @@ e_canvas_dispose (GObject *object) e_canvas_hide_tooltip(canvas); - if ((G_OBJECT_CLASS (parent_class))->dispose) - (*(G_OBJECT_CLASS (parent_class))->dispose) (object); + if ((G_OBJECT_CLASS (e_canvas_parent_class))->dispose) + (*(G_OBJECT_CLASS (e_canvas_parent_class))->dispose) (object); } GtkWidget * @@ -683,8 +673,8 @@ e_canvas_realize (GtkWidget *widget) { ECanvas *ecanvas = E_CANVAS (widget); - if (GTK_WIDGET_CLASS (parent_class)->realize) - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); + if (GTK_WIDGET_CLASS (e_canvas_parent_class)->realize) + (* GTK_WIDGET_CLASS (e_canvas_parent_class)->realize) (widget); gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE); @@ -703,8 +693,8 @@ e_canvas_unrealize (GtkWidget *widget) gtk_im_context_set_client_window (ecanvas->im_context, NULL); - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); + if (GTK_WIDGET_CLASS (e_canvas_parent_class)->unrealize) + (* GTK_WIDGET_CLASS (e_canvas_parent_class)->unrealize) (widget); } static void diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c index b9d9221404..3792c79711 100644 --- a/widgets/misc/e-printable.c +++ b/widgets/misc/e-printable.c @@ -34,10 +34,7 @@ #define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass) -#define PARENT_TYPE GTK_TYPE_OBJECT - - -static GtkObjectClass *e_printable_parent_class; +G_DEFINE_TYPE (EPrintable, e_printable, GTK_TYPE_OBJECT) enum { PRINT_PAGE, @@ -51,10 +48,9 @@ enum { static guint e_printable_signals [LAST_SIGNAL] = { 0, }; static void -e_printable_class_init (GtkObjectClass *object_class) +e_printable_class_init (EPrintableClass *klass) { - EPrintableClass *klass = E_PRINTABLE_CLASS(object_class); - e_printable_parent_class = g_type_class_ref (PARENT_TYPE); + GObjectClass *object_class = G_OBJECT_CLASS (klass); e_printable_signals [PRINT_PAGE] = g_signal_new ("print_page", @@ -111,13 +107,11 @@ e_printable_class_init (GtkObjectClass *object_class) klass->will_fit = NULL; } - -E_MAKE_TYPE (e_printable, - "EPrintable", - EPrintable, - e_printable_class_init, - NULL, - PARENT_TYPE) +static void +e_printable_init (EPrintable *e_printable) +{ + /* nothing to do */ +} EPrintable * e_printable_new(void) diff --git a/widgets/misc/e-reflow-model.c b/widgets/misc/e-reflow-model.c index a96b17fc68..09630133e1 100644 --- a/widgets/misc/e-reflow-model.c +++ b/widgets/misc/e-reflow-model.c @@ -29,15 +29,13 @@ #include "e-reflow-model.h" -#define PARENT_TYPE G_TYPE_OBJECT +G_DEFINE_TYPE (EReflowModel, e_reflow_model, G_TYPE_OBJECT) #define d(x) d(static gint depth = 0;) -static GObjectClass *e_reflow_model_parent_class; - enum { MODEL_CHANGED, COMPARISON_CHANGED, @@ -153,10 +151,9 @@ e_reflow_model_reincarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasItem } static void -e_reflow_model_class_init (GObjectClass *object_class) +e_reflow_model_class_init (EReflowModelClass *klass) { - EReflowModelClass *klass = E_REFLOW_MODEL_CLASS(object_class); - e_reflow_model_parent_class = g_type_class_ref (PARENT_TYPE); + GObjectClass *object_class = G_OBJECT_CLASS (klass); e_reflow_model_signals [MODEL_CHANGED] = g_signal_new ("model_changed", @@ -217,13 +214,10 @@ e_reflow_model_class_init (GObjectClass *object_class) } static void -e_reflow_model_init (GObject *object) +e_reflow_model_init (EReflowModel *e_reflow_model) { } -E_MAKE_TYPE(e_reflow_model, "EReflowModel", EReflowModel, - e_reflow_model_class_init, e_reflow_model_init, PARENT_TYPE) - #if d(!)0 static void print_tabs (void) diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c index 594ea1f87b..abae2d54d2 100644 --- a/widgets/misc/e-reflow.c +++ b/widgets/misc/e-reflow.c @@ -56,8 +56,7 @@ static void e_reflow_resize_children (GnomeCanvasItem *item); #define E_REFLOW_BORDER_WIDTH 7 #define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) -#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP -static GnomeCanvasGroupClass *parent_class = NULL; +G_DEFINE_TYPE (EReflow, e_reflow, GNOME_TYPE_CANVAS_GROUP) /* The arguments we take */ enum { @@ -825,7 +824,7 @@ e_reflow_dispose (GObject *object) reflow->sorter = NULL; } - G_OBJECT_CLASS(parent_class)->dispose (object); + G_OBJECT_CLASS(e_reflow_parent_class)->dispose (object); } static void @@ -838,8 +837,8 @@ e_reflow_realize (GnomeCanvasItem *item) reflow = E_REFLOW (item); - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); + if (GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->realize) + (* GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->realize) (item); reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); @@ -893,8 +892,8 @@ e_reflow_unrealize (GnomeCanvasItem *item) disconnect_set_adjustment (reflow); disconnect_adjustment (reflow); - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); + if (GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->unrealize) + (* GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->unrealize) (item); } static gboolean @@ -1108,8 +1107,8 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) } if (return_val) return return_val; - else if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); + else if (GNOME_CANVAS_ITEM_CLASS( e_reflow_parent_class )->event) + return (* GNOME_CANVAS_ITEM_CLASS( e_reflow_parent_class )->event) (item, event); else return FALSE; } @@ -1123,8 +1122,8 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int i; double column_width; - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); + if (GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->draw) + GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->draw (item, drawable, x, y, width, height); column_width = reflow->column_width; running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; x_rect = running_width; @@ -1196,8 +1195,8 @@ e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gin reflow = E_REFLOW (item); - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->update) + GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->update (item, affine, clip_path, flags); x0 = item->x1; y0 = item->y1; @@ -1280,8 +1279,8 @@ e_reflow_point (GnomeCanvasItem *item, *actual_item = NULL; - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); + if (GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->point) + distance = GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->point (item, x, y, cx, cy, actual_item); if ((int) (distance * item->canvas->pixels_per_unit + 0.5) <= item->canvas->close_enough && *actual_item) return distance; @@ -1407,8 +1406,6 @@ e_reflow_class_init (EReflowClass *klass) object_class = (GObjectClass*) klass; item_class = (GnomeCanvasItemClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->set_property = e_reflow_set_property; object_class->get_property = e_reflow_get_property; object_class->dispose = e_reflow_dispose; @@ -1546,9 +1543,3 @@ e_reflow_init (EReflow *reflow) e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow); } -E_MAKE_TYPE (e_reflow, - "EReflow", - EReflow, - e_reflow_class_init, - e_reflow_init, - PARENT_TYPE) diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c index 3f91ba42cc..f73a67faf2 100644 --- a/widgets/misc/e-selection-model-array.c +++ b/widgets/misc/e-selection-model-array.c @@ -30,9 +30,7 @@ #include "e-selection-model-array.h" -#define PARENT_TYPE e_selection_model_get_type () - -static ESelectionModelClass *parent_class; +G_DEFINE_TYPE (ESelectionModelArray, e_selection_model_array, e_selection_model_get_type()) enum { PROP_0, @@ -142,8 +140,8 @@ esma_dispose (GObject *object) esma->eba = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_selection_model_array_parent_class)->dispose) + (* G_OBJECT_CLASS (e_selection_model_array_parent_class)->dispose) (object); } static void @@ -513,8 +511,6 @@ e_selection_model_array_class_init (ESelectionModelArrayClass *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); @@ -557,5 +553,3 @@ e_selection_model_array_class_init (ESelectionModelArrayClass *klass) G_PARAM_READWRITE)); } -E_MAKE_TYPE(e_selection_model_array, "ESelectionModelArray", ESelectionModelArray, - e_selection_model_array_class_init, e_selection_model_array_init, PARENT_TYPE) diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c index ad33815135..e023f3cb89 100644 --- a/widgets/misc/e-selection-model-simple.c +++ b/widgets/misc/e-selection-model-simple.c @@ -28,10 +28,6 @@ #include "e-selection-model-array.h" #include "e-selection-model-simple.h" -#define PARENT_TYPE e_selection_model_array_get_type () - -static ESelectionModelArray *parent_class; - static gint esms_get_row_count (ESelectionModelArray *esma); static void @@ -45,15 +41,12 @@ e_selection_model_simple_class_init (ESelectionModelSimpleClass *klass) { ESelectionModelArrayClass *esma_class; - parent_class = g_type_class_ref (PARENT_TYPE); - esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass); esma_class->get_row_count = esms_get_row_count; } -E_MAKE_TYPE(e_selection_model_simple, "ESelectionModelSimple", ESelectionModelSimple, - e_selection_model_simple_class_init, e_selection_model_simple_init, PARENT_TYPE) +G_DEFINE_TYPE (ESelectionModelSimple, e_selection_model_simple, e_selection_model_array_get_type()) /** * e_selection_model_simple_new diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c index 21eba118f2..5c24d44f49 100644 --- a/widgets/misc/e-selection-model.c +++ b/widgets/misc/e-selection-model.c @@ -31,9 +31,7 @@ #include "e-selection-model.h" -#define PARENT_TYPE G_TYPE_OBJECT - -static GObjectClass *e_selection_model_parent_class; +G_DEFINE_TYPE (ESelectionModel, e_selection_model, G_TYPE_OBJECT) enum { CURSOR_CHANGED, @@ -79,8 +77,8 @@ esm_dispose (GObject *object) drop_sorter(esm); - if (e_selection_model_parent_class->dispose) - (* e_selection_model_parent_class->dispose) (object); + if (G_OBJECT_CLASS (e_selection_model_parent_class)->dispose) + (* G_OBJECT_CLASS (e_selection_model_parent_class)->dispose) (object); } static void @@ -142,8 +140,6 @@ e_selection_model_class_init (ESelectionModelClass *klass) { GObjectClass *object_class; - e_selection_model_parent_class = g_type_class_ref (PARENT_TYPE); - object_class = G_OBJECT_CLASS(klass); object_class->dispose = esm_dispose; @@ -233,9 +229,6 @@ e_selection_model_class_init (ESelectionModelClass *klass) G_PARAM_READWRITE)); } -E_MAKE_TYPE(e_selection_model, "ESelectionModel", ESelectionModel, - e_selection_model_class_init, e_selection_model_init, PARENT_TYPE) - /** * e_selection_model_is_row_selected * @selection: #ESelectionModel to check 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) diff --git a/widgets/text/e-completion-callbacks.c b/widgets/text/e-completion-callbacks.c index 229a28d760..f6412e95ac 100644 --- a/widgets/text/e-completion-callbacks.c +++ b/widgets/text/e-completion-callbacks.c @@ -38,25 +38,13 @@ static void e_completion_callbacks_init (ECompletionCallbacks *complete); static void callbacks_request_completion (ECompletion *comp, const gchar *search_text, gint pos, gint limit); static void callbacks_end_completion (ECompletion *comp); -#define PARENT_TYPE E_COMPLETION_TYPE -static ECompletionClass *parent_class; - - - -E_MAKE_TYPE (e_completion_callbacks, - "ECompletionCallbacks", - ECompletionCallbacks, - e_completion_callbacks_class_init, - e_completion_callbacks_init, - PARENT_TYPE) +G_DEFINE_TYPE (ECompletionCallbacks, e_completion_callbacks, E_COMPLETION_TYPE) static void e_completion_callbacks_class_init (ECompletionCallbacksClass *klass) { ECompletionClass *comp_class = (ECompletionClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - comp_class->request_completion = callbacks_request_completion; comp_class->end_completion = callbacks_end_completion; } diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c index 0837160d6f..f08f2ecbc5 100644 --- a/widgets/text/e-completion-view.c +++ b/widgets/text/e-completion-view.c @@ -59,11 +59,6 @@ static void e_completion_view_class_init (ECompletionViewClass *klass); static void e_completion_view_init (ECompletionView *completion); static void e_completion_view_dispose (GObject *object); -#define PARENT_TYPE GTK_TYPE_EVENT_BOX -static GtkObjectClass *parent_class; - - - static gint e_completion_view_local_key_press_handler (GtkWidget *w, GdkEventKey *ev) { @@ -199,21 +194,14 @@ e_completion_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) } } -E_MAKE_TYPE (e_completion_view, - "ECompletionView", - ECompletionView, - e_completion_view_class_init, - e_completion_view_init, - PARENT_TYPE) - +G_DEFINE_TYPE (ECompletionView, e_completion_view, GTK_TYPE_EVENT_BOX) + static void e_completion_view_class_init (ECompletionViewClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_ref (PARENT_TYPE); - e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY] = g_signal_new ("nonempty", G_OBJECT_CLASS_TYPE (object_class), @@ -309,8 +297,8 @@ e_completion_view_dispose (GObject *object) g_object_unref (cv->completion); cv->completion = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_completion_view_parent_class)->dispose) + (G_OBJECT_CLASS (e_completion_view_parent_class)->dispose) (object); } static void diff --git a/widgets/text/e-completion.c b/widgets/text/e-completion.c index 7c45c8e0ec..1de9baf8da 100644 --- a/widgets/text/e-completion.c +++ b/widgets/text/e-completion.c @@ -64,25 +64,13 @@ static void e_completion_clear_matches (ECompletion *complete); static gboolean e_completion_sort (ECompletion *complete); #endif -#define PARENT_TYPE GTK_TYPE_OBJECT -static GtkObjectClass *parent_class; - - - -E_MAKE_TYPE (e_completion, - "ECompletion", - ECompletion, - e_completion_class_init, - e_completion_init, - PARENT_TYPE) +G_DEFINE_TYPE (ECompletion, e_completion, GTK_TYPE_OBJECT) static void e_completion_class_init (ECompletionClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - e_completion_signals[COMPLETION_STARTED] = g_signal_new ("completion_started", G_OBJECT_CLASS_TYPE (object_class), @@ -140,8 +128,8 @@ e_completion_dispose (GObject *object) complete->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - (G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_completion_parent_class)->dispose) + (G_OBJECT_CLASS (e_completion_parent_class)->dispose) (object); } static void diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c index 979048671f..589f3840dc 100644 --- a/widgets/text/e-entry.c +++ b/widgets/text/e-entry.c @@ -50,9 +50,7 @@ #define d(x) -#define PARENT_TYPE gtk_table_get_type () - -static GtkObjectClass *parent_class; +G_DEFINE_TYPE (EEntry, e_entry, GTK_TYPE_TABLE) enum { E_ENTRY_CHANGED, @@ -296,10 +294,9 @@ proxy_populate_popup (EText *text, GdkEventButton *ev, gint pos, GtkWidget *menu } static void -e_entry_init (GtkObject *object) +e_entry_init (EEntry *entry) { - EEntry *entry = E_ENTRY (object); - GtkTable *gtk_table = GTK_TABLE (object); + GtkTable *gtk_table = GTK_TABLE (entry); entry->priv = g_new0 (EEntryPrivate, 1); @@ -1127,8 +1124,8 @@ e_entry_dispose (GObject *object) entry->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_entry_parent_class)->dispose) + (* G_OBJECT_CLASS (e_entry_parent_class)->dispose) (object); } static void @@ -1136,8 +1133,8 @@ e_entry_realize (GtkWidget *widget) { EEntry *entry; - if (GTK_WIDGET_CLASS (parent_class)->realize) - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); + if (GTK_WIDGET_CLASS (e_entry_parent_class)->realize) + (* GTK_WIDGET_CLASS (e_entry_parent_class)->realize) (widget); entry = E_ENTRY (widget); @@ -1150,12 +1147,10 @@ e_entry_realize (GtkWidget *widget) } static void -e_entry_class_init (GObjectClass *object_class) +e_entry_class_init (EEntryClass *klass) { - EEntryClass *klass = E_ENTRY_CLASS(object_class); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(object_class); - - parent_class = g_type_class_ref (PARENT_TYPE); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->set_property = et_set_property; object_class->get_property = et_get_property; @@ -1343,4 +1338,4 @@ e_entry_class_init (GObjectClass *object_class) G_PARAM_READWRITE)); } -E_MAKE_TYPE(e_entry, "EEntry", EEntry, e_entry_class_init, e_entry_init, PARENT_TYPE) + diff --git a/widgets/text/e-table-text-model.c b/widgets/text/e-table-text-model.c index 7ecaa2f543..e0b8b6bae2 100644 --- a/widgets/text/e-table-text-model.c +++ b/widgets/text/e-table-text-model.c @@ -41,27 +41,8 @@ static void e_table_text_model_insert (ETextModel *model, gint postion, const gc static void e_table_text_model_insert_length (ETextModel *model, gint postion, const gchar *text, gint length); static void e_table_text_model_delete (ETextModel *model, gint postion, gint length); -#define PARENT_TYPE E_TYPE_TEXT_MODEL -static GtkObject *parent_class; - - - -/** - * e_table_text_model_get_type: - * @void: - * - * Registers the &ETableTextModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ETableTextModel class. - **/ -E_MAKE_TYPE (e_table_text_model, - "ETableTextModel", - ETableTextModel, - e_table_text_model_class_init, - e_table_text_model_init, - PARENT_TYPE) - +G_DEFINE_TYPE (ETableTextModel, e_table_text_model, E_TYPE_TEXT_MODEL) + /* Class initialization function for the text item */ static void e_table_text_model_class_init (ETableTextModelClass *klass) @@ -72,8 +53,6 @@ e_table_text_model_class_init (ETableTextModelClass *klass) object_class = (GObjectClass *) klass; model_class = (ETextModelClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - model_class->get_text = e_table_text_model_get_text; model_class->set_text = e_table_text_model_set_text; model_class->insert = e_table_text_model_insert; @@ -122,8 +101,8 @@ e_table_text_model_dispose (GObject *object) g_object_unref (model->model); model->model = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_table_text_model_parent_class)->dispose) + (* G_OBJECT_CLASS (e_table_text_model_parent_class)->dispose) (object); } static const gchar * e_table_text_model_get_text (ETextModel *text_model) diff --git a/widgets/text/e-text-model-uri.c b/widgets/text/e-text-model-uri.c index 95ce7cc076..9bf0af7805 100644 --- a/widgets/text/e-text-model-uri.c +++ b/widgets/text/e-text-model-uri.c @@ -51,15 +51,7 @@ struct _ObjInfo { gint offset, len; }; -#define PARENT_TYPE E_TYPE_TEXT_MODEL -static GtkObject *parent_class; - -E_MAKE_TYPE (e_text_model_uri, - "ETextModelURI", - ETextModelURI, - e_text_model_uri_class_init, - e_text_model_uri_init, - PARENT_TYPE) +G_DEFINE_TYPE (ETextModelURI, e_text_model_uri, E_TYPE_TEXT_MODEL) static void e_text_model_uri_class_init (ETextModelURIClass *klass) @@ -70,8 +62,6 @@ e_text_model_uri_class_init (ETextModelURIClass *klass) object_class = (GObjectClass *) klass; model_class = E_TEXT_MODEL_CLASS (klass); - parent_class = g_type_class_ref (PARENT_TYPE); - object_class->dispose = e_text_model_uri_dispose; model_class->object_activated = e_text_model_uri_activate_nth_object; @@ -105,8 +95,8 @@ e_text_model_uri_dispose (GObject *object) g_list_free (model_uri->uris); model_uri->uris = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_text_model_uri_parent_class)->dispose) + (* G_OBJECT_CLASS (e_text_model_uri_parent_class)->dispose) (object); } @@ -254,8 +244,8 @@ e_text_model_uri_objectify (ETextModel *model) if (model_uri->objectify_idle == 0) model_uri->objectify_idle = g_idle_add (objectify_idle_cb, model); - if (E_TEXT_MODEL_CLASS(parent_class)->objectify) - E_TEXT_MODEL_CLASS(parent_class)->objectify (model); + if (E_TEXT_MODEL_CLASS(e_text_model_uri_parent_class)->objectify) + E_TEXT_MODEL_CLASS(e_text_model_uri_parent_class)->objectify (model); } static void @@ -288,8 +278,8 @@ e_text_model_uri_validate_pos (ETextModel *model, gint pos) - if (E_TEXT_MODEL_CLASS (parent_class)->validate_pos) - pos = E_TEXT_MODEL_CLASS (parent_class)->validate_pos (model, pos); + if (E_TEXT_MODEL_CLASS (e_text_model_uri_parent_class)->validate_pos) + pos = E_TEXT_MODEL_CLASS (e_text_model_uri_parent_class)->validate_pos (model, pos); return pos; } diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index eb7b728c19..684dfea99a 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -61,26 +61,7 @@ static void e_text_model_real_insert (ETextModel *model, gint static void e_text_model_real_insert_length (ETextModel *model, gint postion, const gchar *text, gint length); static void e_text_model_real_delete (ETextModel *model, gint postion, gint length); -#define PARENT_TYPE G_TYPE_OBJECT -static GObject *parent_class; - - - -/** - * e_text_model_get_type: - * @void: - * - * Registers the &ETextModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ETextModel class. - **/ -E_MAKE_TYPE (e_text_model, - "ETextModel", - ETextModel, - e_text_model_class_init, - e_text_model_init, - PARENT_TYPE) +G_DEFINE_TYPE (ETextModel, e_text_model, G_TYPE_OBJECT) /* Class initialization function for the text item */ static void @@ -90,8 +71,6 @@ e_text_model_class_init (ETextModelClass *klass) object_class = (GObjectClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - e_text_model_signals[E_TEXT_MODEL_CHANGED] = g_signal_new ("changed", G_OBJECT_CLASS_TYPE (object_class), @@ -178,8 +157,8 @@ e_text_model_dispose (GObject *object) model->priv = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); + if (G_OBJECT_CLASS (e_text_model_parent_class)->dispose) + G_OBJECT_CLASS (e_text_model_parent_class)->dispose (object); } static gint diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index c523548765..932144a343 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -58,7 +58,7 @@ #include "e-text.h" -#define PARENT_TYPE (gnome_canvas_item_get_type()) +G_DEFINE_TYPE (EText, e_text, GNOME_TYPE_CANVAS_ITEM) #define BORDER_INDENT 3 #define d(x) @@ -168,7 +168,6 @@ static gboolean e_text_delete_surrounding_cb (GtkIMContext *context, gint n_chars, EText *text); -static GnomeCanvasItemClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; @@ -277,8 +276,8 @@ e_text_dispose (GObject *object) text->font_desc = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (G_OBJECT_CLASS (e_text_parent_class)->dispose) + (* G_OBJECT_CLASS (e_text_parent_class)->dispose) (object); } static void @@ -1199,8 +1198,8 @@ e_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int fla text = E_TEXT (item); - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->update) + (* GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->update) (item, affine, clip_path, flags); if ( text->needs_recalc_bounds || (flags & GNOME_CANVAS_UPDATE_AFFINE)) { @@ -1239,8 +1238,8 @@ e_text_realize (GnomeCanvasItem *item) text = E_TEXT (item); - if (parent_class->realize) - (* parent_class->realize) (item); + if (GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->realize) + (* GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->realize) (item); create_layout (text); @@ -1273,8 +1272,8 @@ e_text_unrealize (GnomeCanvasItem *item) gdk_cursor_unref (text->default_cursor); text->default_cursor = NULL; - if (parent_class->unrealize) - (* parent_class->unrealize) (item); + if (GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->unrealize) + (* GNOME_CANVAS_ITEM_CLASS (e_text_parent_class)->unrealize) (item); } static void @@ -2486,8 +2485,8 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) } if (return_val) return return_val; - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); + if (GNOME_CANVAS_ITEM_CLASS(e_text_parent_class)->event) + return GNOME_CANVAS_ITEM_CLASS(e_text_parent_class)->event(item, event); else return 0; } @@ -3415,8 +3414,6 @@ e_text_class_init (ETextClass *klass) gobject_class = (GObjectClass *) klass; item_class = (GnomeCanvasItemClass *) klass; - parent_class = g_type_class_ref (PARENT_TYPE); - gobject_class->dispose = e_text_dispose; gobject_class->set_property = e_text_set_property; gobject_class->get_property = e_text_get_property; @@ -3808,23 +3805,6 @@ e_text_init (EText *text) e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow); } -/** - * e_text_get_type: - * @void: - * - * Registers the &EText class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &EText class. - **/ -E_MAKE_TYPE (e_text, - "EText", - EText, - e_text_class_init, - e_text_init, - PARENT_TYPE) - - /* IM Context Callbacks */ static void |