diff --git a/ChangeLog b/ChangeLog index 2d587dc160..8e0fc05c63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-12-19 Michael Natterer + + * app/widgets/*.c: port to G_DEFINE_TYPE() and friends. Some + related cleanup. + 2005-12-19 Sven Neumann * plug-ins/common/svg.c: fixed handling of librsvg API change, diff --git a/app/widgets/gimpaction.c b/app/widgets/gimpaction.c index 4bf9e86b31..02ce72d618 100644 --- a/app/widgets/gimpaction.c +++ b/app/widgets/gimpaction.c @@ -47,54 +47,25 @@ enum }; -static void gimp_action_init (GimpAction *action); -static void gimp_action_class_init (GimpActionClass *klass); - -static void gimp_action_finalize (GObject *object); -static void gimp_action_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_action_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void gimp_action_connect_proxy (GtkAction *action, - GtkWidget *proxy); -static void gimp_action_set_proxy (GimpAction *action, - GtkWidget *proxy); +static void gimp_action_finalize (GObject *object); +static void gimp_action_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_action_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gimp_action_connect_proxy (GtkAction *action, + GtkWidget *proxy); +static void gimp_action_set_proxy (GimpAction *action, + GtkWidget *proxy); -static GtkActionClass *parent_class = NULL; +G_DEFINE_TYPE (GimpAction, gimp_action, GTK_TYPE_ACTION); +#define parent_class gimp_action_parent_class -GType -gimp_action_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (GimpActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (GimpAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_action_init, - }; - - type = g_type_register_static (GTK_TYPE_ACTION, - "GimpAction", - &type_info, 0); - } - - return type; -} static void gimp_action_class_init (GimpActionClass *klass) @@ -103,8 +74,6 @@ gimp_action_class_init (GimpActionClass *klass) GtkActionClass *action_class = GTK_ACTION_CLASS (klass); GimpRGB black; - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_action_finalize; object_class->set_property = gimp_action_set_property; object_class->get_property = gimp_action_get_property; diff --git a/app/widgets/gimpactionfactory.c b/app/widgets/gimpactionfactory.c index 15ddd00f25..585203d25e 100644 --- a/app/widgets/gimpactionfactory.c +++ b/app/widgets/gimpactionfactory.c @@ -35,50 +35,19 @@ #include "gimpactiongroup.h" -static void gimp_action_factory_class_init (GimpActionFactoryClass *klass); -static void gimp_action_factory_init (GimpActionFactory *factory); - -static void gimp_action_factory_finalize (GObject *object); +static void gimp_action_factory_finalize (GObject *object); -static GimpObjectClass *parent_class = NULL; +G_DEFINE_TYPE (GimpActionFactory, gimp_action_factory, GIMP_TYPE_OBJECT); +#define parent_class gimp_action_factory_parent_class -GType -gimp_action_factory_get_type (void) -{ - static GType factory_type = 0; - - if (! factory_type) - { - static const GTypeInfo factory_info = - { - sizeof (GimpActionFactoryClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_action_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpActionFactory), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_action_factory_init, - }; - - factory_type = g_type_register_static (GIMP_TYPE_OBJECT, - "GimpActionFactory", - &factory_info, 0); - } - - return factory_type; -} static void gimp_action_factory_class_init (GimpActionFactoryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_action_factory_finalize; } diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c index 6cb593ab73..c71183dd99 100644 --- a/app/widgets/gimpactiongroup.c +++ b/app/widgets/gimpactiongroup.c @@ -50,9 +50,6 @@ enum }; -static void gimp_action_group_init (GimpActionGroup *group); -static void gimp_action_group_class_init (GimpActionGroupClass *klass); - static GObject * gimp_action_group_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -68,44 +65,16 @@ static void gimp_action_group_get_property (GObject *object, GParamSpec *pspec); -static GtkActionGroupClass *parent_class = NULL; +G_DEFINE_TYPE (GimpActionGroup, gimp_action_group, GTK_TYPE_ACTION_GROUP); +#define parent_class gimp_action_group_parent_class -GType -gimp_action_group_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (GimpActionGroupClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_action_group_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpActionGroup), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_action_group_init, - }; - - type = g_type_register_static (GTK_TYPE_ACTION_GROUP, - "GimpActionGroup", - &type_info, 0); - } - - return type; -} static void gimp_action_group_class_init (GimpActionGroupClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_action_group_constructor; object_class->dispose = gimp_action_group_dispose; object_class->finalize = gimp_action_group_finalize; diff --git a/app/widgets/gimpactionview.c b/app/widgets/gimpactionview.c index ffacb03291..597d543ed0 100644 --- a/app/widgets/gimpactionview.c +++ b/app/widgets/gimpactionview.c @@ -44,9 +44,6 @@ /* local function prototypes */ -static void gimp_action_view_class_init (GimpActionViewClass *klass); -static void gimp_action_view_init (GimpActionView *view); - static void gimp_action_view_dispose (GObject *object); static gboolean gimp_action_view_accel_find_func (GtkAccelKey *key, @@ -65,44 +62,16 @@ static void gimp_action_view_accel_edited (GimpCellRendererAccel *accel, GimpActionView *view); -static GtkTreeViewClass *parent_class = NULL; +G_DEFINE_TYPE (GimpActionView, gimp_action_view, GTK_TYPE_TREE_VIEW); +#define parent_class gimp_action_view_parent_class -GType -gimp_action_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpActionViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_action_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpActionView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_action_view_init - }; - - view_type = g_type_register_static (GTK_TYPE_TREE_VIEW, - "GimpActionView", - &view_info, 0); - } - - return view_type; -} static void gimp_action_view_class_init (GimpActionViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = gimp_action_view_dispose; } diff --git a/app/widgets/gimpblobeditor.c b/app/widgets/gimpblobeditor.c index 45ee9cf240..6d57f7923b 100644 --- a/app/widgets/gimpblobeditor.c +++ b/app/widgets/gimpblobeditor.c @@ -35,9 +35,7 @@ enum PROP_ANGLE }; -static void gimp_blob_editor_class_init (GimpBlobEditorClass *klass); -static void gimp_blob_editor_init (GimpBlobEditor *editor); static void gimp_blob_editor_set_property (GObject *object, guint property_id, const GValue *value, @@ -64,36 +62,10 @@ static void gimp_blob_editor_draw_blob (GimpBlobEditor *editor, gdouble radius); -static GtkDrawingAreaClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBlobEditor, gimp_blob_editor, GTK_TYPE_DRAWING_AREA); +#define parent_class gimp_blob_editor_parent_class -GType -gimp_blob_editor_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpBlobEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_blob_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBlobEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_blob_editor_init - }; - - view_type = g_type_register_static (GTK_TYPE_DRAWING_AREA, - "GimpBlobEditor", - &view_info, 0); - } - - return view_type; -} static void gimp_blob_editor_class_init (GimpBlobEditorClass *klass) @@ -101,10 +73,13 @@ gimp_blob_editor_class_init (GimpBlobEditorClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); + object_class->set_property = gimp_blob_editor_set_property; + object_class->get_property = gimp_blob_editor_get_property; - object_class->set_property = gimp_blob_editor_set_property; - object_class->get_property = gimp_blob_editor_get_property; + widget_class->expose_event = gimp_blob_editor_expose; + widget_class->button_press_event = gimp_blob_editor_button_press; + widget_class->button_release_event = gimp_blob_editor_button_release; + widget_class->motion_notify_event = gimp_blob_editor_motion_notify; g_object_class_install_property (object_class, PROP_TYPE, g_param_spec_enum ("blob-type", @@ -125,11 +100,6 @@ gimp_blob_editor_class_init (GimpBlobEditorClass *klass) -90.0, 90.0, 0.0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - - widget_class->expose_event = gimp_blob_editor_expose; - widget_class->button_press_event = gimp_blob_editor_button_press; - widget_class->button_release_event = gimp_blob_editor_button_release; - widget_class->motion_notify_event = gimp_blob_editor_motion_notify; } static void diff --git a/app/widgets/gimpbrusheditor.c b/app/widgets/gimpbrusheditor.c index 2b86db2b97..c7486fc964 100644 --- a/app/widgets/gimpbrusheditor.c +++ b/app/widgets/gimpbrusheditor.c @@ -45,59 +45,28 @@ /* local function prototypes */ -static void gimp_brush_editor_class_init (GimpBrushEditorClass *klass); -static void gimp_brush_editor_init (GimpBrushEditor *editor); +static void gimp_brush_editor_set_data (GimpDataEditor *editor, + GimpData *data); -static void gimp_brush_editor_set_data (GimpDataEditor *editor, - GimpData *data); - -static void gimp_brush_editor_update_brush (GtkAdjustment *adjustment, - GimpBrushEditor *editor); -static void gimp_brush_editor_update_brush_shape (GtkWidget *widget, - GimpBrushEditor *editor); -static void gimp_brush_editor_notify_brush (GimpBrushGenerated *brush, - GParamSpec *pspec, - GimpBrushEditor *editor); +static void gimp_brush_editor_update_brush (GtkAdjustment *adjustment, + GimpBrushEditor *editor); +static void gimp_brush_editor_update_shape (GtkWidget *widget, + GimpBrushEditor *editor); +static void gimp_brush_editor_notify_brush (GimpBrushGenerated *brush, + GParamSpec *pspec, + GimpBrushEditor *editor); -static GimpDataEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBrushEditor, gimp_brush_editor, GIMP_TYPE_DATA_EDITOR); +#define parent_class gimp_brush_editor_parent_class -GType -gimp_brush_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpBrushEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_brush_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBrushEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_brush_editor_init, - }; - - type = g_type_register_static (GIMP_TYPE_DATA_EDITOR, - "GimpBrushEditor", - &info, 0); - } - - return type; -} static void gimp_brush_editor_class_init (GimpBrushEditorClass *klass) { GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->set_data = gimp_brush_editor_set_data; editor_class->title = _("Brush Editor"); } @@ -105,7 +74,8 @@ gimp_brush_editor_class_init (GimpBrushEditorClass *klass) static void gimp_brush_editor_init (GimpBrushEditor *editor) { - GtkWidget *frame, *box; + GtkWidget *frame; + GtkWidget *box; gint row = 0; frame = gtk_frame_new (NULL); @@ -137,7 +107,7 @@ gimp_brush_editor_init (GimpBrushEditor *editor) box = gimp_enum_stock_box_new (GIMP_TYPE_BRUSH_GENERATED_SHAPE, "gimp-shape", GTK_ICON_SIZE_MENU, - G_CALLBACK (gimp_brush_editor_update_brush_shape), + G_CALLBACK (gimp_brush_editor_update_shape), editor, &editor->shape_group); gimp_table_attach_aligned (GTK_TABLE (editor->options_table), @@ -362,8 +332,8 @@ gimp_brush_editor_update_brush (GtkAdjustment *adjustment, } static void -gimp_brush_editor_update_brush_shape (GtkWidget *widget, - GimpBrushEditor *editor) +gimp_brush_editor_update_shape (GtkWidget *widget, + GimpBrushEditor *editor) { GimpBrushGenerated *brush; @@ -395,14 +365,14 @@ gimp_brush_editor_notify_brush (GimpBrushGenerated *brush, if (! strcmp (pspec->name, "shape")) { g_signal_handlers_block_by_func (editor->shape_group, - G_CALLBACK (gimp_brush_editor_update_brush_shape), + gimp_brush_editor_update_shape, editor); gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (editor->shape_group), brush->shape); g_signal_handlers_unblock_by_func (editor->shape_group, - G_CALLBACK (gimp_brush_editor_update_brush_shape), + gimp_brush_editor_update_shape, editor); adj = editor->radius_data; diff --git a/app/widgets/gimpbrushfactoryview.c b/app/widgets/gimpbrushfactoryview.c index 6e264e4bba..ec0a4e1873 100644 --- a/app/widgets/gimpbrushfactoryview.c +++ b/app/widgets/gimpbrushfactoryview.c @@ -40,9 +40,7 @@ #include "gimp-intl.h" -static void gimp_brush_factory_view_class_init (GimpBrushFactoryViewClass *klass); -static void gimp_brush_factory_view_init (GimpBrushFactoryView *view); -static void gimp_brush_factory_view_destroy (GtkObject *object); +static void gimp_brush_factory_view_destroy (GtkObject *object); static void gimp_brush_factory_view_select_item (GimpContainerEditor *editor, GimpViewable *viewable); @@ -53,47 +51,17 @@ static void gimp_brush_factory_view_spacing_update (GtkAdjustment *adj GimpBrushFactoryView *view); -static GimpDataFactoryViewClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBrushFactoryView, gimp_brush_factory_view, + GIMP_TYPE_DATA_FACTORY_VIEW); +#define parent_class gimp_brush_factory_view_parent_class -GType -gimp_brush_factory_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpBrushFactoryViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_brush_factory_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBrushFactoryView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_brush_factory_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_DATA_FACTORY_VIEW, - "GimpBrushFactoryView", - &view_info, 0); - } - - return view_type; -} static void gimp_brush_factory_view_class_init (GimpBrushFactoryViewClass *klass) { - GtkObjectClass *object_class; - GimpContainerEditorClass *editor_class; - - object_class = GTK_OBJECT_CLASS (klass); - editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); + GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); object_class->destroy = gimp_brush_factory_view_destroy; diff --git a/app/widgets/gimpbrushselect.c b/app/widgets/gimpbrushselect.c index f450ee9621..f878e13a4a 100644 --- a/app/widgets/gimpbrushselect.c +++ b/app/widgets/gimpbrushselect.c @@ -52,8 +52,6 @@ enum }; -static void gimp_brush_select_class_init (GimpBrushSelectClass *klass); - static GObject * gimp_brush_select_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -82,36 +80,10 @@ static void gimp_brush_select_spacing_update (GtkAdjustment *adj, GimpBrushSelect *select); -static GimpPdbDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBrushSelect, gimp_brush_select, GIMP_TYPE_PDB_DIALOG); +#define parent_class gimp_brush_select_parent_class -GType -gimp_brush_select_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpBrushSelectClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_brush_select_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBrushSelect), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - dialog_type = g_type_register_static (GIMP_TYPE_PDB_DIALOG, - "GimpBrushSelect", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_brush_select_class_init (GimpBrushSelectClass *klass) @@ -119,8 +91,6 @@ gimp_brush_select_class_init (GimpBrushSelectClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpPdbDialogClass *pdb_class = GIMP_PDB_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_brush_select_constructor; object_class->set_property = gimp_brush_select_set_property; @@ -148,6 +118,11 @@ gimp_brush_select_class_init (GimpBrushSelectClass *klass) G_PARAM_CONSTRUCT)); } +static void +gimp_brush_select_init (GimpBrushSelect *select) +{ +} + static GObject * gimp_brush_select_constructor (GType type, guint n_params, diff --git a/app/widgets/gimpbufferview.c b/app/widgets/gimpbufferview.c index 2c9b4ec7cf..514771faff 100644 --- a/app/widgets/gimpbufferview.c +++ b/app/widgets/gimpbufferview.c @@ -45,9 +45,6 @@ #include "gimp-intl.h" -static void gimp_buffer_view_class_init (GimpBufferViewClass *klass); -static void gimp_buffer_view_init (GimpBufferView *view); - static void gimp_buffer_view_activate_item (GimpContainerEditor *editor, GimpViewable *viewable); @@ -58,44 +55,16 @@ static void gimp_buffer_view_preview_notify (GimpContainerView *view, GimpBufferView *buffer_view); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBufferView, gimp_buffer_view, GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_buffer_view_parent_class -GType -gimp_buffer_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpBufferViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_buffer_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBufferView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_buffer_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpBufferView", - &view_info, 0); - } - - return view_type; -} static void gimp_buffer_view_class_init (GimpBufferViewClass *klass) { GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->activate_item = gimp_buffer_view_activate_item; } diff --git a/app/widgets/gimpcellrendereraccel.c b/app/widgets/gimpcellrendereraccel.c index 05e5519f33..b4f1968d3d 100644 --- a/app/widgets/gimpcellrendereraccel.c +++ b/app/widgets/gimpcellrendereraccel.c @@ -54,10 +54,6 @@ enum #define GIMP_CELL_RENDERER_ACCEL_PATH "gimp-cell-renderer-accel-path" -static void gimp_cell_renderer_accel_init (GimpCellRendererAccel *cell); -static void gimp_cell_renderer_accel_class_init (GimpCellRendererAccelClass *klass); - -static void gimp_cell_renderer_accel_finalize (GObject *object); static void gimp_cell_renderer_accel_set_property (GObject *object, guint param_id, const GValue *value, @@ -84,43 +80,13 @@ static GtkCellEditable * GtkCellRendererState flags); +G_DEFINE_TYPE (GimpCellRendererAccel, gimp_cell_renderer_accel, + GTK_TYPE_CELL_RENDERER_TEXT); + +#define parent_class gimp_cell_renderer_accel_parent_class + static guint accel_cell_signals[LAST_SIGNAL] = { 0 }; -static GtkCellRendererTextClass *parent_class = NULL; - - -GType -gimp_cell_renderer_accel_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpCellRendererAccelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_cell_renderer_accel_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCellRendererAccel), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_cell_renderer_accel_init - }; - - type = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT, - "GimpCellRendererAccel", - &info, 0); - } - - return type; -} - -static void -gimp_cell_renderer_accel_init (GimpCellRendererAccel *cell) -{ -} static void gimp_cell_renderer_accel_class_init (GimpCellRendererAccelClass *klass) @@ -128,8 +94,6 @@ gimp_cell_renderer_accel_class_init (GimpCellRendererAccelClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (object_class); - accel_cell_signals[ACCEL_EDITED] = g_signal_new ("accel-edited", G_OBJECT_CLASS_TYPE (object_class), @@ -143,7 +107,6 @@ gimp_cell_renderer_accel_class_init (GimpCellRendererAccelClass *klass) G_TYPE_UINT, GDK_TYPE_MODIFIER_TYPE); - object_class->finalize = gimp_cell_renderer_accel_finalize; object_class->set_property = gimp_cell_renderer_accel_set_property; object_class->get_property = gimp_cell_renderer_accel_get_property; @@ -165,9 +128,8 @@ gimp_cell_renderer_accel_class_init (GimpCellRendererAccelClass *klass) } static void -gimp_cell_renderer_accel_finalize (GObject *object) +gimp_cell_renderer_accel_init (GimpCellRendererAccel *cell) { - G_OBJECT_CLASS (parent_class)->finalize (object); } static void diff --git a/app/widgets/gimpcellrendererdashes.c b/app/widgets/gimpcellrendererdashes.c index 74975e9232..c01d6b8436 100644 --- a/app/widgets/gimpcellrendererdashes.c +++ b/app/widgets/gimpcellrendererdashes.c @@ -44,9 +44,6 @@ enum }; -static void gimp_cell_renderer_dashes_class_init (GimpCellRendererDashesClass *klass); -static void gimp_cell_renderer_dashes_init (GimpCellRendererDashes *cell); - static void gimp_cell_renderer_dashes_finalize (GObject *object); static void gimp_cell_renderer_dashes_get_property (GObject *object, guint param_id, @@ -72,36 +69,11 @@ static void gimp_cell_renderer_dashes_render (GtkCellRenderer *cell, GtkCellRendererState flags); -static GtkCellRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpCellRendererDashes, gimp_cell_renderer_dashes, + GTK_TYPE_CELL_RENDERER); +#define parent_class gimp_cell_renderer_dashes_parent_class -GType -gimp_cell_renderer_dashes_get_type (void) -{ - static GType cell_type = 0; - - if (! cell_type) - { - static const GTypeInfo cell_info = - { - sizeof (GimpCellRendererDashesClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_cell_renderer_dashes_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCellRendererDashes), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_cell_renderer_dashes_init, - }; - - cell_type = g_type_register_static (GTK_TYPE_CELL_RENDERER, - "GimpCellRendererDashes", - &cell_info, 0); - } - - return cell_type; -} static void gimp_cell_renderer_dashes_class_init (GimpCellRendererDashesClass *klass) @@ -109,8 +81,6 @@ gimp_cell_renderer_dashes_class_init (GimpCellRendererDashesClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_cell_renderer_dashes_finalize; object_class->get_property = gimp_cell_renderer_dashes_get_property; object_class->set_property = gimp_cell_renderer_dashes_set_property; diff --git a/app/widgets/gimpcellrendererviewable.c b/app/widgets/gimpcellrendererviewable.c index 536278c7e7..ddbe05e9dc 100644 --- a/app/widgets/gimpcellrendererviewable.c +++ b/app/widgets/gimpcellrendererviewable.c @@ -46,9 +46,6 @@ enum }; -static void gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass); -static void gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cell); - static void gimp_cell_renderer_viewable_finalize (GObject *object); static void gimp_cell_renderer_viewable_get_property (GObject *object, guint param_id, @@ -81,38 +78,13 @@ static gboolean gimp_cell_renderer_viewable_activate (GtkCellRenderer *cell, GtkCellRendererState flags); +G_DEFINE_TYPE (GimpCellRendererViewable, gimp_cell_renderer_viewable, + GTK_TYPE_CELL_RENDERER); + +#define parent_class gimp_cell_renderer_viewable_parent_class + static guint viewable_cell_signals[LAST_SIGNAL] = { 0 }; -static GtkCellRendererClass *parent_class = NULL; - - -GType -gimp_cell_renderer_viewable_get_type (void) -{ - static GType cell_type = 0; - - if (! cell_type) - { - static const GTypeInfo cell_info = - { - sizeof (GimpCellRendererViewableClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_cell_renderer_viewable_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCellRendererViewable), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_cell_renderer_viewable_init, - }; - - cell_type = g_type_register_static (GTK_TYPE_CELL_RENDERER, - "GimpCellRendererViewable", - &cell_info, 0); - } - - return cell_type; -} static void gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass) @@ -120,8 +92,6 @@ gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - viewable_cell_signals[CLICKED] = g_signal_new ("clicked", G_OBJECT_CLASS_TYPE (object_class), diff --git a/app/widgets/gimpchanneltreeview.c b/app/widgets/gimpchanneltreeview.c index 91f72db588..384eecb799 100644 --- a/app/widgets/gimpchanneltreeview.c +++ b/app/widgets/gimpchanneltreeview.c @@ -47,11 +47,8 @@ #include "gimp-intl.h" -static void gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass); -static void gimp_channel_tree_view_init (GimpChannelTreeView *view); - -static void gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *view_iface); -static void gimp_channel_tree_view_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_channel_tree_view_docked_iface_init (GimpDockedInterface *iface); static GObject * gimp_channel_tree_view_constructor (GType type, guint n_params, @@ -75,100 +72,56 @@ static void gimp_channel_tree_view_set_context (GimpDocked *docked GimpContext *context); -static GimpDrawableTreeViewClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpChannelTreeView, gimp_channel_tree_view, + GIMP_TYPE_DRAWABLE_TREE_VIEW, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_channel_tree_view_view_iface_init) + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_channel_tree_view_docked_iface_init)); + +#define parent_class gimp_channel_tree_view_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; static GimpDockedInterface *parent_docked_iface = NULL; -GType -gimp_channel_tree_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpChannelTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_channel_tree_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpChannelTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_channel_tree_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_channel_tree_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_channel_tree_view_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GIMP_TYPE_DRAWABLE_TREE_VIEW, - "GimpChannelTreeView", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - g_type_add_interface_static (view_type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return view_type; -} - static void gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass) { - GObjectClass *object_class; - GimpContainerTreeViewClass *view_class; - GimpItemTreeViewClass *item_view_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpContainerTreeViewClass *view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); + GimpItemTreeViewClass *iv_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); - item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); + object_class->constructor = gimp_channel_tree_view_constructor; - parent_class = g_type_class_peek_parent (klass); + view_class->drop_viewable = gimp_channel_tree_view_drop_viewable; + view_class->drop_component = gimp_channel_tree_view_drop_component; - object_class->constructor = gimp_channel_tree_view_constructor; + iv_class->set_image = gimp_channel_tree_view_set_image; - view_class->drop_viewable = gimp_channel_tree_view_drop_viewable; - view_class->drop_component = gimp_channel_tree_view_drop_component; + iv_class->item_type = GIMP_TYPE_CHANNEL; + iv_class->signal_name = "active-channel-changed"; - item_view_class->set_image = gimp_channel_tree_view_set_image; + iv_class->get_container = gimp_image_get_channels; + iv_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_channel; + iv_class->set_active_item = (GimpSetItemFunc) gimp_image_set_active_channel; + iv_class->reorder_item = (GimpReorderItemFunc) gimp_image_position_channel; + iv_class->add_item = (GimpAddItemFunc) gimp_image_add_channel; + iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_channel; + iv_class->new_item = gimp_channel_tree_view_item_new; - item_view_class->item_type = GIMP_TYPE_CHANNEL; - item_view_class->signal_name = "active-channel-changed"; - - item_view_class->get_container = gimp_image_get_channels; - item_view_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_channel; - item_view_class->set_active_item = (GimpSetItemFunc) gimp_image_set_active_channel; - item_view_class->reorder_item = (GimpReorderItemFunc) gimp_image_position_channel; - item_view_class->add_item = (GimpAddItemFunc) gimp_image_add_channel; - item_view_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_channel; - item_view_class->new_item = gimp_channel_tree_view_item_new; - - item_view_class->action_group = "channels"; - item_view_class->activate_action = "channels-edit-attributes"; - item_view_class->edit_action = "channels-edit-attributes"; - item_view_class->new_action = "channels-new"; - item_view_class->new_default_action = "channels-new-last-values"; - item_view_class->raise_action = "channels-raise"; - item_view_class->raise_top_action = "channels-raise-to-top"; - item_view_class->lower_action = "channels-lower"; - item_view_class->lower_bottom_action = "channels-lower-to-bottom"; - item_view_class->duplicate_action = "channels-duplicate"; - item_view_class->delete_action = "channels-delete"; - item_view_class->reorder_desc = _("Reorder Channel"); + iv_class->action_group = "channels"; + iv_class->activate_action = "channels-edit-attributes"; + iv_class->edit_action = "channels-edit-attributes"; + iv_class->new_action = "channels-new"; + iv_class->new_default_action = "channels-new-last-values"; + iv_class->raise_action = "channels-raise"; + iv_class->raise_top_action = "channels-raise-to-top"; + iv_class->lower_action = "channels-lower"; + iv_class->lower_bottom_action = "channels-lower-to-bottom"; + iv_class->duplicate_action = "channels-duplicate"; + iv_class->delete_action = "channels-delete"; + iv_class->reorder_desc = _("Reorder Channel"); } static void diff --git a/app/widgets/gimpcolorbar.c b/app/widgets/gimpcolorbar.c index a5470f1ddb..fd308c08c5 100644 --- a/app/widgets/gimpcolorbar.c +++ b/app/widgets/gimpcolorbar.c @@ -41,43 +41,19 @@ enum /* local function prototypes */ -static void gimp_color_bar_class_init (GimpColorBarClass *klass); -static void gimp_color_bar_init (GimpColorBar *bar); -static void gimp_color_bar_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); +static void gimp_color_bar_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); -static gboolean gimp_color_bar_expose (GtkWidget *widget, - GdkEventExpose *event); +static gboolean gimp_color_bar_expose (GtkWidget *widget, + GdkEventExpose *event); -GType -gimp_color_bar_get_type (void) -{ - static GType type = 0; +G_DEFINE_TYPE (GimpColorBar, gimp_color_bar, GTK_TYPE_MISC); - if (! type) - { - static const GTypeInfo bar_info = - { - sizeof (GimpColorBarClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_color_bar_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorBar), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_bar_init, - }; +#define parent_class gimp_color_bar_parent_class - type = g_type_register_static (GTK_TYPE_MISC, - "GimpColorBar", &bar_info, 0); - } - - return type; -} static void gimp_color_bar_class_init (GimpColorBarClass *klass) diff --git a/app/widgets/gimpcolordialog.c b/app/widgets/gimpcolordialog.c index 8923a76895..7b8eb45841 100644 --- a/app/widgets/gimpcolordialog.c +++ b/app/widgets/gimpcolordialog.c @@ -48,10 +48,8 @@ enum }; -static void gimp_color_dialog_class_init (GimpColorDialogClass *klass); -static void gimp_color_dialog_init (GimpColorDialog *dialog); - static void gimp_color_dialog_dispose (GObject *object); + static void gimp_color_dialog_response (GtkDialog *dialog, gint response_id); @@ -68,49 +66,21 @@ static void gimp_color_history_add_clicked (GtkWidget *widget, GimpColorDialog *dialog); -static GimpViewableDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorDialog, gimp_color_dialog, GIMP_TYPE_VIEWABLE_DIALOG); + +#define parent_class gimp_color_dialog_parent_class static guint color_dialog_signals[LAST_SIGNAL] = { 0, }; static GList *color_dialogs = NULL; -GType -gimp_color_dialog_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpColorDialogClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_color_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_dialog_init, - }; - - dialog_type = g_type_register_static (GIMP_TYPE_VIEWABLE_DIALOG, - "GimpColorDialog", - &dialog_info, 0); - } - - return dialog_type; -} - static void gimp_color_dialog_class_init (GimpColorDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = gimp_color_dialog_dispose; dialog_class->response = gimp_color_dialog_response; diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c index dea2478dda..c68109ce51 100644 --- a/app/widgets/gimpcolordisplayeditor.c +++ b/app/widgets/gimpcolordisplayeditor.c @@ -53,10 +53,7 @@ enum }; -static void gimp_color_display_editor_class_init (GimpColorDisplayEditorClass *klass); -static void gimp_color_display_editor_init (GimpColorDisplayEditor *editor); - -static void gimp_color_display_editor_destroy (GtkObject *object); +static void gimp_color_display_editor_destroy (GtkObject *object); static void gimp_color_display_editor_add_clicked (GtkWidget *widget, GimpColorDisplayEditor *editor); @@ -96,44 +93,17 @@ static void gimp_color_display_editor_enable_toggled (GtkCellRendererToggle * static void gimp_color_display_editor_update_buttons (GimpColorDisplayEditor *editor); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorDisplayEditor, gimp_color_display_editor, + GTK_TYPE_VBOX); +#define parent_class gimp_color_display_editor_parent_class -GType -gimp_color_display_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpColorDisplayEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_color_display_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_tool */ - sizeof (GimpColorDisplayEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_display_editor_init, - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "GimpColorDisplayEditor", - &editor_info, 0); - } - - return type; -} static void gimp_color_display_editor_class_init (GimpColorDisplayEditorClass *klass) { GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->destroy = gimp_color_display_editor_destroy; } diff --git a/app/widgets/gimpcoloreditor.c b/app/widgets/gimpcoloreditor.c index 6744aad26c..ae8d8031e7 100644 --- a/app/widgets/gimpcoloreditor.c +++ b/app/widgets/gimpcoloreditor.c @@ -49,9 +49,7 @@ enum }; -static void gimp_color_editor_class_init (GimpColorEditorClass *klass); -static void gimp_color_editor_init (GimpColorEditor *editor); -static void gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_color_editor_docked_iface_init (GimpDockedInterface *iface); static void gimp_color_editor_set_property (GObject *object, guint property_id, @@ -95,47 +93,15 @@ static void gimp_color_editor_entry_changed (GimpColorHexEntry *entry, GimpColorEditor *editor); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpColorEditor, gimp_color_editor, GIMP_TYPE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_color_editor_docked_iface_init)); + +#define parent_class gimp_color_editor_parent_class + static GimpDockedInterface *parent_docked_iface = NULL; -GType -gimp_color_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpColorEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_color_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_color_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpColorEditor", - &editor_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} - static void gimp_color_editor_class_init (GimpColorEditorClass* klass) { @@ -143,8 +109,6 @@ gimp_color_editor_class_init (GimpColorEditorClass* klass) GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_color_editor_set_property; object_class->get_property = gimp_color_editor_get_property; @@ -157,7 +121,6 @@ gimp_color_editor_class_init (GimpColorEditorClass* klass) NULL, NULL, GIMP_TYPE_CONTEXT, G_PARAM_READWRITE)); - } static void @@ -323,6 +286,7 @@ gimp_color_editor_get_property (GObject *object, break; } } + static void gimp_color_editor_destroy (GtkObject *object) { @@ -353,17 +317,17 @@ gimp_color_editor_get_preview (GimpDocked *docked, } static void -gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_color_editor_docked_iface_init (GimpDockedInterface *iface) { - parent_docked_iface = g_type_interface_peek_parent (docked_iface); + parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); - docked_iface->get_preview = gimp_color_editor_get_preview; - docked_iface->set_aux_info = gimp_color_editor_set_aux_info; - docked_iface->get_aux_info = gimp_color_editor_get_aux_info; - docked_iface->set_context = gimp_color_editor_set_context; + iface->get_preview = gimp_color_editor_get_preview; + iface->set_aux_info = gimp_color_editor_set_aux_info; + iface->get_aux_info = gimp_color_editor_get_aux_info; + iface->set_context = gimp_color_editor_set_context; } #define AUX_INFO_CURRENT_PAGE "current-page" diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c index 63cda1106d..d91a13eaba 100644 --- a/app/widgets/gimpcolorframe.c +++ b/app/widgets/gimpcolorframe.c @@ -44,60 +44,29 @@ enum /* local function prototypes */ -static void gimp_color_frame_class_init (GimpColorFrameClass *klass); -static void gimp_color_frame_init (GimpColorFrame *frame); - -static void gimp_color_frame_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); -static void gimp_color_frame_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_color_frame_menu_callback (GtkWidget *widget, - GimpColorFrame *frame); -static void gimp_color_frame_update (GimpColorFrame *frame); +static void gimp_color_frame_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); +static void gimp_color_frame_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_color_frame_menu_callback (GtkWidget *widget, + GimpColorFrame *frame); +static void gimp_color_frame_update (GimpColorFrame *frame); -static GimpFrameClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorFrame, gimp_color_frame, GIMP_TYPE_FRAME); +#define parent_class gimp_color_frame_parent_class -GType -gimp_color_frame_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo frame_info = - { - sizeof (GimpColorFrameClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_color_frame_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorFrame), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_frame_init, - }; - - type = g_type_register_static (GIMP_TYPE_FRAME, - "GimpColorFrame", - &frame_info, 0); - } - - return type; -} static void gimp_color_frame_class_init (GimpColorFrameClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->get_property = gimp_color_frame_get_property; object_class->set_property = gimp_color_frame_set_property; diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c index f7c1e1d7e5..280edff3fd 100644 --- a/app/widgets/gimpcolormapeditor.c +++ b/app/widgets/gimpcolormapeditor.c @@ -74,9 +74,6 @@ enum gimp_image_get_colormap (gimage) != NULL) -static void gimp_colormap_editor_class_init (GimpColormapEditorClass *klass); -static void gimp_colormap_editor_init (GimpColormapEditor *colormap_editor); - static GObject * gimp_colormap_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -124,38 +121,13 @@ static void gimp_colormap_image_colormap_changed (GimpImage *gimage, GimpColormapEditor *editor); +G_DEFINE_TYPE (GimpColormapEditor, gimp_colormap_editor, + GIMP_TYPE_IMAGE_EDITOR); + +#define parent_class gimp_colormap_editor_parent_class + static guint editor_signals[LAST_SIGNAL] = { 0 }; -static GimpImageEditorClass *parent_class = NULL; - - -GType -gimp_colormap_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpColormapEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_colormap_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColormapEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_colormap_editor_init, - }; - - type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR, - "GimpColormapEditor", - &info, 0); - } - - return type; -} static void gimp_colormap_editor_class_init (GimpColormapEditorClass* klass) @@ -165,8 +137,6 @@ gimp_colormap_editor_class_init (GimpColormapEditorClass* klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_signals[SELECTED] = g_signal_new ("selected", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpcolorpanel.c b/app/widgets/gimpcolorpanel.c index b67ce0416c..ea6495535c 100644 --- a/app/widgets/gimpcolorpanel.c +++ b/app/widgets/gimpcolorpanel.c @@ -34,9 +34,6 @@ /* local function prototypes */ -static void gimp_color_panel_class_init (GimpColorPanelClass *klass); -static void gimp_color_panel_init (GimpColorPanel *panel); - static void gimp_color_panel_destroy (GtkObject *object); static gboolean gimp_color_panel_button_press (GtkWidget *widget, GdkEventButton *bevent); @@ -50,36 +47,10 @@ static void gimp_color_panel_dialog_update (GimpColorDialog *dialog, GimpColorPanel *panel); -static GimpColorButtonClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorPanel, gimp_color_panel, GIMP_TYPE_COLOR_BUTTON); +#define parent_class gimp_color_panel_parent_class -GType -gimp_color_panel_get_type (void) -{ - static GType panel_type = 0; - - if (! panel_type) - { - static const GTypeInfo panel_info = - { - sizeof (GimpColorPanelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_color_panel_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorPanel), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_panel_init, - }; - - panel_type = g_type_register_static (GIMP_TYPE_COLOR_BUTTON, - "GimpColorPanel", - &panel_info, 0); - } - - return panel_type; -} static void gimp_color_panel_class_init (GimpColorPanelClass *klass) @@ -89,11 +60,12 @@ gimp_color_panel_class_init (GimpColorPanelClass *klass) GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass); GimpColorButtonClass *color_button_class = GIMP_COLOR_BUTTON_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->destroy = gimp_color_panel_destroy; + widget_class->button_press_event = gimp_color_panel_button_press; + button_class->clicked = gimp_color_panel_clicked; + color_button_class->color_changed = gimp_color_panel_color_changed; color_button_class->get_action_type = gimp_color_panel_get_action_type; } diff --git a/app/widgets/gimpcomponenteditor.c b/app/widgets/gimpcomponenteditor.c index 3295591c48..367dea7039 100644 --- a/app/widgets/gimpcomponenteditor.c +++ b/app/widgets/gimpcomponenteditor.c @@ -51,9 +51,6 @@ enum }; -static void gimp_component_editor_class_init (GimpComponentEditorClass *klass); -static void gimp_component_editor_init (GimpComponentEditor *editor); - static void gimp_component_editor_unrealize (GtkWidget *widget); static void gimp_component_editor_set_image (GimpImageEditor *editor, @@ -90,36 +87,11 @@ static GimpImage * gimp_component_editor_drag_component (GtkWidget *widget gpointer data); -static GimpImageEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpComponentEditor, gimp_component_editor, + GIMP_TYPE_IMAGE_EDITOR); +#define parent_class gimp_component_editor_parent_class -GType -gimp_component_editor_get_type (void) -{ - static GType editor_type = 0; - - if (! editor_type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpComponentEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_component_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpComponentEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_component_editor_init, - }; - - editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR, - "GimpComponentEditor", - &editor_info, 0); - } - - return editor_type; -} static void gimp_component_editor_class_init (GimpComponentEditorClass *klass) @@ -127,9 +99,7 @@ gimp_component_editor_class_init (GimpComponentEditorClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - widget_class->unrealize = gimp_component_editor_unrealize; + widget_class->unrealize = gimp_component_editor_unrealize; image_editor_class->set_image = gimp_component_editor_set_image; } diff --git a/app/widgets/gimpcontainerbox.c b/app/widgets/gimpcontainerbox.c index 68e19f979b..8f6896c389 100644 --- a/app/widgets/gimpcontainerbox.c +++ b/app/widgets/gimpcontainerbox.c @@ -41,10 +41,8 @@ #include "gimpviewrenderer.h" -static void gimp_container_box_class_init (GimpContainerBoxClass *klass); -static void gimp_container_box_init (GimpContainerBox *box); -static void gimp_container_box_view_iface_init (GimpContainerViewInterface *view_iface); -static void gimp_container_box_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_container_box_view_iface_init (GimpContainerViewInterface *iface); +static void gimp_container_box_docked_iface_init (GimpDockedInterface *iface); static GtkWidget * gimp_container_box_get_preview (GimpDocked *docked, GimpContext *context, @@ -53,62 +51,21 @@ static void gimp_container_box_set_context (GimpDocked *docked, GimpContext *context); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpContainerBox, gimp_container_box, + GIMP_TYPE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_container_box_view_iface_init) + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_container_box_docked_iface_init)); +#define parent_class gimp_container_box_parent_class -GType -gimp_container_box_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo box_info = - { - sizeof (GimpContainerBoxClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_box_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_box_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_container_box_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_container_box_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpContainerBox", - &box_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} static void gimp_container_box_class_init (GimpContainerBoxClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_container_view_set_property; object_class->get_property = gimp_container_view_get_property; @@ -131,15 +88,15 @@ gimp_container_box_init (GimpContainerBox *box) } static void -gimp_container_box_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_container_box_view_iface_init (GimpContainerViewInterface *iface) { } static void -gimp_container_box_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_container_box_docked_iface_init (GimpDockedInterface *iface) { - docked_iface->get_preview = gimp_container_box_get_preview; - docked_iface->set_context = gimp_container_box_set_context; + iface->get_preview = gimp_container_box_get_preview; + iface->set_context = gimp_container_box_set_context; } void diff --git a/app/widgets/gimpcontainercombobox.c b/app/widgets/gimpcontainercombobox.c index 2a1ca02272..d02e8fae2c 100644 --- a/app/widgets/gimpcontainercombobox.c +++ b/app/widgets/gimpcontainercombobox.c @@ -45,10 +45,7 @@ enum }; -static void gimp_container_combo_box_class_init (GimpContainerComboBoxClass *klass); -static void gimp_container_combo_box_init (GimpContainerComboBox *view); - -static void gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface); static void gimp_container_combo_box_unrealize (GtkWidget *widget); @@ -77,56 +74,22 @@ static void gimp_container_combo_box_renderer_update (GimpViewRenderer *r GimpContainerView *view); -static GtkComboBoxClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpContainerComboBox, gimp_container_combo_box, + GTK_TYPE_COMBO_BOX, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_container_combo_box_view_iface_init)); + +#define parent_class gimp_container_combo_box_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; -GType -gimp_container_combo_box_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpContainerComboBoxClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_combo_box_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerComboBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_combo_box_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_container_combo_box_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GTK_TYPE_COMBO_BOX, - "GimpContainerComboBox", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_container_combo_box_class_init (GimpContainerComboBoxClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_container_view_set_property; object_class->get_property = gimp_container_view_get_property; @@ -175,23 +138,22 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box) } static void -gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); if (! parent_view_iface) parent_view_iface = g_type_default_interface_peek (GIMP_TYPE_CONTAINER_VIEW); - view_iface->insert_item = gimp_container_combo_box_insert_item; - view_iface->remove_item = gimp_container_combo_box_remove_item; - view_iface->reorder_item = gimp_container_combo_box_reorder_item; - view_iface->rename_item = gimp_container_combo_box_rename_item; - view_iface->select_item = gimp_container_combo_box_select_item; - view_iface->clear_items = gimp_container_combo_box_clear_items; - view_iface->set_preview_size = gimp_container_combo_box_set_preview_size; - - view_iface->insert_data_free = (GDestroyNotify) g_free; + iface->insert_item = gimp_container_combo_box_insert_item; + iface->remove_item = gimp_container_combo_box_remove_item; + iface->reorder_item = gimp_container_combo_box_reorder_item; + iface->rename_item = gimp_container_combo_box_rename_item; + iface->select_item = gimp_container_combo_box_select_item; + iface->clear_items = gimp_container_combo_box_clear_items; + iface->set_preview_size = gimp_container_combo_box_set_preview_size; + iface->insert_data_free = (GDestroyNotify) g_free; } GtkWidget * @@ -468,8 +430,8 @@ gimp_container_combo_box_changed (GtkComboBox *combo_box, { GtkTreeIter iter; - if (parent_class->changed) - parent_class->changed (combo_box); + if (GTK_COMBO_BOX_CLASS (parent_class)->changed) + GTK_COMBO_BOX_CLASS (parent_class)->changed (combo_box); if (gtk_combo_box_get_active_iter (combo_box, &iter)) { diff --git a/app/widgets/gimpcontainereditor.c b/app/widgets/gimpcontainereditor.c index 3284969014..26b040e145 100644 --- a/app/widgets/gimpcontainereditor.c +++ b/app/widgets/gimpcontainereditor.c @@ -41,9 +41,7 @@ #include "gimpuimanager.h" -static void gimp_container_editor_class_init (GimpContainerEditorClass *klass); -static void gimp_container_editor_init (GimpContainerEditor *view); -static void gimp_container_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_container_editor_docked_iface_init (GimpDockedInterface *iface); static gboolean gimp_container_editor_select_item (GtkWidget *widget, GimpViewable *viewable, @@ -75,52 +73,17 @@ static void gimp_container_editor_set_show_button_bar (GimpDocked *docked, static gboolean gimp_container_editor_get_show_button_bar (GimpDocked *docked); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpContainerEditor, gimp_container_editor, + GTK_TYPE_VBOX, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_container_editor_docked_iface_init)); +#define parent_class gimp_container_editor_parent_class -GType -gimp_container_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo view_info = - { - sizeof (GimpContainerEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_editor_init, - }; - - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_container_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "GimpContainerEditor", - &view_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} static void gimp_container_editor_class_init (GimpContainerEditorClass *klass) { - parent_class = g_type_class_peek_parent (klass); - klass->select_item = NULL; klass->activate_item = NULL; klass->context_item = gimp_container_editor_real_context_item; @@ -133,14 +96,14 @@ gimp_container_editor_init (GimpContainerEditor *view) } static void -gimp_container_editor_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_container_editor_docked_iface_init (GimpDockedInterface *iface) { - docked_iface->get_preview = gimp_container_editor_get_preview; - docked_iface->set_context = gimp_container_editor_set_context; - docked_iface->get_menu = gimp_container_editor_get_menu; - docked_iface->has_button_bar = gimp_container_editor_has_button_bar; - docked_iface->set_show_button_bar = gimp_container_editor_set_show_button_bar; - docked_iface->get_show_button_bar = gimp_container_editor_get_show_button_bar; + iface->get_preview = gimp_container_editor_get_preview; + iface->set_context = gimp_container_editor_set_context; + iface->get_menu = gimp_container_editor_get_menu; + iface->has_button_bar = gimp_container_editor_has_button_bar; + iface->set_show_button_bar = gimp_container_editor_set_show_button_bar; + iface->get_show_button_bar = gimp_container_editor_get_show_button_bar; } gboolean diff --git a/app/widgets/gimpcontainerentry.c b/app/widgets/gimpcontainerentry.c index c912e4366b..befba80a43 100644 --- a/app/widgets/gimpcontainerentry.c +++ b/app/widgets/gimpcontainerentry.c @@ -41,10 +41,7 @@ gtk_entry_completion_get_model (gtk_entry_get_completion (GTK_ENTRY (entry))) -static void gimp_container_entry_class_init (GimpContainerEntryClass *klass); -static void gimp_container_entry_init (GimpContainerEntry *view); - -static void gimp_container_entry_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_container_entry_view_iface_init (GimpContainerViewInterface *iface); static gpointer gimp_container_entry_insert_item (GimpContainerView *view, GimpViewable *viewable, @@ -71,55 +68,21 @@ static void gimp_container_entry_renderer_update (GimpViewRenderer *rende GimpContainerView *view); -static GtkEntryClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpContainerEntry, gimp_container_entry, + GTK_TYPE_ENTRY, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_container_entry_view_iface_init)); + +#define parent_class gimp_container_entry_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; -GType -gimp_container_entry_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpContainerEntryClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_entry_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerEntry), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_entry_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_container_entry_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GTK_TYPE_ENTRY, - "GimpContainerEntry", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_container_entry_class_init (GimpContainerEntryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_container_view_set_property; object_class->get_property = gimp_container_view_get_property; @@ -163,23 +126,22 @@ gimp_container_entry_init (GimpContainerEntry *entry) } static void -gimp_container_entry_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_container_entry_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); if (! parent_view_iface) parent_view_iface = g_type_default_interface_peek (GIMP_TYPE_CONTAINER_VIEW); - view_iface->insert_item = gimp_container_entry_insert_item; - view_iface->remove_item = gimp_container_entry_remove_item; - view_iface->reorder_item = gimp_container_entry_reorder_item; - view_iface->rename_item = gimp_container_entry_rename_item; - view_iface->select_item = gimp_container_entry_select_item; - view_iface->clear_items = gimp_container_entry_clear_items; - view_iface->set_preview_size = gimp_container_entry_set_preview_size; - - view_iface->insert_data_free = (GDestroyNotify) g_free; + iface->insert_item = gimp_container_entry_insert_item; + iface->remove_item = gimp_container_entry_remove_item; + iface->reorder_item = gimp_container_entry_reorder_item; + iface->rename_item = gimp_container_entry_rename_item; + iface->select_item = gimp_container_entry_select_item; + iface->clear_items = gimp_container_entry_clear_items; + iface->set_preview_size = gimp_container_entry_set_preview_size; + iface->insert_data_free = (GDestroyNotify) g_free; } GtkWidget * diff --git a/app/widgets/gimpcontainergridview.c b/app/widgets/gimpcontainergridview.c index 47f1a3083a..83f137c8af 100644 --- a/app/widgets/gimpcontainergridview.c +++ b/app/widgets/gimpcontainergridview.c @@ -51,10 +51,7 @@ enum }; -static void gimp_container_grid_view_class_init (GimpContainerGridViewClass *klass); -static void gimp_container_grid_view_init (GimpContainerGridView *view); - -static void gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface); static gboolean gimp_container_grid_view_move_cursor (GimpContainerGridView *view, GtkMovementStep step, @@ -100,7 +97,13 @@ static gboolean gimp_container_grid_view_button_press (GtkWidget *w GimpContainerGridView *view); -static GimpContainerBoxClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpContainerGridView, gimp_container_grid_view, + GIMP_TYPE_CONTAINER_BOX, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_container_grid_view_view_iface_init)); + +#define parent_class gimp_container_grid_view_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; static guint grid_view_signals[LAST_SIGNAL] = { 0 }; @@ -109,51 +112,12 @@ static GimpRGB white_color; static GimpRGB black_color; -GType -gimp_container_grid_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpContainerGridViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_grid_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerGridView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_grid_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_container_grid_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_BOX, - "GimpContainerGridView", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_container_grid_view_class_init (GimpContainerGridViewClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkBindingSet *binding_set; - parent_class = g_type_class_peek_parent (klass); binding_set = gtk_binding_set_by_class (klass); widget_class->focus = gimp_container_grid_view_focus; @@ -228,17 +192,17 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view) } static void -gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); - view_iface->insert_item = gimp_container_grid_view_insert_item; - view_iface->remove_item = gimp_container_grid_view_remove_item; - view_iface->reorder_item = gimp_container_grid_view_reorder_item; - view_iface->rename_item = gimp_container_grid_view_rename_item; - view_iface->select_item = gimp_container_grid_view_select_item; - view_iface->clear_items = gimp_container_grid_view_clear_items; - view_iface->set_preview_size = gimp_container_grid_view_set_preview_size; + iface->insert_item = gimp_container_grid_view_insert_item; + iface->remove_item = gimp_container_grid_view_remove_item; + iface->reorder_item = gimp_container_grid_view_reorder_item; + iface->rename_item = gimp_container_grid_view_rename_item; + iface->select_item = gimp_container_grid_view_select_item; + iface->clear_items = gimp_container_grid_view_clear_items; + iface->set_preview_size = gimp_container_grid_view_set_preview_size; } GtkWidget * diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c index 1007fb9963..e1ced66c3b 100644 --- a/app/widgets/gimpcontainerpopup.c +++ b/app/widgets/gimpcontainerpopup.c @@ -52,15 +52,14 @@ enum }; -static void gimp_container_popup_class_init (GimpContainerPopupClass *klass); -static void gimp_container_popup_init (GimpContainerPopup *view); - static void gimp_container_popup_finalize (GObject *object); + static void gimp_container_popup_map (GtkWidget *widget); static gboolean gimp_container_popup_button_press (GtkWidget *widget, GdkEventButton *bevent); static gboolean gimp_container_popup_key_press (GtkWidget *widget, GdkEventKey *kevent); + static void gimp_container_popup_real_cancel (GimpContainerPopup *popup); static void gimp_container_popup_real_confirm (GimpContainerPopup *popup); @@ -76,39 +75,13 @@ static void gimp_container_popup_dialog_clicked (GtkWidget *button, GimpContainerPopup *popup); -static GtkWindowClass *parent_class = NULL; +G_DEFINE_TYPE (GimpContainerPopup, gimp_container_popup, GTK_TYPE_WINDOW); + +#define parent_class gimp_container_popup_parent_class static guint popup_signals[LAST_SIGNAL]; -GType -gimp_container_popup_get_type (void) -{ - static GType popup_type = 0; - - if (! popup_type) - { - static const GTypeInfo popup_info = - { - sizeof (GimpContainerPopupClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_popup_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerPopup), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_popup_init, - }; - - popup_type = g_type_register_static (GTK_TYPE_WINDOW, - "GimpContainerPopup", - &popup_info, 0); - } - - return popup_type; -} - static void gimp_container_popup_class_init (GimpContainerPopupClass *klass) { @@ -116,8 +89,6 @@ gimp_container_popup_class_init (GimpContainerPopupClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkBindingSet *binding_set; - parent_class = g_type_class_peek_parent (klass); - popup_signals[CANCEL] = g_signal_new ("cancel", G_OBJECT_CLASS_TYPE (klass), diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c index cdb102a29c..612b37d608 100644 --- a/app/widgets/gimpcontainertreeview.c +++ b/app/widgets/gimpcontainertreeview.c @@ -51,10 +51,7 @@ enum }; -static void gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass); -static void gimp_container_tree_view_init (GimpContainerTreeView *view); - -static void gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface); static GObject *gimp_container_tree_view_constructor (GType type, guint n_params, @@ -102,56 +99,22 @@ static GdkPixbuf * gimp_container_tree_view_drag_pixbuf (GtkWidget *w gpointer data); -static GimpContainerBoxClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view, + GIMP_TYPE_CONTAINER_BOX, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_container_tree_view_view_iface_init)); + +#define parent_class gimp_container_tree_view_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; -GType -gimp_container_tree_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpContainerTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_container_tree_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpContainerTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_container_tree_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_container_tree_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_BOX, - "GimpContainerTreeView", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_container_tree_view_constructor; widget_class->unrealize = gimp_container_tree_view_unrealize; @@ -189,20 +152,20 @@ gimp_container_tree_view_init (GimpContainerTreeView *tree_view) } static void -gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); - view_iface->set_container = gimp_container_tree_view_set_container; - view_iface->insert_item = gimp_container_tree_view_insert_item; - view_iface->remove_item = gimp_container_tree_view_remove_item; - view_iface->reorder_item = gimp_container_tree_view_reorder_item; - view_iface->rename_item = gimp_container_tree_view_rename_item; - view_iface->select_item = gimp_container_tree_view_select_item; - view_iface->clear_items = gimp_container_tree_view_clear_items; - view_iface->set_preview_size = gimp_container_tree_view_set_preview_size; + iface->set_container = gimp_container_tree_view_set_container; + iface->insert_item = gimp_container_tree_view_insert_item; + iface->remove_item = gimp_container_tree_view_remove_item; + iface->reorder_item = gimp_container_tree_view_reorder_item; + iface->rename_item = gimp_container_tree_view_rename_item; + iface->select_item = gimp_container_tree_view_select_item; + iface->clear_items = gimp_container_tree_view_clear_items; + iface->set_preview_size = gimp_container_tree_view_set_preview_size; - view_iface->insert_data_free = (GDestroyNotify) g_free; + iface->insert_data_free = (GDestroyNotify) g_free; } static GObject * diff --git a/app/widgets/gimpcontrollereditor.c b/app/widgets/gimpcontrollereditor.c index 8cc69842c6..de87ee2ccf 100644 --- a/app/widgets/gimpcontrollereditor.c +++ b/app/widgets/gimpcontrollereditor.c @@ -59,9 +59,6 @@ enum }; -static void gimp_controller_editor_class_init (GimpControllerEditorClass *klass); -static void gimp_controller_editor_init (GimpControllerEditor *editor); - static GObject * gimp_controller_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -102,36 +99,10 @@ static void gimp_controller_editor_edit_response (GtkWidget *dialog, GimpControllerEditor *editor); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpControllerEditor, gimp_controller_editor, GTK_TYPE_VBOX); +#define parent_class gimp_controller_editor_parent_class -GType -gimp_controller_editor_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpControllerEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_controller_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpControllerEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_controller_editor_init - }; - - view_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpControllerEditor", - &view_info, 0); - } - - return view_type; -} static void gimp_controller_editor_class_init (GimpControllerEditorClass *klass) @@ -139,8 +110,6 @@ gimp_controller_editor_class_init (GimpControllerEditorClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_controller_editor_constructor; object_class->set_property = gimp_controller_editor_set_property; object_class->get_property = gimp_controller_editor_get_property; diff --git a/app/widgets/gimpcontrollerinfo.c b/app/widgets/gimpcontrollerinfo.c index c845d4facb..7b7a53cbd9 100644 --- a/app/widgets/gimpcontrollerinfo.c +++ b/app/widgets/gimpcontrollerinfo.c @@ -58,10 +58,7 @@ enum }; -static void gimp_controller_info_class_init (GimpControllerInfoClass *klass); -static void gimp_controller_info_init (GimpControllerInfo *info); - -static void gimp_controller_info_config_iface_init (GimpConfigInterface *config_iface); +static void gimp_controller_info_config_iface_init (GimpConfigInterface *iface); static void gimp_controller_info_finalize (GObject *object); static void gimp_controller_info_set_property (GObject *object, @@ -90,55 +87,21 @@ static gboolean gimp_controller_info_event (GimpController *controlle GimpControllerInfo *info); -static GimpViewableClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpControllerInfo, gimp_controller_info, + GIMP_TYPE_VIEWABLE, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, + gimp_controller_info_config_iface_init)); -static guint info_signals[LAST_SIGNAL] = { 0 }; +#define parent_class gimp_controller_info_parent_class +static guint info_signals[LAST_SIGNAL] = { 0 }; -GType -gimp_controller_info_get_type (void) -{ - static GType controller_type = 0; - - if (! controller_type) - { - static const GTypeInfo controller_info = - { - sizeof (GimpControllerInfoClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_controller_info_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpControllerInfo), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_controller_info_init, - }; - static const GInterfaceInfo config_iface_info = - { - (GInterfaceInitFunc) gimp_controller_info_config_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - controller_type = g_type_register_static (GIMP_TYPE_VIEWABLE, - "GimpControllerInfo", - &controller_info, 0); - - g_type_add_interface_static (controller_type, GIMP_TYPE_CONFIG, - &config_iface_info); - } - - return controller_type; -} static void gimp_controller_info_class_init (GimpControllerInfoClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_controller_info_finalize; object_class->set_property = gimp_controller_info_set_property; object_class->get_property = gimp_controller_info_get_property; @@ -183,10 +146,10 @@ gimp_controller_info_init (GimpControllerInfo *info) } static void -gimp_controller_info_config_iface_init (GimpConfigInterface *config_iface) +gimp_controller_info_config_iface_init (GimpConfigInterface *iface) { - config_iface->serialize_property = gimp_controller_info_serialize_property; - config_iface->deserialize_property = gimp_controller_info_deserialize_property; + iface->serialize_property = gimp_controller_info_serialize_property; + iface->deserialize_property = gimp_controller_info_deserialize_property; } static void diff --git a/app/widgets/gimpcontrollerkeyboard.c b/app/widgets/gimpcontrollerkeyboard.c index c67991ebfd..6233911306 100644 --- a/app/widgets/gimpcontrollerkeyboard.c +++ b/app/widgets/gimpcontrollerkeyboard.c @@ -47,9 +47,6 @@ struct _KeyboardEvent }; -static void gimp_controller_keyboard_class_init (GimpControllerKeyboardClass *klass); -static void gimp_controller_keyboard_init (GimpControllerKeyboard *keyboard); - static GObject * gimp_controller_keyboard_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -61,7 +58,11 @@ static const gchar * gimp_controller_keyboard_get_event_blurb (GimpController *c gint event_id); -static GimpControllerClass *parent_class = NULL; +G_DEFINE_TYPE (GimpControllerKeyboard, gimp_controller_keyboard, + GIMP_TYPE_CONTROLLER); + +#define parent_class gimp_controller_keyboard_parent_class + static KeyboardEvent keyboard_events[] = { @@ -167,42 +168,12 @@ static KeyboardEvent keyboard_events[] = }; -GType -gimp_controller_keyboard_get_type (void) -{ - static GType controller_type = 0; - - if (! controller_type) - { - static const GTypeInfo controller_info = - { - sizeof (GimpControllerKeyboardClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_controller_keyboard_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpControllerKeyboard), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_controller_keyboard_init, - }; - - controller_type = g_type_register_static (GIMP_TYPE_CONTROLLER, - "GimpControllerKeyboard", - &controller_info, 0); - } - - return controller_type; -} - static void gimp_controller_keyboard_class_init (GimpControllerKeyboardClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpControllerClass *controller_class = GIMP_CONTROLLER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_controller_keyboard_constructor; controller_class->name = _("Keyboard"); diff --git a/app/widgets/gimpcontrollerlist.c b/app/widgets/gimpcontrollerlist.c index d3dde666fd..26f00072a8 100644 --- a/app/widgets/gimpcontrollerlist.c +++ b/app/widgets/gimpcontrollerlist.c @@ -69,9 +69,6 @@ enum }; -static void gimp_controller_list_class_init (GimpControllerListClass *klass); -static void gimp_controller_list_init (GimpControllerList *list); - static GObject * gimp_controller_list_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -117,44 +114,16 @@ static void gimp_controller_list_down_clicked (GtkWidget *button, GimpControllerList *list); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpControllerList, gimp_controller_list, GTK_TYPE_VBOX); +#define parent_class gimp_controller_list_parent_class -GType -gimp_controller_list_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpControllerListClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_controller_list_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpControllerList), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_controller_list_init - }; - - view_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpControllerList", - &view_info, 0); - } - - return view_type; -} static void gimp_controller_list_class_init (GimpControllerListClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_controller_list_constructor; object_class->set_property = gimp_controller_list_set_property; object_class->get_property = gimp_controller_list_get_property; diff --git a/app/widgets/gimpcontrollerwheel.c b/app/widgets/gimpcontrollerwheel.c index 0d0762940d..3203a7e272 100644 --- a/app/widgets/gimpcontrollerwheel.c +++ b/app/widgets/gimpcontrollerwheel.c @@ -46,9 +46,6 @@ struct _WheelEvent }; -static void gimp_controller_wheel_class_init (GimpControllerWheelClass *klass); -static void gimp_controller_wheel_init (GimpControllerWheel *wheel); - static GObject * gimp_controller_wheel_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -60,7 +57,11 @@ static const gchar * gimp_controller_wheel_get_event_blurb (GimpController *cont gint event_id); -static GimpControllerClass *parent_class = NULL; +G_DEFINE_TYPE (GimpControllerWheel, gimp_controller_wheel, + GIMP_TYPE_CONTROLLER); + +#define parent_class gimp_controller_wheel_parent_class + static WheelEvent wheel_events[] = { @@ -166,42 +167,12 @@ static WheelEvent wheel_events[] = }; -GType -gimp_controller_wheel_get_type (void) -{ - static GType controller_type = 0; - - if (! controller_type) - { - static const GTypeInfo controller_info = - { - sizeof (GimpControllerWheelClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_controller_wheel_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpControllerWheel), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_controller_wheel_init, - }; - - controller_type = g_type_register_static (GIMP_TYPE_CONTROLLER, - "GimpControllerWheel", - &controller_info, 0); - } - - return controller_type; -} - static void gimp_controller_wheel_class_init (GimpControllerWheelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpControllerClass *controller_class = GIMP_CONTROLLER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_controller_wheel_constructor; controller_class->name = _("Mouse Wheel"); diff --git a/app/widgets/gimpcursorview.c b/app/widgets/gimpcursorview.c index 9af12626ee..dddab3e19f 100644 --- a/app/widgets/gimpcursorview.c +++ b/app/widgets/gimpcursorview.c @@ -52,74 +52,40 @@ enum }; -static void gimp_cursor_view_class_init (GimpCursorViewClass *klass); -static void gimp_cursor_view_init (GimpCursorView *view); -static void gimp_cursor_view_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_cursor_view_docked_iface_init (GimpDockedInterface *iface); -static void gimp_cursor_view_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_cursor_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); -static void gimp_cursor_view_set_aux_info (GimpDocked *docked, - GList *aux_info); -static GList *gimp_cursor_view_get_aux_info (GimpDocked *docked); -static void gimp_cursor_view_style_set (GtkWidget *widget, - GtkStyle *prev_style); +static void gimp_cursor_view_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_cursor_view_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +static void gimp_cursor_view_style_set (GtkWidget *widget, + GtkStyle *prev_style); + +static void gimp_cursor_view_set_aux_info (GimpDocked *docked, + GList *aux_info); +static GList *gimp_cursor_view_get_aux_info (GimpDocked *docked); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpCursorView, gimp_cursor_view, GIMP_TYPE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_cursor_view_docked_iface_init)); + +#define parent_class gimp_cursor_view_parent_class + static GimpDockedInterface *parent_docked_iface = NULL; -GType -gimp_cursor_view_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo view_info = - { - sizeof (GimpCursorViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_cursor_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCursorView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_cursor_view_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_cursor_view_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpCursorView", - &view_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} - static void gimp_cursor_view_class_init (GimpCursorViewClass* klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->get_property = gimp_cursor_view_get_property; object_class->set_property = gimp_cursor_view_set_property; @@ -228,15 +194,15 @@ gimp_cursor_view_init (GimpCursorView *view) } static void -gimp_cursor_view_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_cursor_view_docked_iface_init (GimpDockedInterface *iface) { - parent_docked_iface = g_type_interface_peek_parent (docked_iface); + parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); - docked_iface->set_aux_info = gimp_cursor_view_set_aux_info; - docked_iface->get_aux_info = gimp_cursor_view_get_aux_info; + iface->set_aux_info = gimp_cursor_view_set_aux_info; + iface->get_aux_info = gimp_cursor_view_get_aux_info; } static void diff --git a/app/widgets/gimpdasheditor.c b/app/widgets/gimpdasheditor.c index e171ffe3c3..2b1112ff77 100644 --- a/app/widgets/gimpdasheditor.c +++ b/app/widgets/gimpdasheditor.c @@ -49,9 +49,6 @@ enum }; -static void gimp_dash_editor_class_init (GimpDashEditorClass *klass); -static void gimp_dash_editor_init (GimpDashEditor *editor); - static void gimp_dash_editor_finalize (GObject *object); static void gimp_dash_editor_set_property (GObject *object, guint property_id, @@ -81,36 +78,10 @@ static gint dash_x_to_index (GimpDashEditor *editor, gint x); -static GtkDrawingAreaClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDashEditor, gimp_dash_editor, GTK_TYPE_DRAWING_AREA); +#define parent_class gimp_dash_editor_parent_class -GType -gimp_dash_editor_get_type (void) -{ - static GType editor_type = 0; - - if (! editor_type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpDashEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_dash_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDashEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dash_editor_init, - }; - - editor_type = g_type_register_static (GTK_TYPE_DRAWING_AREA, - "GimpDashEditor", - &editor_info, 0); - } - - return editor_type; -} static void gimp_dash_editor_class_init (GimpDashEditorClass *klass) @@ -118,8 +89,6 @@ gimp_dash_editor_class_init (GimpDashEditorClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_dash_editor_finalize; object_class->get_property = gimp_dash_editor_get_property; object_class->set_property = gimp_dash_editor_set_property; diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c index 585c9c1dc1..b2dc94b91b 100644 --- a/app/widgets/gimpdataeditor.c +++ b/app/widgets/gimpdataeditor.c @@ -53,10 +53,7 @@ enum }; -static void gimp_data_editor_class_init (GimpDataEditorClass *klass); -static void gimp_data_editor_init (GimpDataEditor *view); - -static void gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_data_editor_docked_iface_init (GimpDockedInterface *iface); static GObject * gimp_data_editor_constructor (GType type, guint n_params, @@ -98,54 +95,20 @@ static void gimp_data_editor_revert_clicked (GtkWidget *widget, static void gimp_data_editor_save_dirty (GimpDataEditor *editor); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpDataEditor, gimp_data_editor, GIMP_TYPE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_data_editor_docked_iface_init)); + +#define parent_class gimp_data_editor_parent_class + static GimpDockedInterface *parent_docked_iface = NULL; -GType -gimp_data_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo view_info = - { - sizeof (GimpDataEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_data_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDataEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_data_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_data_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpDataEditor", - &view_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} - static void gimp_data_editor_class_init (GimpDataEditorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_data_editor_constructor; object_class->set_property = gimp_data_editor_set_property; object_class->get_property = gimp_data_editor_get_property; @@ -192,16 +155,16 @@ gimp_data_editor_init (GimpDataEditor *editor) } static void -gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_data_editor_docked_iface_init (GimpDockedInterface *iface) { - parent_docked_iface = g_type_interface_peek_parent (docked_iface); + parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); - docked_iface->set_aux_info = gimp_data_editor_set_aux_info; - docked_iface->get_aux_info = gimp_data_editor_get_aux_info; - docked_iface->get_title = gimp_data_editor_get_title; + iface->set_aux_info = gimp_data_editor_set_aux_info; + iface->get_aux_info = gimp_data_editor_get_aux_info; + iface->get_title = gimp_data_editor_get_title; } static GObject * diff --git a/app/widgets/gimpdatafactoryview.c b/app/widgets/gimpdatafactoryview.c index 20005f0905..301ac3054b 100644 --- a/app/widgets/gimpdatafactoryview.c +++ b/app/widgets/gimpdatafactoryview.c @@ -50,9 +50,6 @@ #include "gimp-intl.h" -static void gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass); -static void gimp_data_factory_view_init (GimpDataFactoryView *view); - static void gimp_data_factory_view_activate_item (GimpContainerEditor *editor, GimpViewable *viewable); static void gimp_data_factory_view_tree_name_edited (GtkCellRendererText *cell, @@ -61,44 +58,17 @@ static void gimp_data_factory_view_tree_name_edited (GtkCellRendererText *cell, GimpDataFactoryView *view); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDataFactoryView, gimp_data_factory_view, + GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_data_factory_view_parent_class -GType -gimp_data_factory_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpDataFactoryViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_data_factory_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDataFactoryView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_data_factory_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpDataFactoryView", - &view_info, 0); - } - - return view_type; -} static void gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass) { GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->activate_item = gimp_data_factory_view_activate_item; } diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index efc916b9ec..ba89edb9d8 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -54,9 +54,6 @@ enum /* local function prototypes */ -static void gimp_device_info_class_init (GimpDeviceInfoClass *klass); -static void gimp_device_info_init (GimpDeviceInfo *device_info); - static GObject * gimp_device_info_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -71,47 +68,19 @@ static void gimp_device_info_get_property (GObject *object, GParamSpec *pspec); -static GimpContextClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDeviceInfo, gimp_device_info, GIMP_TYPE_CONTEXT); + +#define parent_class gimp_device_info_parent_class static guint device_info_signals[LAST_SIGNAL] = { 0 }; -GType -gimp_device_info_get_type (void) -{ - static GType device_info_type = 0; - - if (! device_info_type) - { - static const GTypeInfo device_info_info = - { - sizeof (GimpDeviceInfoClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_device_info_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDeviceInfo), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_device_info_init, - }; - - device_info_type = g_type_register_static (GIMP_TYPE_CONTEXT, - "GimpDeviceInfo", - &device_info_info, 0); - } - - return device_info_type; -} - static void gimp_device_info_class_init (GimpDeviceInfoClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *array_spec; - parent_class = g_type_class_peek_parent (klass); - device_info_signals[CHANGED] = g_signal_new ("changed", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpdeviceinfo.h b/app/widgets/gimpdeviceinfo.h index 46900e4c1a..e02bd38c45 100644 --- a/app/widgets/gimpdeviceinfo.h +++ b/app/widgets/gimpdeviceinfo.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS #define GIMP_DEVICE_INFO_CONTEXT_MASK (GIMP_CONTEXT_TOOL_MASK | \ + GIMP_CONTEXT_PAINT_INFO_MASK | \ GIMP_CONTEXT_FOREGROUND_MASK | \ GIMP_CONTEXT_BACKGROUND_MASK | \ GIMP_CONTEXT_BRUSH_MASK | \ diff --git a/app/widgets/gimpdevicestatus.c b/app/widgets/gimpdevicestatus.c index f40183951b..cfa4913609 100644 --- a/app/widgets/gimpdevicestatus.c +++ b/app/widgets/gimpdevicestatus.c @@ -73,9 +73,6 @@ struct _GimpDeviceStatusEntry }; -static void gimp_device_status_class_init (GimpDeviceStatusClass *klass); -static void gimp_device_status_init (GimpDeviceStatus *editor); - static GObject *gimp_device_status_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -102,36 +99,10 @@ static void gimp_device_status_preview_clicked (GtkWidget *widget, const gchar *identifier); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDeviceStatus, gimp_device_status, GIMP_TYPE_EDITOR); +#define parent_class gimp_device_status_parent_class -GType -gimp_device_status_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpDeviceStatusClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_device_status_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDeviceStatus), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_device_status_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpDeviceStatus", - &view_info, 0); - } - - return view_type; -} static void gimp_device_status_class_init (GimpDeviceStatusClass *klass) @@ -139,8 +110,6 @@ gimp_device_status_class_init (GimpDeviceStatusClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_device_status_constructor; object_class->set_property = gimp_device_status_set_property; diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c index b7d023c268..d991333dab 100644 --- a/app/widgets/gimpdialogfactory.c +++ b/app/widgets/gimpdialogfactory.c @@ -58,9 +58,6 @@ typedef enum } GimpDialogShowState; -static void gimp_dialog_factory_class_init (GimpDialogFactoryClass *klass); -static void gimp_dialog_factory_init (GimpDialogFactory *factory); - static void gimp_dialog_factory_dispose (GObject *object); static void gimp_dialog_factory_finalize (GObject *object); @@ -104,45 +101,15 @@ static GtkWidget * gimp_dialog_factory_get_toolbox (GimpDialogFactory *toolbox_factory); -static GimpObjectClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDialogFactory, gimp_dialog_factory, GIMP_TYPE_OBJECT); +#define parent_class gimp_dialog_factory_parent_class -GType -gimp_dialog_factory_get_type (void) -{ - static GType factory_type = 0; - - if (! factory_type) - { - static const GTypeInfo factory_info = - { - sizeof (GimpDialogFactoryClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_dialog_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDialogFactory), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dialog_factory_init, - }; - - factory_type = g_type_register_static (GIMP_TYPE_OBJECT, - "GimpDialogFactory", - &factory_info, 0); - } - - return factory_type; -} static void gimp_dialog_factory_class_init (GimpDialogFactoryClass *klass) { - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = gimp_dialog_factory_dispose; object_class->finalize = gimp_dialog_factory_finalize; @@ -164,11 +131,9 @@ gimp_dialog_factory_init (GimpDialogFactory *factory) static void gimp_dialog_factory_dispose (GObject *object) { - GimpDialogFactory *factory; + GimpDialogFactory *factory = GIMP_DIALOG_FACTORY (object); GList *list; - factory = GIMP_DIALOG_FACTORY (object); - /* start iterating from the beginning each time we destroyed a * toplevel because destroying a dock may cause lots of items * to be removed from factory->open_dialogs @@ -201,19 +166,15 @@ gimp_dialog_factory_dispose (GObject *object) static void gimp_dialog_factory_finalize (GObject *object) { - GimpDialogFactory *factory; + GimpDialogFactory *factory = GIMP_DIALOG_FACTORY (object); GList *list; - factory = GIMP_DIALOG_FACTORY (object); - g_hash_table_remove (GIMP_DIALOG_FACTORY_GET_CLASS (object)->factories, GIMP_OBJECT (factory)->name); for (list = factory->registered_dialogs; list; list = g_list_next (list)) { - GimpDialogFactoryEntry *entry; - - entry = (GimpDialogFactoryEntry *) list->data; + GimpDialogFactoryEntry *entry = list->data; g_free (entry->identifier); g_free (entry->name); diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c index 39b74ec744..80a7367050 100644 --- a/app/widgets/gimpdock.c +++ b/app/widgets/gimpdock.c @@ -63,9 +63,6 @@ enum }; -static void gimp_dock_class_init (GimpDockClass *klass); -static void gimp_dock_init (GimpDock *dock); - static GObject * gimp_dock_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -94,37 +91,12 @@ static void gimp_dock_real_book_removed (GimpDock *dock, GimpDockbook *dockbook); -static GtkWindowClass *parent_class = NULL; -static guint dock_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpDock, gimp_dock, GTK_TYPE_WINDOW); +#define parent_class gimp_dock_parent_class -GType -gimp_dock_get_type (void) -{ - static GType dock_type = 0; +static guint dock_signals[LAST_SIGNAL] = { 0 }; - if (! dock_type) - { - static const GTypeInfo dock_info = - { - sizeof (GimpDockClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_dock_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDock), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dock_init, - }; - - dock_type = g_type_register_static (GTK_TYPE_WINDOW, - "GimpDock", - &dock_info, 0); - } - - return dock_type; -} static void gimp_dock_class_init (GimpDockClass *klass) @@ -133,8 +105,6 @@ gimp_dock_class_init (GimpDockClass *klass) GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - dock_signals[BOOK_ADDED] = g_signal_new ("book-added", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c index 1592c5570a..9e4a2df373 100644 --- a/app/widgets/gimpdockable.c +++ b/app/widgets/gimpdockable.c @@ -42,9 +42,6 @@ #include "gimp-intl.h" -static void gimp_dockable_class_init (GimpDockableClass *klass); -static void gimp_dockable_init (GimpDockable *dockable); - static void gimp_dockable_destroy (GtkObject *object); static void gimp_dockable_size_request (GtkWidget *widget, GtkRequisition *requisition); @@ -91,41 +88,12 @@ static void gimp_dockable_title_changed (GimpDocked *docked, GimpDockable *dockable); -static GtkBinClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDockable, gimp_dockable, GTK_TYPE_BIN); -static GtkTargetEntry dialog_target_table[] = -{ - GIMP_TARGET_DIALOG -}; +#define parent_class gimp_dockable_parent_class +static GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG }; -GType -gimp_dockable_get_type (void) -{ - static GType dockable_type = 0; - - if (! dockable_type) - { - static const GTypeInfo dockable_info = - { - sizeof (GimpDockableClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_dockable_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDockable), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dockable_init, - }; - - dockable_type = g_type_register_static (GTK_TYPE_BIN, - "GimpDockable", - &dockable_info, 0); - } - - return dockable_type; -} static void gimp_dockable_class_init (GimpDockableClass *klass) @@ -134,8 +102,6 @@ gimp_dockable_class_init (GimpDockableClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->destroy = gimp_dockable_destroy; widget_class->size_request = gimp_dockable_size_request; diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c index 1f9ca2aa11..eba3bef902 100644 --- a/app/widgets/gimpdockbook.c +++ b/app/widgets/gimpdockbook.c @@ -60,9 +60,6 @@ enum }; -static void gimp_dockbook_class_init (GimpDockbookClass *klass); -static void gimp_dockbook_init (GimpDockbook *dockbook); - static void gimp_dockbook_finalize (GObject *object); static void gimp_dockbook_style_set (GtkWidget *widget, @@ -96,9 +93,11 @@ static void gimp_dockbook_help_func (const gchar *help_id, gpointer help_data); -static GtkNotebookClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDockbook, gimp_dockbook, GTK_TYPE_NOTEBOOK); -static guint dockbook_signals[LAST_SIGNAL] = { 0 }; +#define parent_class gimp_dockbook_parent_class + +static guint dockbook_signals[LAST_SIGNAL] = { 0 }; static GtkTargetEntry dialog_target_table[] = { @@ -106,42 +105,12 @@ static GtkTargetEntry dialog_target_table[] = }; -GType -gimp_dockbook_get_type (void) -{ - static GType dockbook_type = 0; - - if (! dockbook_type) - { - static const GTypeInfo dockbook_info = - { - sizeof (GimpDockbookClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_dockbook_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDockbook), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dockbook_init, - }; - - dockbook_type = g_type_register_static (GTK_TYPE_NOTEBOOK, - "GimpDockbook", - &dockbook_info, 0); - } - - return dockbook_type; -} - static void gimp_dockbook_class_init (GimpDockbookClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - dockbook_signals[DOCKABLE_ADDED] = g_signal_new ("dockable-added", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpdockseparator.c b/app/widgets/gimpdockseparator.c index f0afa43bfc..a53ac7e6ac 100644 --- a/app/widgets/gimpdockseparator.c +++ b/app/widgets/gimpdockseparator.c @@ -42,9 +42,6 @@ #define LABEL_PADDING 4 -static void gimp_dock_separator_class_init (GimpDockSeparatorClass *klass); -static void gimp_dock_separator_init (GimpDockSeparator *separator); - static void gimp_dock_separator_style_set (GtkWidget *widget, GtkStyle *prev_style); static void gimp_dock_separator_size_allocate (GtkWidget *widget, @@ -64,45 +61,18 @@ static gboolean gimp_dock_separator_drag_drop (GtkWidget *widget, guint time); -static GtkEventBoxClass *parent_class = NULL; -static GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG }; +G_DEFINE_TYPE (GimpDockSeparator, gimp_dock_separator, GTK_TYPE_EVENT_BOX); +#define parent_class gimp_dock_separator_parent_class -GType -gimp_dock_separator_get_type (void) -{ - static GType type = 0; +static GtkTargetEntry dialog_target_table[] = { GIMP_TARGET_DIALOG }; - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpDockSeparatorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_dock_separator_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDockSeparator), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dock_separator_init, - }; - - type = g_type_register_static (GTK_TYPE_EVENT_BOX, - "GimpDockSeparator", - &info, 0); - } - - return type; -} static void gimp_dock_separator_class_init (GimpDockSeparatorClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - widget_class->style_set = gimp_dock_separator_style_set; widget_class->size_allocate = gimp_dock_separator_size_allocate; widget_class->drag_leave = gimp_dock_separator_drag_leave; diff --git a/app/widgets/gimpdocumentview.c b/app/widgets/gimpdocumentview.c index f0addca242..e9eb8e714b 100644 --- a/app/widgets/gimpdocumentview.c +++ b/app/widgets/gimpdocumentview.c @@ -42,53 +42,23 @@ #include "gimp-intl.h" -static void gimp_document_view_class_init (GimpDocumentViewClass *klass); -static void gimp_document_view_init (GimpDocumentView *view); - static void gimp_document_view_activate_item (GimpContainerEditor *editor, GimpViewable *viewable); static GList * gimp_document_view_drag_uri_list (GtkWidget *widget, gpointer data); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDocumentView, gimp_document_view, + GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_document_view_parent_class -GType -gimp_document_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpDocumentViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_document_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDocumentView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_document_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpDocumentView", - &view_info, 0); - } - - return view_type; -} static void gimp_document_view_class_init (GimpDocumentViewClass *klass) { GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->activate_item = gimp_document_view_activate_item; } diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c index 6445dba6f7..d5a4da5d72 100644 --- a/app/widgets/gimpdrawabletreeview.c +++ b/app/widgets/gimpdrawabletreeview.c @@ -42,10 +42,7 @@ #include "gimp-intl.h" -static void gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass); -static void gimp_drawable_tree_view_init (GimpDrawableTreeView *view); - -static void gimp_drawable_tree_view_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_drawable_tree_view_view_iface_init (GimpContainerViewInterface *iface); static GObject * gimp_drawable_tree_view_constructor (GType type, guint n_params, @@ -92,48 +89,16 @@ static void gimp_drawable_tree_view_new_color_dropped gpointer data); -static GimpItemTreeViewClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpDrawableTreeView, gimp_drawable_tree_view, + GIMP_TYPE_ITEM_TREE_VIEW, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_drawable_tree_view_view_iface_init)); + +#define parent_class gimp_drawable_tree_view_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; -GType -gimp_drawable_tree_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpDrawableTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_drawable_tree_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDrawableTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_drawable_tree_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_drawable_tree_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GIMP_TYPE_ITEM_TREE_VIEW, - "GimpDrawableTreeView", - &view_info, G_TYPE_FLAG_ABSTRACT); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass) { @@ -145,8 +110,6 @@ gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass) tree_view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_drawable_tree_view_constructor; tree_view_class->drop_possible = gimp_drawable_tree_view_drop_possible; @@ -191,11 +154,11 @@ gimp_drawable_tree_view_constructor (GType type, } static void -gimp_drawable_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_drawable_tree_view_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); - view_iface->select_item = gimp_drawable_tree_view_select_item; + iface->select_item = gimp_drawable_tree_view_select_item; } diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c index 29de37e7b6..074a16d388 100644 --- a/app/widgets/gimpeditor.c +++ b/app/widgets/gimpeditor.c @@ -54,9 +54,7 @@ enum }; -static void gimp_editor_class_init (GimpEditorClass *klass); -static void gimp_editor_init (GimpEditor *editor); -static void gimp_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_editor_docked_iface_init (GimpDockedInterface *iface); static GObject * gimp_editor_constructor (GType type, guint n_params, @@ -84,45 +82,12 @@ static gboolean gimp_editor_get_show_button_bar (GimpDocked *docked); static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpEditor, gimp_editor, GTK_TYPE_VBOX, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_editor_docked_iface_init)); +#define parent_class gimp_editor_parent_class -GType -gimp_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "GimpEditor", - &info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} static void gimp_editor_class_init (GimpEditorClass *klass) @@ -131,8 +96,6 @@ gimp_editor_class_init (GimpEditorClass *klass) GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_editor_constructor; object_class->set_property = gimp_editor_set_property; object_class->get_property = gimp_editor_get_property; @@ -228,12 +191,12 @@ gimp_editor_init (GimpEditor *editor) } static void -gimp_editor_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_editor_docked_iface_init (GimpDockedInterface *iface) { - docked_iface->get_menu = gimp_editor_get_menu; - docked_iface->has_button_bar = gimp_editor_has_button_bar; - docked_iface->set_show_button_bar = gimp_editor_set_show_button_bar; - docked_iface->get_show_button_bar = gimp_editor_get_show_button_bar; + iface->get_menu = gimp_editor_get_menu; + iface->has_button_bar = gimp_editor_has_button_bar; + iface->set_show_button_bar = gimp_editor_set_show_button_bar; + iface->get_show_button_bar = gimp_editor_get_show_button_bar; } static GObject * diff --git a/app/widgets/gimpenumaction.c b/app/widgets/gimpenumaction.c index d243174013..ceba3f9a0c 100644 --- a/app/widgets/gimpenumaction.c +++ b/app/widgets/gimpenumaction.c @@ -44,9 +44,6 @@ enum }; -static void gimp_enum_action_init (GimpEnumAction *action); -static void gimp_enum_action_class_init (GimpEnumActionClass *klass); - static void gimp_enum_action_set_property (GObject *object, guint prop_id, const GValue *value, @@ -59,37 +56,12 @@ static void gimp_enum_action_get_property (GObject *object, static void gimp_enum_action_activate (GtkAction *action); -static GimpActionClass *parent_class = NULL; -static guint action_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpEnumAction, gimp_enum_action, GIMP_TYPE_ACTION); +#define parent_class gimp_enum_action_parent_class -GType -gimp_enum_action_get_type (void) -{ - static GType type = 0; +static guint action_signals[LAST_SIGNAL] = { 0 }; - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (GimpEnumActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_enum_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (GimpEnumAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_enum_action_init, - }; - - type = g_type_register_static (GIMP_TYPE_ACTION, - "GimpEnumAction", - &type_info, 0); - } - - return type; -} static void gimp_enum_action_class_init (GimpEnumActionClass *klass) @@ -97,12 +69,10 @@ gimp_enum_action_class_init (GimpEnumActionClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkActionClass *action_class = GTK_ACTION_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_enum_action_set_property; object_class->get_property = gimp_enum_action_get_property; - action_class->activate = gimp_enum_action_activate; + action_class->activate = gimp_enum_action_activate; g_object_class_install_property (object_class, PROP_VALUE, g_param_spec_int ("value", diff --git a/app/widgets/gimperrorconsole.c b/app/widgets/gimperrorconsole.c index 90e4256543..9abca21039 100644 --- a/app/widgets/gimperrorconsole.c +++ b/app/widgets/gimperrorconsole.c @@ -38,9 +38,6 @@ #include "gimp-intl.h" -static void gimp_error_console_class_init (GimpErrorConsoleClass *klass); -static void gimp_error_console_init (GimpErrorConsole *editor); - static GObject * gimp_error_console_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -53,36 +50,10 @@ static gboolean gimp_error_console_button_press (GtkWidget *widget, GimpErrorConsole *console); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpErrorConsole, gimp_error_console, GIMP_TYPE_EDITOR); +#define parent_class gimp_error_console_parent_class -GType -gimp_error_console_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpErrorConsoleClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_error_console_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpErrorConsole), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_error_console_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpErrorConsole", - &view_info, 0); - } - - return view_type; -} static void gimp_error_console_class_init (GimpErrorConsoleClass *klass) @@ -91,8 +62,6 @@ gimp_error_console_class_init (GimpErrorConsoleClass *klass) GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_error_console_constructor; gtk_object_class->destroy = gimp_error_console_destroy; widget_class->unmap = gimp_error_console_unmap; diff --git a/app/widgets/gimperrordialog.c b/app/widgets/gimperrordialog.c index 9f7acb15a5..31882e7e2c 100644 --- a/app/widgets/gimperrordialog.c +++ b/app/widgets/gimperrordialog.c @@ -37,43 +37,15 @@ #define GIMP_ERROR_DIALOG_MAX_MESSAGES 3 -static void gimp_error_dialog_class_init (GimpErrorDialogClass *klass); -static void gimp_error_dialog_init (GimpErrorDialog *dialog); -static void gimp_error_dialog_finalize (GObject *object); -static void gimp_error_dialog_response (GtkDialog *dialog, - gint response_id); +static void gimp_error_dialog_finalize (GObject *object); +static void gimp_error_dialog_response (GtkDialog *dialog, + gint response_id); -static GimpDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpErrorDialog, gimp_error_dialog, GIMP_TYPE_DIALOG); +#define parent_class gimp_error_dialog_parent_class -GType -gimp_error_dialog_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpErrorDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_error_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpErrorDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_error_dialog_init - }; - - dialog_type = g_type_register_static (GIMP_TYPE_DIALOG, - "GimpErrorDialog", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_error_dialog_class_init (GimpErrorDialogClass *klass) @@ -81,8 +53,6 @@ gimp_error_dialog_class_init (GimpErrorDialogClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_error_dialog_finalize; dialog_class->response = gimp_error_dialog_response; diff --git a/app/widgets/gimpfgbgeditor.c b/app/widgets/gimpfgbgeditor.c index 3ea834b39e..559757d17f 100644 --- a/app/widgets/gimpfgbgeditor.c +++ b/app/widgets/gimpfgbgeditor.c @@ -60,9 +60,6 @@ typedef enum } FgBgTarget; -static void gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass); -static void gimp_fg_bg_editor_init (GimpFgBgEditor *editor); - static void gimp_fg_bg_editor_set_property (GObject *object, guint property_id, const GValue *value, @@ -95,38 +92,12 @@ static void gimp_fg_bg_editor_drop_color (GtkWidget *widget, gpointer data); +G_DEFINE_TYPE (GimpFgBgEditor, gimp_fg_bg_editor, GTK_TYPE_DRAWING_AREA); + +#define parent_class gimp_fg_bg_editor_parent_class + static guint editor_signals[LAST_SIGNAL] = { 0 }; -static GtkDrawingAreaClass *parent_class = NULL; - - -GType -gimp_fg_bg_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpFgBgEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_fg_bg_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFgBgEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_fg_bg_editor_init, - }; - - type = g_type_register_static (GTK_TYPE_DRAWING_AREA, - "GimpFgBgEditor", - &info, 0); - } - - return type; -} static void gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass) @@ -135,8 +106,6 @@ gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass) GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_signals[COLOR_CLICKED] = g_signal_new ("color-clicked", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpfgbgview.c b/app/widgets/gimpfgbgview.c index ae3789d3df..7cb721a074 100644 --- a/app/widgets/gimpfgbgview.c +++ b/app/widgets/gimpfgbgview.c @@ -44,53 +44,24 @@ enum }; -static void gimp_fg_bg_view_class_init (GimpFgBgViewClass *klass); -static void gimp_fg_bg_view_init (GimpFgBgView *view); +static void gimp_fg_bg_view_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_fg_bg_view_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static void gimp_fg_bg_view_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_fg_bg_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); - -static void gimp_fg_bg_view_destroy (GtkObject *object); -static gboolean gimp_fg_bg_view_expose (GtkWidget *widget, - GdkEventExpose *eevent); +static void gimp_fg_bg_view_destroy (GtkObject *object); +static gboolean gimp_fg_bg_view_expose (GtkWidget *widget, + GdkEventExpose *eevent); -static GtkDrawingAreaClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFgBgView, gimp_fg_bg_view, GTK_TYPE_DRAWING_AREA); +#define parent_class gimp_fg_bg_view_parent_class -GType -gimp_fg_bg_view_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpFgBgViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_fg_bg_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFgBgView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_fg_bg_view_init, - }; - - type = g_type_register_static (GTK_TYPE_DRAWING_AREA, - "GimpFgBgView", - &info, 0); - } - - return type; -} static void gimp_fg_bg_view_class_init (GimpFgBgViewClass *klass) @@ -99,8 +70,6 @@ gimp_fg_bg_view_class_init (GimpFgBgViewClass *klass) GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_fg_bg_view_set_property; object_class->get_property = gimp_fg_bg_view_get_property; diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c index a4e3bf9b51..b885f2493c 100644 --- a/app/widgets/gimpfiledialog.c +++ b/app/widgets/gimpfiledialog.c @@ -54,8 +54,7 @@ #include "gimp-intl.h" -static void gimp_file_dialog_class_init (GimpFileDialogClass *klass); -static void gimp_file_dialog_progress_iface_init (GimpProgressInterface *progress_iface); +static void gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface); static gboolean gimp_file_dialog_delete_event (GtkWidget *widget, GdkEventAny *event); static void gimp_file_dialog_response (GtkDialog *dialog, @@ -102,43 +101,13 @@ static void gimp_file_dialog_help_clicked (GtkWidget *widget, static gchar * gimp_file_dialog_pattern_from_extension (const gchar *extension); -GType -gimp_file_dialog_get_type (void) -{ - static GType dialog_type = 0; +G_DEFINE_TYPE_WITH_CODE (GimpFileDialog, gimp_file_dialog, + GTK_TYPE_FILE_CHOOSER_DIALOG, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS, + gimp_file_dialog_progress_iface_init)); - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpFileDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_file_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFileDialog), - 0, /* n_preallocs */ - NULL, /* instance_init */ - }; +#define parent_class gimp_file_dialog_parent_class - static const GInterfaceInfo progress_iface_info = - { - (GInterfaceInitFunc) gimp_file_dialog_progress_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - dialog_type = g_type_register_static (GTK_TYPE_FILE_CHOOSER_DIALOG, - "GimpFileDialog", - &dialog_info, 0); - - g_type_add_interface_static (dialog_type, GIMP_TYPE_PROGRESS, - &progress_iface_info); - } - - return dialog_type; -} static void gimp_file_dialog_class_init (GimpFileDialogClass *klass) @@ -152,16 +121,21 @@ gimp_file_dialog_class_init (GimpFileDialogClass *klass) } static void -gimp_file_dialog_progress_iface_init (GimpProgressInterface *progress_iface) +gimp_file_dialog_init (GimpFileDialog *dialog) { - progress_iface->start = gimp_file_dialog_progress_start; - progress_iface->end = gimp_file_dialog_progress_end; - progress_iface->is_active = gimp_file_dialog_progress_is_active; - progress_iface->set_text = gimp_file_dialog_progress_set_text; - progress_iface->set_value = gimp_file_dialog_progress_set_value; - progress_iface->get_value = gimp_file_dialog_progress_get_value; - progress_iface->pulse = gimp_file_dialog_progress_pulse; - progress_iface->get_window = gimp_file_dialog_progress_get_window; +} + +static void +gimp_file_dialog_progress_iface_init (GimpProgressInterface *iface) +{ + iface->start = gimp_file_dialog_progress_start; + iface->end = gimp_file_dialog_progress_end; + iface->is_active = gimp_file_dialog_progress_is_active; + iface->set_text = gimp_file_dialog_progress_set_text; + iface->set_value = gimp_file_dialog_progress_set_value; + iface->get_value = gimp_file_dialog_progress_get_value; + iface->pulse = gimp_file_dialog_progress_pulse; + iface->get_window = gimp_file_dialog_progress_get_window; } static gboolean diff --git a/app/widgets/gimpfileprocview.c b/app/widgets/gimpfileprocview.c index 1e40923e9a..f21da8bfde 100644 --- a/app/widgets/gimpfileprocview.c +++ b/app/widgets/gimpfileprocview.c @@ -56,55 +56,28 @@ enum }; -static void gimp_file_proc_view_class_init (GimpFileProcViewClass *klass); - static void gimp_file_proc_view_finalize (GObject *object); static void gimp_file_proc_view_selection_changed (GtkTreeSelection *selection, GimpFileProcView *view); -static GtkTreeViewClass *parent_class = NULL; -static guint view_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpFileProcView, gimp_file_proc_view, GTK_TYPE_TREE_VIEW); +#define parent_class gimp_file_proc_view_parent_class -GType -gimp_file_proc_view_get_type (void) -{ - static GType view_type = 0; +static guint view_signals[LAST_SIGNAL] = { 0 }; - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpFileProcViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_file_proc_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFileProcView), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - view_type = g_type_register_static (GTK_TYPE_TREE_VIEW, - "GimpFileProcView", - &view_info, 0); - } - - return view_type; -} static void gimp_file_proc_view_class_init (GimpFileProcViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_file_proc_view_finalize; + klass->changed = NULL; + view_signals[CHANGED] = g_signal_new ("changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -113,8 +86,11 @@ gimp_file_proc_view_class_init (GimpFileProcViewClass *klass) NULL, NULL, gimp_marshal_VOID__VOID, G_TYPE_NONE, 0); +} - klass->changed = NULL; +static void +gimp_file_proc_view_init (GimpFileProcView *view) +{ } static void diff --git a/app/widgets/gimpfontselect.c b/app/widgets/gimpfontselect.c index dfe5f6e0db..1231e9fac2 100644 --- a/app/widgets/gimpfontselect.c +++ b/app/widgets/gimpfontselect.c @@ -39,8 +39,6 @@ #include "gimpfontview.h" -static void gimp_font_select_class_init (GimpFontSelectClass *klass); - static GObject * gimp_font_select_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -51,36 +49,10 @@ static Argument * gimp_font_select_run_callback (GimpPdbDialog *dialog, gint *n_return_vals); -static GimpPdbDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFontSelect, gimp_font_select, GIMP_TYPE_PDB_DIALOG); +#define parent_class gimp_font_select_parent_class -GType -gimp_font_select_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpFontSelectClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_font_select_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFontSelect), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - dialog_type = g_type_register_static (GIMP_TYPE_PDB_DIALOG, - "GimpFontSelect", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_font_select_class_init (GimpFontSelectClass *klass) @@ -88,13 +60,16 @@ gimp_font_select_class_init (GimpFontSelectClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpPdbDialogClass *pdb_class = GIMP_PDB_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_font_select_constructor; pdb_class->run_callback = gimp_font_select_run_callback; } +static void +gimp_font_select_init (GimpFontSelect *select) +{ +} + static GObject * gimp_font_select_constructor (GType type, guint n_params, diff --git a/app/widgets/gimpfontview.c b/app/widgets/gimpfontview.c index c3cdb5cfa7..2622a2938e 100644 --- a/app/widgets/gimpfontview.c +++ b/app/widgets/gimpfontview.c @@ -39,51 +39,20 @@ #include "gimp-intl.h" -static void gimp_font_view_class_init (GimpFontViewClass *klass); -static void gimp_font_view_init (GimpFontView *view); - static void gimp_font_view_activate_item (GimpContainerEditor *editor, GimpViewable *viewable); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFontView, gimp_font_view, GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_font_view_parent_class -GType -gimp_font_view_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo view_info = - { - sizeof (GimpFontViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_font_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFontView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_font_view_init, - }; - - type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpFontView", - &view_info, 0); - } - - return type; -} static void gimp_font_view_class_init (GimpFontViewClass *klass) { GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->activate_item = gimp_font_view_activate_item; } diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c index 646876dab6..af67343891 100644 --- a/app/widgets/gimpgradienteditor.c +++ b/app/widgets/gimpgradienteditor.c @@ -103,9 +103,6 @@ /* local function prototypes */ -static void gimp_gradient_editor_class_init (GimpGradientEditorClass *klass); -static void gimp_gradient_editor_init (GimpGradientEditor *editor); - static GObject * gimp_gradient_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -244,36 +241,11 @@ static gboolean seg_in_selection (GimpGradient *grad, static GtkWidget * gradient_hint_label_add (GtkBox *box); -static GimpDataEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpGradientEditor, gimp_gradient_editor, + GIMP_TYPE_DATA_EDITOR); +#define parent_class gimp_gradient_editor_parent_class -GType -gimp_gradient_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpGradientEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_gradient_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpGradientEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_gradient_editor_init, - }; - - type = g_type_register_static (GIMP_TYPE_DATA_EDITOR, - "GimpGradientEditor", - &info, 0); - } - - return type; -} static void gimp_gradient_editor_class_init (GimpGradientEditorClass *klass) @@ -283,8 +255,6 @@ gimp_gradient_editor_class_init (GimpGradientEditorClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_gradient_editor_constructor; gtk_object_class->destroy = gimp_gradient_editor_destroy; diff --git a/app/widgets/gimpgradientselect.c b/app/widgets/gimpgradientselect.c index 327a2e925a..226dfaf113 100644 --- a/app/widgets/gimpgradientselect.c +++ b/app/widgets/gimpgradientselect.c @@ -45,8 +45,6 @@ enum }; -static void gimp_gradient_select_class_init (GimpGradientSelectClass *klass); - static GObject * gimp_gradient_select_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -61,36 +59,11 @@ static Argument * gimp_gradient_select_run_callback (GimpPdbDialog *dialog, gint *n_return_vals); -static GimpPdbDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpGradientSelect, gimp_gradient_select, + GIMP_TYPE_PDB_DIALOG); +#define parent_class gimp_gradient_select_parent_class -GType -gimp_gradient_select_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpGradientSelectClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_gradient_select_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpGradientSelect), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - dialog_type = g_type_register_static (GIMP_TYPE_PDB_DIALOG, - "GimpGradientSelect", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_gradient_select_class_init (GimpGradientSelectClass *klass) @@ -98,8 +71,6 @@ gimp_gradient_select_class_init (GimpGradientSelectClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpPdbDialogClass *pdb_class = GIMP_PDB_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_gradient_select_constructor; object_class->set_property = gimp_gradient_select_set_property; @@ -112,6 +83,11 @@ gimp_gradient_select_class_init (GimpGradientSelectClass *klass) G_PARAM_CONSTRUCT_ONLY)); } +static void +gimp_gradient_select_init (GimpGradientSelect *select) +{ +} + static GObject * gimp_gradient_select_constructor (GType type, guint n_params, diff --git a/app/widgets/gimpgrideditor.c b/app/widgets/gimpgrideditor.c index 86fbee6ad5..deea0e5890 100644 --- a/app/widgets/gimpgrideditor.c +++ b/app/widgets/gimpgrideditor.c @@ -52,7 +52,6 @@ enum }; -static void gimp_grid_editor_class_init (GimpGridEditorClass *klass); static GObject * gimp_grid_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -67,44 +66,16 @@ static void gimp_grid_editor_get_property (GObject *object, static void gimp_grid_editor_finalize (GObject *object); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpGridEditor, gimp_grid_editor, GTK_TYPE_VBOX); +#define parent_class gimp_grid_editor_parent_class -GType -gimp_grid_editor_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpGridEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_grid_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpGridEditor), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - view_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpGridEditor", - &view_info, 0); - } - - return view_type; -} static void gimp_grid_editor_class_init (GimpGridEditorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_grid_editor_constructor; object_class->set_property = gimp_grid_editor_set_property; object_class->get_property = gimp_grid_editor_get_property; @@ -131,6 +102,11 @@ gimp_grid_editor_class_init (GimpGridEditorClass *klass) G_PARAM_CONSTRUCT_ONLY)); } +static void +gimp_grid_editor_init (GimpGridEditor *editor) +{ +} + static void gimp_grid_editor_set_property (GObject *object, guint property_id, diff --git a/app/widgets/gimphistogrambox.c b/app/widgets/gimphistogrambox.c index 27ce4716b2..c574948f35 100644 --- a/app/widgets/gimphistogrambox.c +++ b/app/widgets/gimphistogrambox.c @@ -47,8 +47,6 @@ /* local function prototypes */ -static void gimp_histogram_box_init (GimpHistogramBox *box); - static void gimp_histogram_box_low_adj_update (GtkAdjustment *adj, GimpHistogramBox *box); static void gimp_histogram_box_high_adj_update (GtkAdjustment *adj, @@ -74,32 +72,13 @@ static void gimp_histogram_draw_slider (GtkWidget *widget, GdkGC *fill_gc, gint xpos); -GType -gimp_histogram_box_get_type (void) + +G_DEFINE_TYPE (GimpHistogramBox, gimp_histogram_box, GTK_TYPE_VBOX); + + +static void +gimp_histogram_box_class_init (GimpHistogramBoxClass *klass) { - static GType box_type = 0; - - if (! box_type) - { - static const GTypeInfo box_info = - { - sizeof (GimpHistogramBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpHistogramBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_histogram_box_init, - }; - - box_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpHistogramBox", - &box_info, 0); - } - - return box_type; } static void diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c index a14e9f2339..db529a3660 100644 --- a/app/widgets/gimphistogrameditor.c +++ b/app/widgets/gimphistogrameditor.c @@ -43,9 +43,8 @@ #include "gimp-intl.h" -static void gimp_histogram_editor_class_init (GimpHistogramEditorClass *klass); -static void gimp_histogram_editor_init (GimpHistogramEditor *editor); -static void gimp_histogram_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_histogram_editor_docked_iface_init (GimpDockedInterface *iface); + static void gimp_histogram_editor_set_aux_info (GimpDocked *docked, GList *aux_info); static GList * gimp_histogram_editor_get_aux_info (GimpDocked *docked); @@ -66,53 +65,21 @@ static void gimp_histogram_editor_info_update (GimpHistogramEditor *editor); static gboolean gimp_histogram_view_expose (GimpHistogramEditor *editor); -static GimpImageEditorClass *parent_class = NULL; -static GimpDockedInterface *parent_docked_iface = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpHistogramEditor, gimp_histogram_editor, + GIMP_TYPE_IMAGE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_histogram_editor_docked_iface_init)); +#define parent_class gimp_histogram_editor_parent_class -GType -gimp_histogram_editor_get_type (void) -{ - static GType editor_type = 0; +static GimpDockedInterface *parent_docked_iface = NULL; - if (! editor_type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpHistogramEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_histogram_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpHistogramEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_histogram_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_histogram_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR, - "GimpHistogramEditor", - &editor_info, 0); - g_type_add_interface_static (editor_type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return editor_type; -} static void gimp_histogram_editor_class_init (GimpHistogramEditorClass* klass) { GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - image_editor_class->set_image = gimp_histogram_editor_set_image; } diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c index 86c3f1ccde..64fb560a7b 100644 --- a/app/widgets/gimphistogramview.c +++ b/app/widgets/gimphistogramview.c @@ -50,9 +50,6 @@ enum }; -static void gimp_histogram_view_class_init (GimpHistogramViewClass *klass); -static void gimp_histogram_view_init (GimpHistogramView *view); - static void gimp_histogram_view_set_property (GObject *object, guint property_id, const GValue *value, @@ -83,38 +80,13 @@ static void gimp_histogram_view_draw_spike (GimpHistogramView *view, gint border); +G_DEFINE_TYPE (GimpHistogramView, gimp_histogram_view, + GTK_TYPE_DRAWING_AREA); + +#define parent_class gimp_histogram_view_parent_class + static guint histogram_view_signals[LAST_SIGNAL] = { 0 }; -static GtkDrawingAreaClass *parent_class = NULL; - - -GType -gimp_histogram_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpHistogramViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_histogram_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpHistogramView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_histogram_view_init, - }; - - view_type = g_type_register_static (GTK_TYPE_DRAWING_AREA, - "GimpHistogramView", - &view_info, 0); - } - - return view_type; -} static void gimp_histogram_view_class_init (GimpHistogramViewClass *klass) @@ -122,8 +94,6 @@ gimp_histogram_view_class_init (GimpHistogramViewClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - histogram_view_signals[RANGE_CHANGED] = g_signal_new ("range-changed", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpimagedock.c b/app/widgets/gimpimagedock.c index 00db4e3ea3..b22ae4430a 100644 --- a/app/widgets/gimpimagedock.c +++ b/app/widgets/gimpimagedock.c @@ -37,9 +37,6 @@ #include "gimpuimanager.h" -static void gimp_image_dock_class_init (GimpImageDockClass *klass); -static void gimp_image_dock_init (GimpImageDock *dock); - static GObject * gimp_image_dock_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -57,36 +54,10 @@ static void gimp_image_dock_notify_transient (GimpConfig *config, GimpDock *dock); -static GimpDockClass *parent_class = NULL; +G_DEFINE_TYPE (GimpImageDock, gimp_image_dock, GIMP_TYPE_DOCK); +#define parent_class gimp_image_dock_parent_class -GType -gimp_image_dock_get_type (void) -{ - static GType dock_type = 0; - - if (! dock_type) - { - static const GTypeInfo dock_info = - { - sizeof (GimpImageDockClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_image_dock_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpImageDock), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_image_dock_init, - }; - - dock_type = g_type_register_static (GIMP_TYPE_DOCK, - "GimpImageDock", - &dock_info, 0); - } - - return dock_type; -} static void gimp_image_dock_class_init (GimpImageDockClass *klass) @@ -94,8 +65,6 @@ gimp_image_dock_class_init (GimpImageDockClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_image_dock_constructor; gtk_object_class->destroy = gimp_image_dock_destroy; diff --git a/app/widgets/gimpimageeditor.c b/app/widgets/gimpimageeditor.c index 89db97d31d..fc70f943de 100644 --- a/app/widgets/gimpimageeditor.c +++ b/app/widgets/gimpimageeditor.c @@ -30,9 +30,7 @@ #include "gimpuimanager.h" -static void gimp_image_editor_class_init (GimpImageEditorClass *klass); -static void gimp_image_editor_init (GimpImageEditor *editor); -static void gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_image_editor_docked_iface_init (GimpDockedInterface *iface); static void gimp_image_editor_set_context (GimpDocked *docked, GimpContext *context); @@ -43,53 +41,18 @@ static void gimp_image_editor_image_flush (GimpImage *gimage, GimpImageEditor *editor); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpImageEditor, gimp_image_editor, GIMP_TYPE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_image_editor_docked_iface_init)); +#define parent_class gimp_image_editor_parent_class -GType -gimp_image_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpImageEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_image_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpImageEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_image_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_image_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpImageEditor", - &editor_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} static void gimp_image_editor_class_init (GimpImageEditorClass *klass) { GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->destroy = gimp_image_editor_destroy; klass->set_image = gimp_image_editor_real_set_image; @@ -104,9 +67,9 @@ gimp_image_editor_init (GimpImageEditor *editor) } static void -gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_image_editor_docked_iface_init (GimpDockedInterface *iface) { - docked_iface->set_context = gimp_image_editor_set_context; + iface->set_context = gimp_image_editor_set_context; } static void diff --git a/app/widgets/gimpimagepropview.c b/app/widgets/gimpimagepropview.c index 93c57fab62..58f8aab972 100644 --- a/app/widgets/gimpimagepropview.c +++ b/app/widgets/gimpimagepropview.c @@ -47,9 +47,6 @@ enum }; -static void gimp_image_prop_view_class_init (GimpImagePropViewClass *klass); -static void gimp_image_prop_view_init (GimpImagePropView *view); - static GObject * gimp_image_prop_view_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -72,44 +69,16 @@ static void gimp_image_prop_view_undo_event (GimpImage *gimage, static void gimp_image_prop_view_update (GimpImagePropView *view); -static GtkTableClass *parent_class = NULL; +G_DEFINE_TYPE (GimpImagePropView, gimp_image_prop_view, GTK_TYPE_TABLE); +#define parent_class gimp_image_prop_view_parent_class -GType -gimp_image_prop_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpImagePropViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_image_prop_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpImagePropView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_image_prop_view_init - }; - - view_type = g_type_register_static (GTK_TYPE_TABLE, - "GimpImagePropView", - &view_info, 0); - } - - return view_type; -} static void gimp_image_prop_view_class_init (GimpImagePropViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_image_prop_view_constructor; object_class->set_property = gimp_image_prop_view_set_property; object_class->get_property = gimp_image_prop_view_get_property; diff --git a/app/widgets/gimpimageview.c b/app/widgets/gimpimageview.c index 4207b267c3..7e43df50eb 100644 --- a/app/widgets/gimpimageview.c +++ b/app/widgets/gimpimageview.c @@ -40,51 +40,20 @@ #include "gimp-intl.h" -static void gimp_image_view_class_init (GimpImageViewClass *klass); -static void gimp_image_view_init (GimpImageView *view); - static void gimp_image_view_activate_item (GimpContainerEditor *editor, GimpViewable *viewable); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpImageView, gimp_image_view, GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_image_view_parent_class -GType -gimp_image_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpImageViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_image_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpImageView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_image_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpImageView", - &view_info, 0); - } - - return view_type; -} static void gimp_image_view_class_init (GimpImageViewClass *klass) { GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->activate_item = gimp_image_view_activate_item; } diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c index 81f28d7cf5..d8a3875210 100644 --- a/app/widgets/gimpitemtreeview.c +++ b/app/widgets/gimpitemtreeview.c @@ -62,10 +62,6 @@ enum }; -static void gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass); -static void gimp_item_tree_view_init (GimpItemTreeView *view, - GimpItemTreeViewClass *view_class); - static void gimp_item_tree_view_view_iface_init (GimpContainerViewInterface *view_iface); static void gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface); @@ -149,57 +145,19 @@ static void gimp_item_tree_view_toggle_clicked (GtkCellRendererToggle *togg GimpUndoType undo_type); -static guint view_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE_WITH_CODE (GimpItemTreeView, gimp_item_tree_view, + GIMP_TYPE_CONTAINER_TREE_VIEW, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_item_tree_view_view_iface_init) + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_item_tree_view_docked_iface_init)); + +#define parent_class gimp_item_tree_view_parent_class -static GimpContainerTreeViewClass *parent_class = NULL; static GimpContainerViewInterface *parent_view_iface = NULL; +static guint view_signals[LAST_SIGNAL] = { 0 }; -GType -gimp_item_tree_view_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo view_info = - { - sizeof (GimpItemTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_item_tree_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpItemTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_item_tree_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_item_tree_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_item_tree_view_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_CONTAINER_TREE_VIEW, - "GimpItemTreeView", - &view_info, G_TYPE_FLAG_ABSTRACT); - - g_type_add_interface_static (type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} static void gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass) @@ -208,11 +166,9 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass) GtkObjectClass *gtk_object_class; GimpContainerTreeViewClass *tree_view_class; - object_class = G_OBJECT_CLASS (klass); - gtk_object_class = GTK_OBJECT_CLASS (klass); - tree_view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + object_class = G_OBJECT_CLASS (klass); + gtk_object_class = GTK_OBJECT_CLASS (klass); + tree_view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); view_signals[SET_IMAGE] = g_signal_new ("set-image", @@ -258,8 +214,7 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass) } static void -gimp_item_tree_view_init (GimpItemTreeView *view, - GimpItemTreeViewClass *view_class) +gimp_item_tree_view_init (GimpItemTreeView *view) { GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view); @@ -290,22 +245,22 @@ gimp_item_tree_view_init (GimpItemTreeView *view, } static void -gimp_item_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_item_tree_view_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); - view_iface->set_container = gimp_item_tree_view_set_container; - view_iface->insert_item = gimp_item_tree_view_insert_item; - view_iface->select_item = gimp_item_tree_view_select_item; - view_iface->activate_item = gimp_item_tree_view_activate_item; - view_iface->context_item = gimp_item_tree_view_context_item; + iface->set_container = gimp_item_tree_view_set_container; + iface->insert_item = gimp_item_tree_view_insert_item; + iface->select_item = gimp_item_tree_view_select_item; + iface->activate_item = gimp_item_tree_view_activate_item; + iface->context_item = gimp_item_tree_view_context_item; } static void -gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_item_tree_view_docked_iface_init (GimpDockedInterface *iface) { - docked_iface->get_preview = NULL; - docked_iface->set_context = gimp_item_tree_view_set_context; + iface->get_preview = NULL; + iface->set_context = gimp_item_tree_view_set_context; } static void diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 08768f8276..f5d8452342 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -58,10 +58,7 @@ #include "gimp-intl.h" -static void gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass); -static void gimp_layer_tree_view_init (GimpLayerTreeView *view); - -static void gimp_layer_tree_view_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_layer_tree_view_view_iface_init (GimpContainerViewInterface *iface); static GObject * gimp_layer_tree_view_constructor (GType type, guint n_params, @@ -161,48 +158,16 @@ static void gimp_layer_tree_view_alpha_changed (GimpLayer *layer, GimpLayerTreeView *view); -static GimpDrawableTreeViewClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpLayerTreeView, gimp_layer_tree_view, + GIMP_TYPE_DRAWABLE_TREE_VIEW, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_layer_tree_view_view_iface_init)); + +#define parent_class gimp_layer_tree_view_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; -GType -gimp_layer_tree_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpLayerTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_layer_tree_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpLayerTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_layer_tree_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_layer_tree_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GIMP_TYPE_DRAWABLE_TREE_VIEW, - "GimpLayerTreeView", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass) { @@ -216,8 +181,6 @@ gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass) tree_view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_layer_tree_view_constructor; object_class->finalize = gimp_layer_tree_view_finalize; @@ -365,14 +328,14 @@ gimp_layer_tree_view_init (GimpLayerTreeView *view) } static void -gimp_layer_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_layer_tree_view_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); - view_iface->set_container = gimp_layer_tree_view_set_container; - view_iface->insert_item = gimp_layer_tree_view_insert_item; - view_iface->select_item = gimp_layer_tree_view_select_item; - view_iface->set_preview_size = gimp_layer_tree_view_set_preview_size; + iface->set_container = gimp_layer_tree_view_set_container; + iface->insert_item = gimp_layer_tree_view_insert_item; + iface->select_item = gimp_layer_tree_view_select_item; + iface->set_preview_size = gimp_layer_tree_view_set_preview_size; } static GObject * diff --git a/app/widgets/gimpmenudock.c b/app/widgets/gimpmenudock.c index 21a3b412da..a836e7439c 100644 --- a/app/widgets/gimpmenudock.c +++ b/app/widgets/gimpmenudock.c @@ -52,9 +52,6 @@ #define DEFAULT_MENU_PREVIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR -static void gimp_menu_dock_class_init (GimpMenuDockClass *klass); -static void gimp_menu_dock_init (GimpMenuDock *dock); - static GObject * gimp_menu_dock_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -91,36 +88,10 @@ static void gimp_menu_dock_auto_clicked (GtkWidget *widget, GimpDock *dock); -static GimpDockClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMenuDock, gimp_menu_dock, GIMP_TYPE_IMAGE_DOCK); +#define parent_class gimp_menu_dock_parent_class -GType -gimp_menu_dock_get_type (void) -{ - static GType dock_type = 0; - - if (! dock_type) - { - static const GTypeInfo dock_info = - { - sizeof (GimpMenuDockClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_menu_dock_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMenuDock), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_menu_dock_init, - }; - - dock_type = g_type_register_static (GIMP_TYPE_IMAGE_DOCK, - "GimpMenuDock", - &dock_info, 0); - } - - return dock_type; -} static void gimp_menu_dock_class_init (GimpMenuDockClass *klass) @@ -130,8 +101,6 @@ gimp_menu_dock_class_init (GimpMenuDockClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpDockClass *dock_class = GIMP_DOCK_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_menu_dock_constructor; gtk_object_class->destroy = gimp_menu_dock_destroy; diff --git a/app/widgets/gimpmenufactory.c b/app/widgets/gimpmenufactory.c index c5d8605f89..5de3c78f57 100644 --- a/app/widgets/gimpmenufactory.c +++ b/app/widgets/gimpmenufactory.c @@ -36,50 +36,19 @@ #include "gimpuimanager.h" -static void gimp_menu_factory_class_init (GimpMenuFactoryClass *klass); -static void gimp_menu_factory_init (GimpMenuFactory *factory); - -static void gimp_menu_factory_finalize (GObject *object); +static void gimp_menu_factory_finalize (GObject *object); -static GimpObjectClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMenuFactory, gimp_menu_factory, GIMP_TYPE_OBJECT); +#define parent_class gimp_menu_factory_parent_class -GType -gimp_menu_factory_get_type (void) -{ - static GType factory_type = 0; - - if (! factory_type) - { - static const GTypeInfo factory_info = - { - sizeof (GimpMenuFactoryClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_menu_factory_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMenuFactory), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_menu_factory_init, - }; - - factory_type = g_type_register_static (GIMP_TYPE_OBJECT, - "GimpMenuFactory", - &factory_info, 0); - } - - return factory_type; -} static void gimp_menu_factory_class_init (GimpMenuFactoryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_menu_factory_finalize; } diff --git a/app/widgets/gimpmessagebox.c b/app/widgets/gimpmessagebox.c index 6998acfb3f..8a9f8127d1 100644 --- a/app/widgets/gimpmessagebox.c +++ b/app/widgets/gimpmessagebox.c @@ -42,8 +42,6 @@ enum }; -static void gimp_message_box_class_init (GimpMessageBoxClass *klass); - static GObject * gimp_message_box_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -71,36 +69,10 @@ static void gimp_message_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMessageBox, gimp_message_box, GTK_TYPE_VBOX); +#define parent_class gimp_message_box_parent_class -GType -gimp_message_box_get_type (void) -{ - static GType box_type = 0; - - if (! box_type) - { - static const GTypeInfo box_info = - { - sizeof (GimpMessageBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_message_box_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMessageBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_message_box_init - }; - - box_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpMessageBox", - &box_info, 0); - } - - return box_type; -} static void gimp_message_box_class_init (GimpMessageBoxClass *klass) @@ -110,8 +82,6 @@ gimp_message_box_class_init (GimpMessageBoxClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_message_box_constructor; object_class->set_property = gimp_message_box_set_property; object_class->get_property = gimp_message_box_get_property; diff --git a/app/widgets/gimpmessagedialog.c b/app/widgets/gimpmessagedialog.c index 66c97f0e5f..606e3f0769 100644 --- a/app/widgets/gimpmessagedialog.c +++ b/app/widgets/gimpmessagedialog.c @@ -31,32 +31,17 @@ #include "gimpmessagedialog.h" -GType -gimp_message_dialog_get_type (void) +G_DEFINE_TYPE (GimpMessageDialog, gimp_message_dialog, GIMP_TYPE_DIALOG); + + +static void +gimp_message_dialog_class_init (GimpMessageDialogClass *klass) { - static GType dialog_type = 0; +} - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpMessageDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMessageDialog), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - dialog_type = g_type_register_static (GIMP_TYPE_DIALOG, - "GimpMessageDialog", - &dialog_info, 0); - } - - return dialog_type; +static void +gimp_message_dialog_init (GimpMessageDialog *dialog) +{ } diff --git a/app/widgets/gimpnavigationview.c b/app/widgets/gimpnavigationview.c index 7a06102ccb..2d68d31893 100644 --- a/app/widgets/gimpnavigationview.c +++ b/app/widgets/gimpnavigationview.c @@ -50,9 +50,6 @@ enum }; -static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass); -static void gimp_navigation_view_init (GimpNavigationView *view); - static void gimp_navigation_view_realize (GtkWidget *widget); static void gimp_navigation_view_unrealize (GtkWidget *widget); static void gimp_navigation_view_size_allocate (GtkWidget *widget, @@ -75,46 +72,18 @@ static void gimp_navigation_view_draw_marker (GimpNavigationView *nav_vie GdkRectangle *area); +G_DEFINE_TYPE (GimpNavigationView, gimp_navigation_view, GIMP_TYPE_VIEW); + +#define parent_class gimp_navigation_view_parent_class + static guint view_signals[LAST_SIGNAL] = { 0 }; -static GimpViewClass *parent_class = NULL; - - -GType -gimp_navigation_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpNavigationViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_navigation_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpNavigationView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_navigation_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_VIEW, - "GimpNavigationView", - &view_info, 0); - } - - return view_type; -} static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - view_signals[MARKER_CHANGED] = g_signal_new ("marker-changed", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index 693faef70e..cc2c9fdc5a 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -59,10 +59,7 @@ /* local function prototypes */ -static void gimp_palette_editor_class_init (GimpPaletteEditorClass *klass); -static void gimp_palette_editor_init (GimpPaletteEditor *editor); - -static void gimp_palette_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_palette_editor_docked_iface_init (GimpDockedInterface *face); static GObject * gimp_palette_editor_constructor (GType type, guint n_params, @@ -128,47 +125,16 @@ static void palette_editor_resize (GimpPaletteEditor *editor, static void palette_editor_scroll_top_left (GimpPaletteEditor *editor); -static GimpDataEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpPaletteEditor, gimp_palette_editor, + GIMP_TYPE_DATA_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_palette_editor_docked_iface_init)); + +#define parent_class gimp_palette_editor_parent_class + static GimpDockedInterface *parent_docked_iface = NULL; -GType -gimp_palette_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpPaletteEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_palette_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPaletteEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_palette_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_palette_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_DATA_EDITOR, - "GimpPaletteEditor", - &info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} - static void gimp_palette_editor_class_init (GimpPaletteEditorClass *klass) { @@ -177,8 +143,6 @@ gimp_palette_editor_class_init (GimpPaletteEditorClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_palette_editor_constructor; gtk_object_class->destroy = gimp_palette_editor_destroy; @@ -294,15 +258,15 @@ gimp_palette_editor_init (GimpPaletteEditor *editor) } static void -gimp_palette_editor_docked_iface_init (GimpDockedInterface *docked_iface) +gimp_palette_editor_docked_iface_init (GimpDockedInterface *iface) { - parent_docked_iface = g_type_interface_peek_parent (docked_iface); + parent_docked_iface = g_type_interface_peek_parent (iface); if (! parent_docked_iface) parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED); - docked_iface->set_aux_info = gimp_palette_editor_set_aux_info; - docked_iface->get_aux_info = gimp_palette_editor_get_aux_info; + iface->set_aux_info = gimp_palette_editor_set_aux_info; + iface->get_aux_info = gimp_palette_editor_get_aux_info; } static GObject * diff --git a/app/widgets/gimppaletteselect.c b/app/widgets/gimppaletteselect.c index 253513b7d1..e6e24f352d 100644 --- a/app/widgets/gimppaletteselect.c +++ b/app/widgets/gimppaletteselect.c @@ -38,9 +38,6 @@ #include "gimppaletteselect.h" -static void gimp_palette_select_class_init (GimpPaletteSelectClass *klass); -static void gimp_palette_select_init (GimpPaletteSelect *dialog); - static GObject * gimp_palette_select_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -51,36 +48,10 @@ static Argument * gimp_palette_select_run_callback (GimpPdbDialog *dialog, gint *n_return_vals); -static GimpPdbDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpPaletteSelect, gimp_palette_select, GIMP_TYPE_PDB_DIALOG); +#define parent_class gimp_palette_select_parent_class -GType -gimp_palette_select_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpPaletteSelectClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_palette_select_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPaletteSelect), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_palette_select_init, - }; - - dialog_type = g_type_register_static (GIMP_TYPE_PDB_DIALOG, - "GimpPaletteSelect", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_palette_select_class_init (GimpPaletteSelectClass *klass) @@ -88,8 +59,6 @@ gimp_palette_select_class_init (GimpPaletteSelectClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpPdbDialogClass *pdb_class = GIMP_PDB_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_palette_select_constructor; pdb_class->run_callback = gimp_palette_select_run_callback; diff --git a/app/widgets/gimppaletteview.c b/app/widgets/gimppaletteview.c index 7ac0152de5..008b36aa61 100644 --- a/app/widgets/gimppaletteview.c +++ b/app/widgets/gimppaletteview.c @@ -47,9 +47,6 @@ enum }; -static void gimp_palette_view_class_init (GimpPaletteViewClass *klass); -static void gimp_palette_view_init (GimpPaletteView *view); - static void gimp_palette_view_realize (GtkWidget *widget); static void gimp_palette_view_unrealize (GtkWidget *widget); static gboolean gimp_palette_view_expose (GtkWidget *widget, @@ -83,38 +80,12 @@ static void gimp_palette_view_drop_color (GtkWidget *widget, gpointer data); +G_DEFINE_TYPE (GimpPaletteView, gimp_palette_view, GIMP_TYPE_VIEW); + +#define parent_class gimp_palette_view_parent_class + static guint view_signals[LAST_SIGNAL] = { 0 }; -static GimpViewClass *parent_class = NULL; - - -GType -gimp_palette_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpPaletteViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_palette_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPaletteView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_palette_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_VIEW, - "GimpPaletteView", - &view_info, 0); - } - - return view_type; -} static void gimp_palette_view_class_init (GimpPaletteViewClass *klass) @@ -122,8 +93,6 @@ gimp_palette_view_class_init (GimpPaletteViewClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpViewClass *view_class = GIMP_VIEW_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - view_signals[ENTRY_CLICKED] = g_signal_new ("entry-clicked", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimppatternfactoryview.c b/app/widgets/gimppatternfactoryview.c index e9f006c54a..de82a9e5af 100644 --- a/app/widgets/gimppatternfactoryview.c +++ b/app/widgets/gimppatternfactoryview.c @@ -36,32 +36,18 @@ #include "gimpviewrenderer.h" -GType -gimp_pattern_factory_view_get_type (void) +G_DEFINE_TYPE (GimpPatternFactoryView, gimp_pattern_factory_view, + GIMP_TYPE_DATA_FACTORY_VIEW); + + +static void +gimp_pattern_factory_view_class_init (GimpPatternFactoryViewClass *klass) { - static GType view_type = 0; +} - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpPatternFactoryViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPatternFactoryView), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - view_type = g_type_register_static (GIMP_TYPE_DATA_FACTORY_VIEW, - "GimpPatternFactoryView", - &view_info, 0); - } - - return view_type; +static void +gimp_pattern_factory_view_init (GimpPatternFactoryView *view) +{ } GtkWidget * diff --git a/app/widgets/gimppatternselect.c b/app/widgets/gimppatternselect.c index f94f5c8c4b..a199f00a96 100644 --- a/app/widgets/gimppatternselect.c +++ b/app/widgets/gimppatternselect.c @@ -40,8 +40,6 @@ #include "gimppatternselect.h" -static void gimp_pattern_select_class_init (GimpPatternSelectClass *klass); - static GObject * gimp_pattern_select_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -52,36 +50,10 @@ static Argument * gimp_pattern_select_run_callback (GimpPdbDialog *dialog, gint *n_return_vals); -static GimpPdbDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpPatternSelect, gimp_pattern_select, GIMP_TYPE_PDB_DIALOG); +#define parent_class gimp_pattern_select_parent_class -GType -gimp_pattern_select_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpPatternSelectClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_pattern_select_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPatternSelect), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - dialog_type = g_type_register_static (GIMP_TYPE_PDB_DIALOG, - "GimpPatternSelect", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_pattern_select_class_init (GimpPatternSelectClass *klass) @@ -89,13 +61,16 @@ gimp_pattern_select_class_init (GimpPatternSelectClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpPdbDialogClass *pdb_class = GIMP_PDB_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_pattern_select_constructor; pdb_class->run_callback = gimp_pattern_select_run_callback; } +static void +gimp_pattern_select_init (GimpPatternSelect *select) +{ +} + static GObject * gimp_pattern_select_constructor (GType type, guint n_params, diff --git a/app/widgets/gimppluginaction.c b/app/widgets/gimppluginaction.c index 7d60d00d2a..ab2542cf89 100644 --- a/app/widgets/gimppluginaction.c +++ b/app/widgets/gimppluginaction.c @@ -45,9 +45,6 @@ enum }; -static void gimp_plug_in_action_init (GimpPlugInAction *action); -static void gimp_plug_in_action_class_init (GimpPlugInActionClass *klass); - static void gimp_plug_in_action_set_property (GObject *object, guint prop_id, const GValue *value, @@ -62,37 +59,12 @@ static void gimp_plug_in_action_connect_proxy (GtkAction *action, GtkWidget *proxy); -static GtkActionClass *parent_class = NULL; -static guint action_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpPlugInAction, gimp_plug_in_action, GIMP_TYPE_ACTION); +#define parent_class gimp_plug_in_action_parent_class -GType -gimp_plug_in_action_get_type (void) -{ - static GType type = 0; +static guint action_signals[LAST_SIGNAL] = { 0 }; - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (GimpPlugInActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_plug_in_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (GimpPlugInAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_plug_in_action_init, - }; - - type = g_type_register_static (GIMP_TYPE_ACTION, - "GimpPlugInAction", - &type_info, 0); - } - - return type; -} static void gimp_plug_in_action_class_init (GimpPlugInActionClass *klass) @@ -100,10 +72,8 @@ gimp_plug_in_action_class_init (GimpPlugInActionClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkActionClass *action_class = GTK_ACTION_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - object_class->set_property = gimp_plug_in_action_set_property; - object_class->get_property = gimp_plug_in_action_get_property; + object_class->set_property = gimp_plug_in_action_set_property; + object_class->get_property = gimp_plug_in_action_get_property; action_class->activate = gimp_plug_in_action_activate; action_class->connect_proxy = gimp_plug_in_action_connect_proxy; diff --git a/app/widgets/gimpprogressbox.c b/app/widgets/gimpprogressbox.c index b656bd877d..99e4248271 100644 --- a/app/widgets/gimpprogressbox.c +++ b/app/widgets/gimpprogressbox.c @@ -34,7 +34,7 @@ #include "gimp-intl.h" -static void gimp_progress_box_progress_iface_init (GimpProgressInterface *progress_iface); +static void gimp_progress_box_progress_iface_init (GimpProgressInterface *iface); static GimpProgress * gimp_progress_box_progress_start (GimpProgress *progress, @@ -50,55 +50,31 @@ static gdouble gimp_progress_box_progress_get_value (GimpProgress *progress); static void gimp_progress_box_progress_pulse (GimpProgress *progress); +G_DEFINE_TYPE_WITH_CODE (GimpProgressBox, gimp_progress_box, GTK_TYPE_VBOX, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS, + gimp_progress_box_progress_iface_init)); -GType -gimp_progress_box_get_type (void) + +static void +gimp_progress_box_class_init (GimpProgressBoxClass *klass) { - static GType box_type = 0; - - if (! box_type) - { - static const GTypeInfo box_info = - { - sizeof (GimpProgressBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpProgressBox), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - static const GInterfaceInfo progress_iface_info = - { - (GInterfaceInitFunc) gimp_progress_box_progress_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - box_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpProgressBox", - &box_info, 0); - - g_type_add_interface_static (box_type, GIMP_TYPE_PROGRESS, - &progress_iface_info); - } - - return box_type; } static void -gimp_progress_box_progress_iface_init (GimpProgressInterface *progress_iface) +gimp_progress_box_init (GimpProgressBox *box) { - progress_iface->start = gimp_progress_box_progress_start; - progress_iface->end = gimp_progress_box_progress_end; - progress_iface->is_active = gimp_progress_box_progress_is_active; - progress_iface->set_text = gimp_progress_box_progress_set_text; - progress_iface->set_value = gimp_progress_box_progress_set_value; - progress_iface->get_value = gimp_progress_box_progress_get_value; - progress_iface->pulse = gimp_progress_box_progress_pulse; +} + +static void +gimp_progress_box_progress_iface_init (GimpProgressInterface *iface) +{ + iface->start = gimp_progress_box_progress_start; + iface->end = gimp_progress_box_progress_end; + iface->is_active = gimp_progress_box_progress_is_active; + iface->set_text = gimp_progress_box_progress_set_text; + iface->set_value = gimp_progress_box_progress_set_value; + iface->get_value = gimp_progress_box_progress_get_value; + iface->pulse = gimp_progress_box_progress_pulse; } static GimpProgress * diff --git a/app/widgets/gimpprogressdialog.c b/app/widgets/gimpprogressdialog.c index 7374275bbd..ffb6292bd5 100644 --- a/app/widgets/gimpprogressdialog.c +++ b/app/widgets/gimpprogressdialog.c @@ -35,9 +35,7 @@ #include "gimp-intl.h" -static void gimp_progress_dialog_class_init (GimpProgressDialogClass *klass); -static void gimp_progress_dialog_init (GimpProgressDialog *dialog); -static void gimp_progress_dialog_progress_iface_init (GimpProgressInterface *progress_iface); +static void gimp_progress_dialog_progress_iface_init (GimpProgressInterface *iface); static void gimp_progress_dialog_response (GtkDialog *dialog, gint response_id); @@ -56,54 +54,19 @@ static gdouble gimp_progress_dialog_progress_get_value (GimpProgress *progress) static void gimp_progress_dialog_progress_pulse (GimpProgress *progress); -static GimpDialogClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpProgressDialog, gimp_progress_dialog, + GIMP_TYPE_DIALOG, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS, + gimp_progress_dialog_progress_iface_init)); +#define parent_class gimp_progress_dialog_parent_class -GType -gimp_progress_dialog_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpProgressDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_progress_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpProgressDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_progress_dialog_init, - }; - - static const GInterfaceInfo progress_iface_info = - { - (GInterfaceInitFunc) gimp_progress_dialog_progress_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - dialog_type = g_type_register_static (GIMP_TYPE_DIALOG, - "GimpProgressDialog", - &dialog_info, 0); - - g_type_add_interface_static (dialog_type, GIMP_TYPE_PROGRESS, - &progress_iface_info); - } - - return dialog_type; -} static void gimp_progress_dialog_class_init (GimpProgressDialogClass *klass) { GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - dialog_class->response = gimp_progress_dialog_response; } @@ -125,15 +88,15 @@ gimp_progress_dialog_init (GimpProgressDialog *dialog) } static void -gimp_progress_dialog_progress_iface_init (GimpProgressInterface *progress_iface) +gimp_progress_dialog_progress_iface_init (GimpProgressInterface *iface) { - progress_iface->start = gimp_progress_dialog_progress_start; - progress_iface->end = gimp_progress_dialog_progress_end; - progress_iface->is_active = gimp_progress_dialog_progress_is_active; - progress_iface->set_text = gimp_progress_dialog_progress_set_text; - progress_iface->set_value = gimp_progress_dialog_progress_set_value; - progress_iface->get_value = gimp_progress_dialog_progress_get_value; - progress_iface->pulse = gimp_progress_dialog_progress_pulse; + iface->start = gimp_progress_dialog_progress_start; + iface->end = gimp_progress_dialog_progress_end; + iface->is_active = gimp_progress_dialog_progress_is_active; + iface->set_text = gimp_progress_dialog_progress_set_text; + iface->set_value = gimp_progress_dialog_progress_set_value; + iface->get_value = gimp_progress_dialog_progress_get_value; + iface->pulse = gimp_progress_dialog_progress_pulse; } static void diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c index 6b23e2dfaa..d61207ec6a 100644 --- a/app/widgets/gimpsamplepointeditor.c +++ b/app/widgets/gimpsamplepointeditor.c @@ -47,9 +47,6 @@ enum }; -static void gimp_sample_point_editor_class_init (GimpSamplePointEditorClass *klass); -static void gimp_sample_point_editor_init (GimpSamplePointEditor *editor); - static GObject * gimp_sample_point_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -90,46 +87,19 @@ static void gimp_sample_point_editor_dirty (GimpSamplePointEditor *ed static gboolean gimp_sample_point_editor_update (GimpSamplePointEditor *editor); -static GimpImageEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpSamplePointEditor, gimp_sample_point_editor, + GIMP_TYPE_IMAGE_EDITOR); +#define parent_class gimp_sample_point_editor_parent_class -GType -gimp_sample_point_editor_get_type (void) -{ - static GType editor_type = 0; - - if (! editor_type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpSamplePointEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_sample_point_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpSamplePointEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_sample_point_editor_init, - }; - - editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR, - "GimpSamplePointEditor", - &editor_info, 0); - } - - return editor_type; -} static void -gimp_sample_point_editor_class_init (GimpSamplePointEditorClass* klass) +gimp_sample_point_editor_class_init (GimpSamplePointEditorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_sample_point_editor_constructor; object_class->get_property = gimp_sample_point_editor_get_property; object_class->set_property = gimp_sample_point_editor_set_property; diff --git a/app/widgets/gimpselectioneditor.c b/app/widgets/gimpselectioneditor.c index ae4edbcfc9..172672ac06 100644 --- a/app/widgets/gimpselectioneditor.c +++ b/app/widgets/gimpselectioneditor.c @@ -52,9 +52,6 @@ #include "gimp-intl.h" -static void gimp_selection_editor_class_init (GimpSelectionEditorClass *klass); -static void gimp_selection_editor_init (GimpSelectionEditor *selection_editor); - static GObject * gimp_selection_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -75,36 +72,11 @@ static void gimp_selection_editor_mask_changed (GimpImage *gimage, GimpSelectionEditor *editor); -static GimpImageEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpSelectionEditor, gimp_selection_editor, + GIMP_TYPE_IMAGE_EDITOR); +#define parent_class gimp_selection_editor_parent_class -GType -gimp_selection_editor_get_type (void) -{ - static GType editor_type = 0; - - if (! editor_type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpSelectionEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_selection_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpSelectionEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_selection_editor_init, - }; - - editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR, - "GimpSelectionEditor", - &editor_info, 0); - } - - return editor_type; -} static void gimp_selection_editor_class_init (GimpSelectionEditorClass* klass) @@ -112,8 +84,6 @@ gimp_selection_editor_class_init (GimpSelectionEditorClass* klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_selection_editor_constructor; image_editor_class->set_image = gimp_selection_editor_set_image; diff --git a/app/widgets/gimpsizebox.c b/app/widgets/gimpsizebox.c index 0b96ace752..f313b01b79 100644 --- a/app/widgets/gimpsizebox.c +++ b/app/widgets/gimpsizebox.c @@ -50,8 +50,8 @@ enum }; -#define GIMP_SIZE_BOX_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_SIZE_BOX, GimpSizeBoxPrivate)) +#define GIMP_SIZE_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ + GIMP_TYPE_SIZE_BOX, GimpSizeBoxPrivate)) typedef struct _GimpSizeBoxPrivate GimpSizeBoxPrivate; @@ -65,14 +65,10 @@ struct _GimpSizeBoxPrivate }; -static void gimp_size_box_class_init (GimpSizeBoxClass *klass); - static GObject * gimp_size_box_constructor (GType type, guint n_params, GObjectConstructParam *params); -static void gimp_size_box_init (GimpSizeBox *box); - static void gimp_size_box_set_property (GObject *object, guint property_id, const GValue *value, @@ -88,36 +84,10 @@ static void gimp_size_box_update_size (GimpSizeBox *box); static void gimp_size_box_update_resolution (GimpSizeBox *box); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpSizeBox, gimp_size_box, GTK_TYPE_VBOX); +#define parent_class gimp_size_box_parent_class -GType -gimp_size_box_get_type (void) -{ - static GType box_type = 0; - - if (! box_type) - { - static const GTypeInfo box_info = - { - sizeof (GimpSizeBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_size_box_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpSizeBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_size_box_init - }; - - box_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpSizeBox", - &box_info, 0); - } - - return box_type; -} static void gimp_size_box_class_init (GimpSizeBoxClass *klass) @@ -125,8 +95,6 @@ gimp_size_box_class_init (GimpSizeBoxClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_size_box_constructor; object_class->set_property = gimp_size_box_set_property; object_class->get_property = gimp_size_box_get_property; @@ -308,7 +276,7 @@ gimp_size_box_constructor (GType type, "resolution-unit", entry, NULL, 1.0, 1.0); - } + } else { label = gtk_label_new (NULL); diff --git a/app/widgets/gimpstringaction.c b/app/widgets/gimpstringaction.c index 787b874e6c..8833fd8464 100644 --- a/app/widgets/gimpstringaction.c +++ b/app/widgets/gimpstringaction.c @@ -43,9 +43,6 @@ enum }; -static void gimp_string_action_init (GimpStringAction *action); -static void gimp_string_action_class_init (GimpStringActionClass *klass); - static void gimp_string_action_finalize (GObject *object); static void gimp_string_action_set_property (GObject *object, guint prop_id, @@ -59,37 +56,12 @@ static void gimp_string_action_get_property (GObject *object, static void gimp_string_action_activate (GtkAction *action); -static GtkActionClass *parent_class = NULL; -static guint action_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpStringAction, gimp_string_action, GIMP_TYPE_ACTION); +#define parent_class gimp_string_action_parent_class -GType -gimp_string_action_get_type (void) -{ - static GType type = 0; +static guint action_signals[LAST_SIGNAL] = { 0 }; - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (GimpStringActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_string_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (GimpStringAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_string_action_init, - }; - - type = g_type_register_static (GIMP_TYPE_ACTION, - "GimpStringAction", - &type_info, 0); - } - - return type; -} static void gimp_string_action_class_init (GimpStringActionClass *klass) @@ -97,8 +69,6 @@ gimp_string_action_class_init (GimpStringActionClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkActionClass *action_class = GTK_ACTION_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_string_action_finalize; object_class->set_property = gimp_string_action_set_property; object_class->get_property = gimp_string_action_get_property; diff --git a/app/widgets/gimpstrokeeditor.c b/app/widgets/gimpstrokeeditor.c index cd88ceefee..5075aecc6d 100644 --- a/app/widgets/gimpstrokeeditor.c +++ b/app/widgets/gimpstrokeeditor.c @@ -42,9 +42,9 @@ enum PROP_RESOLUTION }; -static void gimp_stroke_editor_class_init (GimpStrokeEditorClass *klass); -static GObject * gimp_stroke_editor_constructor (GType type, - guint n_params, + +static GObject * gimp_stroke_editor_constructor (GType type, + guint n_params, GObjectConstructParam *params); static void gimp_stroke_editor_set_property (GObject *object, guint property_id, @@ -65,44 +65,16 @@ static void gimp_stroke_editor_combo_fill (GimpStrokeOptions *options, GtkComboBox *box); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpStrokeEditor, gimp_stroke_editor, GTK_TYPE_VBOX); +#define parent_class gimp_stroke_editor_parent_class -GType -gimp_stroke_editor_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpStrokeEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_stroke_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpStrokeEditor), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - view_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpStrokeEditor", - &view_info, 0); - } - - return view_type; -} static void gimp_stroke_editor_class_init (GimpStrokeEditorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_stroke_editor_constructor; object_class->set_property = gimp_stroke_editor_set_property; object_class->get_property = gimp_stroke_editor_get_property; @@ -122,6 +94,11 @@ gimp_stroke_editor_class_init (GimpStrokeEditorClass *klass) G_PARAM_CONSTRUCT_ONLY)); } +static void +gimp_stroke_editor_init (GimpStrokeEditor *editor) +{ +} + static void gimp_stroke_editor_set_property (GObject *object, guint property_id, diff --git a/app/widgets/gimptemplateeditor.c b/app/widgets/gimptemplateeditor.c index df2a895450..2f448eedaf 100644 --- a/app/widgets/gimptemplateeditor.c +++ b/app/widgets/gimptemplateeditor.c @@ -50,21 +50,18 @@ enum }; -static void gimp_template_editor_class_init (GimpTemplateEditorClass *klass); -static GObject * gimp_template_editor_constructor (GType type, - guint n_params, - GObjectConstructParam *params); -static void gimp_template_editor_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_template_editor_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); - -static void gimp_template_editor_finalize (GObject *object); -static void gimp_template_editor_init (GimpTemplateEditor *editor); +static GObject *gimp_template_editor_constructor (GType type, + guint n_params, + GObjectConstructParam *params); +static void gimp_template_editor_finalize (GObject *object); +static void gimp_template_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_template_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); static void gimp_template_editor_aspect_callback (GtkWidget *widget, GimpTemplateEditor *editor); @@ -76,50 +73,20 @@ static void gimp_template_editor_icon_changed (GimpContext *context, GimpTemplateEditor *editor); -static GtkVBoxClass *parent_class = NULL; +G_DEFINE_TYPE (GimpTemplateEditor, gimp_template_editor, GTK_TYPE_VBOX); +#define parent_class gimp_template_editor_parent_class -GType -gimp_template_editor_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpTemplateEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_template_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTemplateEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_template_editor_init - }; - - view_type = g_type_register_static (GTK_TYPE_VBOX, - "GimpTemplateEditor", - &view_info, 0); - } - - return view_type; -} static void gimp_template_editor_class_init (GimpTemplateEditorClass *klass) { - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->constructor = gimp_template_editor_constructor; + object_class->finalize = gimp_template_editor_finalize; object_class->set_property = gimp_template_editor_set_property; object_class->get_property = gimp_template_editor_get_property; - object_class->finalize = gimp_template_editor_finalize; g_object_class_install_property (object_class, PROP_TEMPLATE, g_param_spec_object ("template", NULL, NULL, @@ -134,44 +101,6 @@ gimp_template_editor_init (GimpTemplateEditor *editor) editor->template = NULL; } -static void -gimp_template_editor_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (object); - - switch (property_id) - { - case PROP_TEMPLATE: - editor->template = GIMP_TEMPLATE (g_value_dup_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gimp_template_editor_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (object); - - switch (property_id) - { - case PROP_TEMPLATE: - g_value_set_object (value, editor->template); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - static GObject * gimp_template_editor_constructor (GType type, guint n_params, @@ -497,6 +426,44 @@ gimp_template_editor_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } +static void +gimp_template_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (object); + + switch (property_id) + { + case PROP_TEMPLATE: + editor->template = GIMP_TEMPLATE (g_value_dup_object (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gimp_template_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (object); + + switch (property_id) + { + case PROP_TEMPLATE: + g_value_set_object (value, editor->template); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + GtkWidget * gimp_template_editor_new (GimpTemplate *template, Gimp *gimp, diff --git a/app/widgets/gimptemplateview.c b/app/widgets/gimptemplateview.c index f48f12e1f7..09963dac87 100644 --- a/app/widgets/gimptemplateview.c +++ b/app/widgets/gimptemplateview.c @@ -47,10 +47,7 @@ #include "gimp-intl.h" -static void gimp_template_view_class_init (GimpTemplateViewClass *klass); -static void gimp_template_view_init (GimpTemplateView *view); - -static void gimp_template_view_activate_item (GimpContainerEditor *editor, +static void gimp_template_view_activate_item (GimpContainerEditor *editor, GimpViewable *viewable); static void gimp_template_view_tree_name_edited (GtkCellRendererText *cell, const gchar *path_str, @@ -58,44 +55,17 @@ static void gimp_template_view_tree_name_edited (GtkCellRendererText *cell, GimpTemplateView *view); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpTemplateView, gimp_template_view, + GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_template_view_parent_class -GType -gimp_template_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpTemplateViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_template_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTemplateView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_template_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpTemplateView", - &view_info, 0); - } - - return view_type; -} static void gimp_template_view_class_init (GimpTemplateViewClass *klass) { GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - editor_class->activate_item = gimp_template_view_activate_item; } diff --git a/app/widgets/gimptexteditor.c b/app/widgets/gimptexteditor.c index 1265f54790..8bf5eb4c3a 100644 --- a/app/widgets/gimptexteditor.c +++ b/app/widgets/gimptexteditor.c @@ -45,58 +45,31 @@ enum }; -static void gimp_text_editor_class_init (GimpTextEditorClass *klass); -static void gimp_text_editor_init (GimpTextEditor *editor); +static void gimp_text_editor_finalize (GObject *object); -static void gimp_text_editor_finalize (GObject *object); - -static void gimp_text_editor_text_changed (GtkTextBuffer *buffer, - GimpTextEditor *editor); -static void gimp_text_editor_font_toggled (GtkToggleButton *button, - GimpTextEditor *editor); +static void gimp_text_editor_text_changed (GtkTextBuffer *buffer, + GimpTextEditor *editor); +static void gimp_text_editor_font_toggled (GtkToggleButton *button, + GimpTextEditor *editor); -static GimpDialogClass *parent_class = NULL; -static guint text_editor_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpTextEditor, gimp_text_editor, GIMP_TYPE_DIALOG); +#define parent_class gimp_text_editor_parent_class -GType -gimp_text_editor_get_type (void) -{ - static GType type = 0; +static guint text_editor_signals[LAST_SIGNAL] = { 0 }; - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpTextEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_text_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTextEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_text_editor_init, - }; - - type = g_type_register_static (GIMP_TYPE_DIALOG, - "GimpTextEditor", - &info, 0); - } - - return type; -} static void gimp_text_editor_class_init (GimpTextEditorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_text_editor_finalize; + klass->text_changed = NULL; + klass->dir_changed = NULL; + text_editor_signals[TEXT_CHANGED] = g_signal_new ("text-changed", G_TYPE_FROM_CLASS (klass), @@ -114,9 +87,6 @@ gimp_text_editor_class_init (GimpTextEditorClass *klass) NULL, NULL, gimp_marshal_VOID__VOID, G_TYPE_NONE, 0); - - klass->text_changed = NULL; - klass->dir_changed = NULL; } static void diff --git a/app/widgets/gimpthumbbox.c b/app/widgets/gimpthumbbox.c index 13e4125576..cf69ac8a78 100644 --- a/app/widgets/gimpthumbbox.c +++ b/app/widgets/gimpthumbbox.c @@ -47,15 +47,13 @@ /* local function prototypes */ -static void gimp_thumb_box_class_init (GimpThumbBoxClass *klass); -static void gimp_thumb_box_init (GimpThumbBox *box); -static void gimp_thumb_box_progress_iface_init (GimpProgressInterface *progress_iface); +static void gimp_thumb_box_progress_iface_init (GimpProgressInterface *iface); -static void gimp_thumb_box_dispose (GObject *object); -static void gimp_thumb_box_finalize (GObject *object); +static void gimp_thumb_box_dispose (GObject *object); +static void gimp_thumb_box_finalize (GObject *object); -static void gimp_thumb_box_style_set (GtkWidget *widget, - GtkStyle *prev_style); +static void gimp_thumb_box_style_set (GtkWidget *widget, + GtkStyle *prev_style); static GimpProgress * gimp_thumb_box_progress_start (GimpProgress *progress, @@ -93,57 +91,19 @@ static void gimp_thumb_box_create_thumbnail (GimpThumbBox *box, static gboolean gimp_thumb_box_auto_thumbnail (GimpThumbBox *box); -/* private variables */ +G_DEFINE_TYPE_WITH_CODE (GimpThumbBox, gimp_thumb_box, GTK_TYPE_FRAME, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS, + gimp_thumb_box_progress_iface_init)); -static GtkFrameClass *parent_class = NULL; +#define parent_class gimp_thumb_box_parent_class -GType -gimp_thumb_box_get_type (void) -{ - static GType box_type = 0; - - if (! box_type) - { - static const GTypeInfo box_info = - { - sizeof (GimpThumbBoxClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_thumb_box_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpThumbBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_thumb_box_init, - }; - - static const GInterfaceInfo progress_iface_info = - { - (GInterfaceInitFunc) gimp_thumb_box_progress_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - box_type = g_type_register_static (GTK_TYPE_FRAME, - "GimpThumbBox", - &box_info, 0); - - g_type_add_interface_static (box_type, GIMP_TYPE_PROGRESS, - &progress_iface_info); - } - - return box_type; -} - static void gimp_thumb_box_class_init (GimpThumbBoxClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = gimp_thumb_box_dispose; object_class->finalize = gimp_thumb_box_finalize; @@ -159,15 +119,15 @@ gimp_thumb_box_init (GimpThumbBox *box) } static void -gimp_thumb_box_progress_iface_init (GimpProgressInterface *progress_iface) +gimp_thumb_box_progress_iface_init (GimpProgressInterface *iface) { - progress_iface->start = gimp_thumb_box_progress_start; - progress_iface->end = gimp_thumb_box_progress_end; - progress_iface->is_active = gimp_thumb_box_progress_is_active; - progress_iface->set_value = gimp_thumb_box_progress_set_value; - progress_iface->get_value = gimp_thumb_box_progress_get_value; - progress_iface->pulse = gimp_thumb_box_progress_pulse; - progress_iface->message = gimp_thumb_box_progress_message; + iface->start = gimp_thumb_box_progress_start; + iface->end = gimp_thumb_box_progress_end; + iface->is_active = gimp_thumb_box_progress_is_active; + iface->set_value = gimp_thumb_box_progress_set_value; + iface->get_value = gimp_thumb_box_progress_get_value; + iface->pulse = gimp_thumb_box_progress_pulse; + iface->message = gimp_thumb_box_progress_message; } static void diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index ae6e3e9a4c..2a84201760 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -62,9 +62,6 @@ /* local function prototypes */ -static void gimp_toolbox_class_init (GimpToolboxClass *klass); -static void gimp_toolbox_init (GimpToolbox *toolbox); - static GObject * gimp_toolbox_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -122,39 +119,11 @@ static void toolbox_paste_received (GtkClipboard *clipboard, gpointer data); -/* local variables */ +G_DEFINE_TYPE (GimpToolbox, gimp_toolbox, GIMP_TYPE_IMAGE_DOCK); -static GimpImageDockClass *parent_class = NULL; +#define parent_class gimp_toolbox_parent_class -GType -gimp_toolbox_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo type_info = - { - sizeof (GimpToolboxClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_toolbox_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpToolbox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_toolbox_init, - }; - - type = g_type_register_static (GIMP_TYPE_IMAGE_DOCK, - "GimpToolbox", - &type_info, 0); - } - - return type; -} - static void gimp_toolbox_class_init (GimpToolboxClass *klass) { @@ -163,8 +132,6 @@ gimp_toolbox_class_init (GimpToolboxClass *klass) GimpDockClass *dock_class = GIMP_DOCK_CLASS (klass); GimpImageDockClass *image_dock_class = GIMP_IMAGE_DOCK_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_toolbox_constructor; widget_class->delete_event = gimp_toolbox_delete_event; diff --git a/app/widgets/gimptooldialog.c b/app/widgets/gimptooldialog.c index b16279c389..c92ef514be 100644 --- a/app/widgets/gimptooldialog.c +++ b/app/widgets/gimptooldialog.c @@ -34,32 +34,17 @@ #include "gimptooldialog.h" -GType -gimp_tool_dialog_get_type (void) +G_DEFINE_TYPE (GimpToolDialog, gimp_tool_dialog, GIMP_TYPE_VIEWABLE_DIALOG); + + +static void +gimp_tool_dialog_class_init (GimpToolDialogClass *klass) { - static GType dialog_type = 0; +} - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpToolDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpToolDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - dialog_type = g_type_register_static (GIMP_TYPE_VIEWABLE_DIALOG, - "GimpToolDialog", - &dialog_info, 0); - } - - return dialog_type; +static void +gimp_tool_dialog_init (GimpToolDialog *dialog) +{ } diff --git a/app/widgets/gimptooloptionseditor.c b/app/widgets/gimptooloptionseditor.c index 8061379141..a3c099065d 100644 --- a/app/widgets/gimptooloptionseditor.c +++ b/app/widgets/gimptooloptionseditor.c @@ -47,9 +47,7 @@ #include "gimp-intl.h" -static void gimp_tool_options_editor_class_init (GimpToolOptionsEditorClass *klass); -static void gimp_tool_options_editor_init (GimpToolOptionsEditor *editor); -static void gimp_tool_options_editor_docked_iface_init (GimpDockedInterface *docked_iface); +static void gimp_tool_options_editor_docked_iface_init (GimpDockedInterface *iface); static GObject * gimp_tool_options_editor_constructor (GType type, guint n_params, @@ -83,45 +81,13 @@ static void gimp_tool_options_editor_presets_changed (GimpContainer *c GimpToolOptionsEditor *editor); -static GimpEditorClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpToolOptionsEditor, gimp_tool_options_editor, + GIMP_TYPE_EDITOR, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED, + gimp_tool_options_editor_docked_iface_init)); +#define parent_class gimp_tool_options_editor_parent_class -GType -gimp_tool_options_editor_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpToolOptionsEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_tool_options_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_tool */ - sizeof (GimpToolOptionsEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_tool_options_editor_init, - }; - static const GInterfaceInfo docked_iface_info = - { - (GInterfaceInitFunc) gimp_tool_options_editor_docked_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_EDITOR, - "GimpToolOptionsEditor", - &editor_info, 0); - - g_type_add_interface_static (type, GIMP_TYPE_DOCKED, - &docked_iface_info); - } - - return type; -} static void gimp_tool_options_editor_class_init (GimpToolOptionsEditorClass *klass) @@ -129,8 +95,6 @@ gimp_tool_options_editor_class_init (GimpToolOptionsEditorClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_tool_options_editor_constructor; gtk_object_class->destroy = gimp_tool_options_editor_destroy; diff --git a/app/widgets/gimptoolview.c b/app/widgets/gimptoolview.c index 08173e203b..907207000c 100644 --- a/app/widgets/gimptoolview.c +++ b/app/widgets/gimptoolview.c @@ -43,9 +43,6 @@ #include "gimp-intl.h" -static void gimp_tool_view_class_init (GimpToolViewClass *klass); -static void gimp_tool_view_init (GimpToolView *view); - static void gimp_tool_view_destroy (GtkObject *object); static void gimp_tool_view_select_item (GimpContainerEditor *editor, @@ -67,36 +64,10 @@ static void gimp_tool_view_eye_clicked (GtkCellRendererToggle *toggle, GimpContainerTreeView *tree_view); -static GimpContainerEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpToolView, gimp_tool_view, GIMP_TYPE_CONTAINER_EDITOR); +#define parent_class gimp_tool_view_parent_class -GType -gimp_tool_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpToolViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_tool_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpToolView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_tool_view_init, - }; - - view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR, - "GimpToolView", - &view_info, 0); - } - - return view_type; -} static void gimp_tool_view_class_init (GimpToolViewClass *klass) @@ -104,8 +75,6 @@ gimp_tool_view_class_init (GimpToolViewClass *klass) GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->destroy = gimp_tool_view_destroy; editor_class->select_item = gimp_tool_view_select_item; diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c index 2837de1dc3..c7491ab372 100644 --- a/app/widgets/gimpuimanager.c +++ b/app/widgets/gimpuimanager.c @@ -56,9 +56,6 @@ enum }; -static void gimp_ui_manager_init (GimpUIManager *manager); -static void gimp_ui_manager_class_init (GimpUIManagerClass *klass); - static GObject * gimp_ui_manager_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -109,38 +106,12 @@ static gboolean gimp_ui_manager_item_key_press (GtkWidget *widget, GimpUIManager *manager); +G_DEFINE_TYPE (GimpUIManager, gimp_ui_manager, GTK_TYPE_UI_MANAGER); + +#define parent_class gimp_ui_manager_parent_class + static guint manager_signals[LAST_SIGNAL] = { 0 }; -static GtkUIManagerClass *parent_class = NULL; - - -GType -gimp_ui_manager_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (GimpUIManagerClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_ui_manager_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpUIManager), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_ui_manager_init, - }; - - type = g_type_register_static (GTK_TYPE_UI_MANAGER, - "GimpUIManager", - &type_info, 0); - } - - return type; -} static void gimp_ui_manager_class_init (GimpUIManagerClass *klass) @@ -148,8 +119,6 @@ gimp_ui_manager_class_init (GimpUIManagerClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkUIManagerClass *manager_class = GTK_UI_MANAGER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_ui_manager_constructor; object_class->dispose = gimp_ui_manager_dispose; object_class->finalize = gimp_ui_manager_finalize; diff --git a/app/widgets/gimpundoeditor.c b/app/widgets/gimpundoeditor.c index b48bfcef78..2cfbf8ed46 100644 --- a/app/widgets/gimpundoeditor.c +++ b/app/widgets/gimpundoeditor.c @@ -48,8 +48,6 @@ enum }; -static void gimp_undo_editor_class_init (GimpUndoEditorClass *klass); -static void gimp_undo_editor_init (GimpUndoEditor *undo_editor); static GObject * gimp_undo_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -75,36 +73,10 @@ static void gimp_undo_editor_select_item (GimpContainerView *view, GimpUndoEditor *editor); -static GimpImageEditorClass *parent_class = NULL; +G_DEFINE_TYPE (GimpUndoEditor, gimp_undo_editor, GIMP_TYPE_IMAGE_EDITOR); +#define parent_class gimp_undo_editor_parent_class -GType -gimp_undo_editor_get_type (void) -{ - static GType editor_type = 0; - - if (! editor_type) - { - static const GTypeInfo editor_info = - { - sizeof (GimpUndoEditorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_undo_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpUndoEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_undo_editor_init, - }; - - editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR, - "GimpUndoEditor", - &editor_info, 0); - } - - return editor_type; -} static void gimp_undo_editor_class_init (GimpUndoEditorClass *klass) @@ -112,8 +84,6 @@ gimp_undo_editor_class_init (GimpUndoEditorClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_undo_editor_constructor; object_class->set_property = gimp_undo_editor_set_property; diff --git a/app/widgets/gimpunitcombobox.c b/app/widgets/gimpunitcombobox.c index 11e66ddbd1..701e3948cd 100644 --- a/app/widgets/gimpunitcombobox.c +++ b/app/widgets/gimpunitcombobox.c @@ -29,35 +29,14 @@ #include "gimpunitstore.h" -static void gimp_unit_combo_box_init (GimpUnitComboBox *combo); +G_DEFINE_TYPE (GimpUnitComboBox, gimp_unit_combo_box, GTK_TYPE_COMBO_BOX); + +#define parent_class gimp_unit_combo_box_parent_class -GType -gimp_unit_combo_box_get_type (void) +static void +gimp_unit_combo_box_class_init (GimpUnitComboBoxClass *klass) { - static GType combo_box_type = 0; - - if (!combo_box_type) - { - static const GTypeInfo combo_box_info = - { - sizeof (GimpUnitComboBoxClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpUnitComboBox), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_unit_combo_box_init - }; - - combo_box_type = g_type_register_static (GTK_TYPE_COMBO_BOX, - "GimpUnitComboBox", - &combo_box_info, 0); - } - - return combo_box_type; } static void diff --git a/app/widgets/gimpunitstore.c b/app/widgets/gimpunitstore.c index 095a6a6bd6..896520f3d7 100644 --- a/app/widgets/gimpunitstore.c +++ b/app/widgets/gimpunitstore.c @@ -37,20 +37,8 @@ enum PROP_NUM_VALUES }; -static GType column_types[GIMP_UNIT_STORE_UNIT_COLUMNS] = -{ - G_TYPE_INVALID, - G_TYPE_DOUBLE, - G_TYPE_INT, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING -}; -static void gimp_unit_store_class_init (GimpUnitStoreClass *klass); -static void gimp_unit_store_tree_model_init (GtkTreeModelIface *iface); +static void gimp_unit_store_tree_model_init (GtkTreeModelIface *iface); static void gimp_unit_store_finalize (GObject *object); static void gimp_unit_store_set_property (GObject *object, @@ -93,47 +81,25 @@ static gboolean gimp_unit_store_iter_parent (GtkTreeModel *tree_model, GtkTreeIter *child); -static GObjectClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpUnitStore, gimp_unit_store, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, + gimp_unit_store_tree_model_init)); + +#define parent_class gimp_unit_store_parent_class -GType -gimp_unit_store_get_type (void) +static GType column_types[GIMP_UNIT_STORE_UNIT_COLUMNS] = { - static GType store_type = 0; + G_TYPE_INVALID, + G_TYPE_DOUBLE, + G_TYPE_INT, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING +}; - if (!store_type) - { - static const GTypeInfo store_info = - { - sizeof (GimpUnitStoreClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_unit_store_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpUnitStore), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - static const GInterfaceInfo tree_model_info = - { - (GInterfaceInitFunc) gimp_unit_store_tree_model_init, - NULL, - NULL - }; - - store_type = g_type_register_static (G_TYPE_OBJECT, - "GimpUnitStore", - &store_info, 0); - - g_type_add_interface_static (store_type, - GTK_TYPE_TREE_MODEL, - &tree_model_info); - } - - return store_type; -} static void gimp_unit_store_class_init (GimpUnitStoreClass *klass) @@ -142,8 +108,6 @@ gimp_unit_store_class_init (GimpUnitStoreClass *klass) column_types[GIMP_UNIT_STORE_UNIT] = GIMP_TYPE_UNIT; - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_unit_store_finalize; object_class->set_property = gimp_unit_store_set_property; object_class->get_property = gimp_unit_store_get_property; @@ -156,6 +120,11 @@ gimp_unit_store_class_init (GimpUnitStoreClass *klass) G_PARAM_CONSTRUCT_ONLY)); } +static void +gimp_unit_store_init (GimpUnitStore *store) +{ +} + static void gimp_unit_store_tree_model_init (GtkTreeModelIface *iface) { diff --git a/app/widgets/gimpvectorstreeview.c b/app/widgets/gimpvectorstreeview.c index ecd5bcd063..5692950f21 100644 --- a/app/widgets/gimpvectorstreeview.c +++ b/app/widgets/gimpvectorstreeview.c @@ -46,10 +46,7 @@ #include "gimp-intl.h" -static void gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass); -static void gimp_vectors_tree_view_init (GimpVectorsTreeView *view); - -static void gimp_vectors_tree_view_view_iface_init (GimpContainerViewInterface *view_iface); +static void gimp_vectors_tree_view_view_iface_init (GimpContainerViewInterface *iface); static GObject * gimp_vectors_tree_view_constructor (GType type, guint n_params, @@ -67,88 +64,50 @@ static guchar * gimp_vectors_tree_view_drag_svg (GtkWidget *wi gpointer data); -static GimpItemTreeViewClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpVectorsTreeView, gimp_vectors_tree_view, + GIMP_TYPE_ITEM_TREE_VIEW, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, + gimp_vectors_tree_view_view_iface_init)); + +#define parent_class gimp_vectors_tree_view_parent_class + static GimpContainerViewInterface *parent_view_iface = NULL; -GType -gimp_vectors_tree_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpVectorsTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_vectors_tree_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpVectorsTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_vectors_tree_view_init, - }; - - static const GInterfaceInfo view_iface_info = - { - (GInterfaceInitFunc) gimp_vectors_tree_view_view_iface_init, - NULL, /* iface_finalize */ - NULL /* iface_data */ - }; - - view_type = g_type_register_static (GIMP_TYPE_ITEM_TREE_VIEW, - "GimpVectorsTreeView", - &view_info, 0); - - g_type_add_interface_static (view_type, GIMP_TYPE_CONTAINER_VIEW, - &view_iface_info); - } - - return view_type; -} - static void gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass) { - GObjectClass *object_class; - GimpContainerTreeViewClass *view_class; - GimpItemTreeViewClass *item_view_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpContainerTreeViewClass *view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); + GimpItemTreeViewClass *iv_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - view_class = GIMP_CONTAINER_TREE_VIEW_CLASS (klass); - item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass); + object_class->constructor = gimp_vectors_tree_view_constructor; - parent_class = g_type_class_peek_parent (klass); + view_class->drop_svg = gimp_vectors_tree_view_drop_svg; - object_class->constructor = gimp_vectors_tree_view_constructor; + iv_class->item_type = GIMP_TYPE_VECTORS; + iv_class->signal_name = "active-vectors-changed"; - view_class->drop_svg = gimp_vectors_tree_view_drop_svg; + iv_class->get_container = gimp_image_get_vectors; + iv_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_vectors; + iv_class->set_active_item = (GimpSetItemFunc) gimp_image_set_active_vectors; + iv_class->reorder_item = (GimpReorderItemFunc) gimp_image_position_vectors; + iv_class->add_item = (GimpAddItemFunc) gimp_image_add_vectors; + iv_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_vectors; + iv_class->new_item = gimp_vectors_tree_view_item_new; - item_view_class->item_type = GIMP_TYPE_VECTORS; - item_view_class->signal_name = "active-vectors-changed"; - - item_view_class->get_container = gimp_image_get_vectors; - item_view_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_vectors; - item_view_class->set_active_item = (GimpSetItemFunc) gimp_image_set_active_vectors; - item_view_class->reorder_item = (GimpReorderItemFunc) gimp_image_position_vectors; - item_view_class->add_item = (GimpAddItemFunc) gimp_image_add_vectors; - item_view_class->remove_item = (GimpRemoveItemFunc) gimp_image_remove_vectors; - item_view_class->new_item = gimp_vectors_tree_view_item_new; - - item_view_class->action_group = "vectors"; - item_view_class->activate_action = "vectors-path-tool"; - item_view_class->edit_action = "vectors-edit-attributes"; - item_view_class->new_action = "vectors-new"; - item_view_class->new_default_action = "vectors-new-last-values"; - item_view_class->raise_action = "vectors-raise"; - item_view_class->raise_top_action = "vectors-raise-to-top"; - item_view_class->lower_action = "vectors-lower"; - item_view_class->lower_bottom_action = "vectors-lower-to-bottom"; - item_view_class->duplicate_action = "vectors-duplicate"; - item_view_class->delete_action = "vectors-delete"; - item_view_class->reorder_desc = _("Reorder path"); + iv_class->action_group = "vectors"; + iv_class->activate_action = "vectors-path-tool"; + iv_class->edit_action = "vectors-edit-attributes"; + iv_class->new_action = "vectors-new"; + iv_class->new_default_action = "vectors-new-last-values"; + iv_class->raise_action = "vectors-raise"; + iv_class->raise_top_action = "vectors-raise-to-top"; + iv_class->lower_action = "vectors-lower"; + iv_class->lower_bottom_action = "vectors-lower-to-bottom"; + iv_class->duplicate_action = "vectors-duplicate"; + iv_class->delete_action = "vectors-delete"; + iv_class->reorder_desc = _("Reorder path"); } static void @@ -157,11 +116,11 @@ gimp_vectors_tree_view_init (GimpVectorsTreeView *view) } static void -gimp_vectors_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) +gimp_vectors_tree_view_view_iface_init (GimpContainerViewInterface *iface) { - parent_view_iface = g_type_interface_peek_parent (view_iface); + parent_view_iface = g_type_interface_peek_parent (iface); - view_iface->set_container = gimp_vectors_tree_view_set_container; + iface->set_container = gimp_vectors_tree_view_set_container; } static GObject * diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c index 83871a04ac..f4b766ed08 100644 --- a/app/widgets/gimpview.c +++ b/app/widgets/gimpview.c @@ -58,9 +58,6 @@ enum }; -static void gimp_view_class_init (GimpViewClass *klass); -static void gimp_view_init (GimpView *view); - static void gimp_view_destroy (GtkObject *object); static void gimp_view_realize (GtkWidget *widget); static void gimp_view_unrealize (GtkWidget *widget); @@ -94,39 +91,12 @@ static GdkPixbuf * gimp_view_drag_pixbuf (GtkWidget *widget, gpointer data); +G_DEFINE_TYPE (GimpView, gimp_view, GTK_TYPE_WIDGET); + +#define parent_class gimp_view_parent_class static guint view_signals[LAST_SIGNAL] = { 0 }; -static GtkWidgetClass *parent_class = NULL; - - -GType -gimp_view_get_type (void) -{ - static GType view_type = 0; - - if (! view_type) - { - static const GTypeInfo view_info = - { - sizeof (GimpViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_init, - }; - - view_type = g_type_register_static (GTK_TYPE_WIDGET, - "GimpView", - &view_info, 0); - } - - return view_type; -} static void gimp_view_class_init (GimpViewClass *klass) @@ -134,8 +104,6 @@ gimp_view_class_init (GimpViewClass *klass) GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - view_signals[SET_VIEWABLE] = g_signal_new ("set-viewable", G_TYPE_FROM_CLASS (klass), diff --git a/app/widgets/gimpviewablebutton.c b/app/widgets/gimpviewablebutton.c index 3105d00ddd..7b79a32e35 100644 --- a/app/widgets/gimpviewablebutton.c +++ b/app/widgets/gimpviewablebutton.c @@ -48,9 +48,6 @@ enum }; -static void gimp_viewable_button_class_init (GimpViewableButtonClass *klass); -static void gimp_viewable_button_init (GimpViewableButton *button); - static void gimp_viewable_button_finalize (GObject *object); static void gimp_viewable_button_set_property (GObject *object, guint property_id, @@ -68,36 +65,10 @@ static void gimp_viewable_button_popup_closed (GimpContainerPopup *popup, GimpViewableButton *button); -static GimpButtonClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewableButton, gimp_viewable_button, GIMP_TYPE_BUTTON); +#define parent_class gimp_viewable_button_parent_class -GType -gimp_viewable_button_get_type (void) -{ - static GType button_type = 0; - - if (!button_type) - { - static const GTypeInfo button_info = - { - sizeof (GimpViewableButtonClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_viewable_button_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewableButton), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_viewable_button_init, - }; - - button_type = g_type_register_static (GIMP_TYPE_BUTTON, - "GimpViewableButton", - &button_info, 0); - } - - return button_type; -} static void gimp_viewable_button_class_init (GimpViewableButtonClass *klass) @@ -106,8 +77,6 @@ gimp_viewable_button_class_init (GimpViewableButtonClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_viewable_button_finalize; object_class->get_property = gimp_viewable_button_get_property; object_class->set_property = gimp_viewable_button_set_property; diff --git a/app/widgets/gimpviewabledialog.c b/app/widgets/gimpviewabledialog.c index 25683e67ff..43969717d6 100644 --- a/app/widgets/gimpviewabledialog.c +++ b/app/widgets/gimpviewabledialog.c @@ -45,9 +45,6 @@ enum }; -static void gimp_viewable_dialog_class_init (GimpViewableDialogClass *klass); -static void gimp_viewable_dialog_init (GimpViewableDialog *dialog); - static void gimp_viewable_dialog_set_property (GObject *object, guint property_id, const GValue *value, @@ -60,49 +57,18 @@ static void gimp_viewable_dialog_name_changed (GimpObject *object, static void gimp_viewable_dialog_close (GimpViewableDialog *dialog); -static GimpDialogClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewableDialog, gimp_viewable_dialog, GIMP_TYPE_DIALOG); +#define parent_class gimp_viewable_dialog_parent_class -GType -gimp_viewable_dialog_get_type (void) -{ - static GType dialog_type = 0; - - if (! dialog_type) - { - static const GTypeInfo dialog_info = - { - sizeof (GimpViewableDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_viewable_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewableDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_viewable_dialog_init, - }; - - dialog_type = g_type_register_static (GIMP_TYPE_DIALOG, - "GimpViewableDialog", - &dialog_info, 0); - } - - return dialog_type; -} static void gimp_viewable_dialog_class_init (GimpViewableDialogClass *klass) { - GtkObjectClass *gtk_object_class; - GObjectClass *object_class; + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - gtk_object_class = GTK_OBJECT_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - gtk_object_class->destroy = gimp_viewable_dialog_destroy; + gtk_object_class->destroy = gimp_viewable_dialog_destroy; object_class->set_property = gimp_viewable_dialog_set_property; diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c index 1a9085b980..7531288a1e 100644 --- a/app/widgets/gimpviewrenderer.c +++ b/app/widgets/gimpviewrenderer.c @@ -50,10 +50,6 @@ enum }; -static void gimp_view_renderer_class_init (GimpViewRendererClass *klass); - -static void gimp_view_renderer_init (GimpViewRenderer *renderer); - static void gimp_view_renderer_dispose (GObject *object); static void gimp_view_renderer_finalize (GObject *object); @@ -73,9 +69,11 @@ static GdkGC * gimp_view_renderer_create_gc (GimpViewRenderer *renderer, GtkWidget *widget); -static guint renderer_signals[LAST_SIGNAL] = { 0 }; +G_DEFINE_TYPE (GimpViewRenderer, gimp_view_renderer, G_TYPE_OBJECT); -static GObjectClass *parent_class = NULL; +#define parent_class gimp_view_renderer_parent_class + +static guint renderer_signals[LAST_SIGNAL] = { 0 }; static GimpRGB black_color; static GimpRGB white_color; @@ -83,41 +81,11 @@ static GimpRGB green_color; static GimpRGB red_color; -GType -gimp_view_renderer_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRenderer), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_renderer_init, - }; - - renderer_type = g_type_register_static (G_TYPE_OBJECT, - "GimpViewRenderer", - &renderer_info, 0); - } - - return renderer_type; -} - static void gimp_view_renderer_class_init (GimpViewRendererClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_signals[UPDATE] = g_signal_new ("update", G_TYPE_FROM_CLASS (klass), @@ -133,43 +101,43 @@ gimp_view_renderer_class_init (GimpViewRendererClass *klass) klass->draw = gimp_view_renderer_real_draw; klass->render = gimp_view_renderer_real_render; + klass->frame = NULL; + klass->frame_left = 0; + klass->frame_right = 0; + klass->frame_top = 0; + klass->frame_bottom = 0; + gimp_rgba_set (&black_color, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE); gimp_rgba_set (&white_color, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE); gimp_rgba_set (&green_color, 0.0, 0.94, 0.0, GIMP_OPACITY_OPAQUE); gimp_rgba_set (&red_color, 1.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE); - - klass->frame = NULL; - klass->frame_left = 0; - klass->frame_right = 0; - klass->frame_top = 0; - klass->frame_bottom = 0; } static void gimp_view_renderer_init (GimpViewRenderer *renderer) { - renderer->viewable = NULL; + renderer->viewable = NULL; - renderer->width = 8; - renderer->height = 8; - renderer->border_width = 0; - renderer->dot_for_dot = TRUE; - renderer->is_popup = FALSE; + renderer->width = 8; + renderer->height = 8; + renderer->border_width = 0; + renderer->dot_for_dot = TRUE; + renderer->is_popup = FALSE; - renderer->border_type = GIMP_VIEW_BORDER_BLACK; - renderer->border_color = black_color; - renderer->gc = NULL; + renderer->border_type = GIMP_VIEW_BORDER_BLACK; + renderer->border_color = black_color; + renderer->gc = NULL; - renderer->buffer = NULL; - renderer->rowstride = 0; - renderer->bytes = 3; + renderer->buffer = NULL; + renderer->rowstride = 0; + renderer->bytes = 3; - renderer->pixbuf = NULL; - renderer->bg_stock_id = NULL; + renderer->pixbuf = NULL; + renderer->bg_stock_id = NULL; - renderer->size = -1; - renderer->needs_render = TRUE; - renderer->idle_id = 0; + renderer->size = -1; + renderer->needs_render = TRUE; + renderer->idle_id = 0; } static void diff --git a/app/widgets/gimpviewrendererbrush.c b/app/widgets/gimpviewrendererbrush.c index baac0ae2a9..fa27d036ef 100644 --- a/app/widgets/gimpviewrendererbrush.c +++ b/app/widgets/gimpviewrendererbrush.c @@ -34,9 +34,6 @@ #include "gimpviewrendererbrush.h" -static void gimp_view_renderer_brush_class_init (GimpViewRendererBrushClass *klass); -static void gimp_view_renderer_brush_init (GimpViewRendererBrush *renderer); - static void gimp_view_renderer_brush_finalize (GObject *object); static void gimp_view_renderer_brush_render (GimpViewRenderer *renderer, GtkWidget *widget); @@ -44,36 +41,11 @@ static void gimp_view_renderer_brush_render (GimpViewRenderer *renderer, static gboolean gimp_view_renderer_brush_render_timeout (gpointer data); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererBrush, gimp_view_renderer_brush, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_brush_parent_class -GType -gimp_view_renderer_brush_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererBrushClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_brush_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererBrush), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_renderer_brush_init, - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererBrush", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_brush_class_init (GimpViewRendererBrushClass *klass) @@ -81,8 +53,6 @@ gimp_view_renderer_brush_class_init (GimpViewRendererBrushClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_view_renderer_brush_finalize; renderer_class->render = gimp_view_renderer_brush_render; diff --git a/app/widgets/gimpviewrendererbuffer.c b/app/widgets/gimpviewrendererbuffer.c index 58ba806b9f..9851d576a6 100644 --- a/app/widgets/gimpviewrendererbuffer.c +++ b/app/widgets/gimpviewrendererbuffer.c @@ -34,53 +34,29 @@ #include "gimpviewrendererbuffer.h" -static void gimp_view_renderer_buffer_class_init (GimpViewRendererBufferClass *klass); - -static void gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererBuffer, gimp_view_renderer_buffer, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_buffer_class_init -GType -gimp_view_renderer_buffer_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererBufferClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_buffer_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererBuffer), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererBuffer", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_buffer_class_init (GimpViewRendererBufferClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_class->render = gimp_view_renderer_buffer_render; } +static void +gimp_view_renderer_buffer_init (GimpViewRendererBuffer *renderer) +{ +} + static void gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, GtkWidget *widget) diff --git a/app/widgets/gimpviewrendererdrawable.c b/app/widgets/gimpviewrendererdrawable.c index 365c78738e..d6f0fd9858 100644 --- a/app/widgets/gimpviewrendererdrawable.c +++ b/app/widgets/gimpviewrendererdrawable.c @@ -37,53 +37,29 @@ #include "gimpviewrendererdrawable.h" -static void gimp_view_renderer_drawable_class_init (GimpViewRendererDrawableClass *klass); - -static void gimp_view_renderer_drawable_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_drawable_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererDrawable, gimp_view_renderer_drawable, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_drawable_parent_class -GType -gimp_view_renderer_drawable_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererDrawableClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_drawable_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererDrawable), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererDrawable", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_drawable_class_init (GimpViewRendererDrawableClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_class->render = gimp_view_renderer_drawable_render; } +static void +gimp_view_renderer_drawable_init (GimpViewRendererDrawable *renderer) +{ +} + static void gimp_view_renderer_drawable_render (GimpViewRenderer *renderer, GtkWidget *widget) diff --git a/app/widgets/gimpviewrenderergradient.c b/app/widgets/gimpviewrenderergradient.c index 3fe695d78e..d089adad68 100644 --- a/app/widgets/gimpviewrenderergradient.c +++ b/app/widgets/gimpviewrenderergradient.c @@ -36,45 +36,17 @@ #include "gimpviewrenderergradient.h" -static void gimp_view_renderer_gradient_class_init (GimpViewRendererGradientClass *klass); -static void gimp_view_renderer_gradient_init (GimpViewRendererGradient *renderer); +static void gimp_view_renderer_gradient_finalize (GObject *object); -static void gimp_view_renderer_gradient_finalize (GObject *object); - -static void gimp_view_renderer_gradient_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_gradient_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererGradient, gimp_view_renderer_gradient, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_gradient_parent_class -GType -gimp_view_renderer_gradient_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererGradientClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_gradient_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererGradient), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_renderer_gradient_init, - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererGradient", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_gradient_class_init (GimpViewRendererGradientClass *klass) @@ -82,8 +54,6 @@ gimp_view_renderer_gradient_class_init (GimpViewRendererGradientClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_view_renderer_gradient_finalize; renderer_class->render = gimp_view_renderer_gradient_render; diff --git a/app/widgets/gimpviewrendererimage.c b/app/widgets/gimpviewrendererimage.c index f261a7f3b0..beccd83b4f 100644 --- a/app/widgets/gimpviewrendererimage.c +++ b/app/widgets/gimpviewrendererimage.c @@ -34,51 +34,21 @@ #include "gimpviewrendererimage.h" -static void gimp_view_renderer_image_class_init (GimpViewRendererImageClass *klass); -static void gimp_view_renderer_image_init (GimpViewRendererImage *renderer); - -static void gimp_view_renderer_image_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_image_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererImage, gimp_view_renderer_image, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_image_parent_class -GType -gimp_view_renderer_image_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererImageClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_image_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererImage), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_renderer_image_init, - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererImage", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_image_class_init (GimpViewRendererImageClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_class->render = gimp_view_renderer_image_render; } diff --git a/app/widgets/gimpviewrendererimagefile.c b/app/widgets/gimpviewrendererimagefile.c index e3d4a99fc3..2c81ef7ef3 100644 --- a/app/widgets/gimpviewrendererimagefile.c +++ b/app/widgets/gimpviewrendererimagefile.c @@ -41,51 +41,21 @@ #endif -static void gimp_view_renderer_imagefile_class_init (GimpViewRendererImagefileClass *klass); -static void gimp_view_renderer_imagefile_init (GimpViewRendererImagefile *renderer); - -static void gimp_view_renderer_imagefile_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_imagefile_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererImagefile, gimp_view_renderer_imagefile, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_imagefile_parent_class -GType -gimp_view_renderer_imagefile_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererImagefileClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_imagefile_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererImagefile), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_renderer_imagefile_init, - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererImagefile", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_imagefile_class_init (GimpViewRendererImagefileClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_class->render = gimp_view_renderer_imagefile_render; } diff --git a/app/widgets/gimpviewrendererlayer.c b/app/widgets/gimpviewrendererlayer.c index 9ab7e629d6..29e3536da3 100644 --- a/app/widgets/gimpviewrendererlayer.c +++ b/app/widgets/gimpviewrendererlayer.c @@ -32,53 +32,29 @@ #include "gimpviewrendererlayer.h" -static void gimp_view_renderer_layer_class_init (GimpViewRendererLayerClass *klass); - -static void gimp_view_renderer_layer_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_layer_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererDrawableClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererLayer, gimp_view_renderer_layer, + GIMP_TYPE_VIEW_RENDERER_DRAWABLE); +#define parent_class gimp_view_renderer_layer_parent_class -GType -gimp_view_renderer_layer_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererLayerClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_layer_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererLayer), - 0, /* n_preallocs */ - NULL, /* instance_init */ - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER_DRAWABLE, - "GimpViewRendererLayer", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_layer_class_init (GimpViewRendererLayerClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_class->render = gimp_view_renderer_layer_render; } +static void +gimp_view_renderer_layer_init (GimpViewRendererLayer *renderer) +{ +} + static void gimp_view_renderer_layer_render (GimpViewRenderer *renderer, GtkWidget *widget) diff --git a/app/widgets/gimpviewrendererpalette.c b/app/widgets/gimpviewrendererpalette.c index bb4b300ee6..2f5ce31e89 100644 --- a/app/widgets/gimpviewrendererpalette.c +++ b/app/widgets/gimpviewrendererpalette.c @@ -38,45 +38,17 @@ #define COLUMNS 16 -static void gimp_view_renderer_palette_class_init (GimpViewRendererPaletteClass *klass); -static void gimp_view_renderer_palette_init (GimpViewRendererPalette *renderer); +static void gimp_view_renderer_palette_finalize (GObject *object); -static void gimp_view_renderer_palette_finalize (GObject *object); - -static void gimp_view_renderer_palette_render (GimpViewRenderer *renderer, - GtkWidget *widget); +static void gimp_view_renderer_palette_render (GimpViewRenderer *renderer, + GtkWidget *widget); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererPalette, gimp_view_renderer_palette, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_palette_parent_class -GType -gimp_view_renderer_palette_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererPaletteClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_palette_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererPalette), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_view_renderer_palette_init, - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererPalette", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_palette_class_init (GimpViewRendererPaletteClass *klass) @@ -84,8 +56,6 @@ gimp_view_renderer_palette_class_init (GimpViewRendererPaletteClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_view_renderer_palette_finalize; renderer_class->render = gimp_view_renderer_palette_render; diff --git a/app/widgets/gimpviewrenderervectors.c b/app/widgets/gimpviewrenderervectors.c index 9f19ff1f4f..c8cc481322 100644 --- a/app/widgets/gimpviewrenderervectors.c +++ b/app/widgets/gimpviewrenderervectors.c @@ -37,8 +37,6 @@ #include "gimpviewrenderervectors.h" -static void gimp_view_renderer_vectors_class_init (GimpViewRendererVectorsClass *klass); - static void gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, GdkWindow *window, GtkWidget *widget, @@ -46,47 +44,25 @@ static void gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, const GdkRectangle *expose_area); -static GimpViewRendererClass *parent_class = NULL; +G_DEFINE_TYPE (GimpViewRendererVectors, gimp_view_renderer_vectors, + GIMP_TYPE_VIEW_RENDERER); +#define parent_class gimp_view_renderer_vectors_parent_class -GType -gimp_view_renderer_vectors_get_type (void) -{ - static GType renderer_type = 0; - - if (! renderer_type) - { - static const GTypeInfo renderer_info = - { - sizeof (GimpViewRendererVectorsClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gimp_view_renderer_vectors_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpViewRendererVectors), - 0, /* n_preallocs */ - NULL, /* instance_init */ - }; - - renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER, - "GimpViewRendererVectors", - &renderer_info, 0); - } - - return renderer_type; -} static void gimp_view_renderer_vectors_class_init (GimpViewRendererVectorsClass *klass) { GimpViewRendererClass *renderer_class = GIMP_VIEW_RENDERER_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - renderer_class->draw = gimp_view_renderer_vectors_draw; } +static void +gimp_view_renderer_vectors_init (GimpViewRendererVectors *renderer) +{ +} + static void gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer, GdkWindow *window,