Commit 61df53ec authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

port to G_DEFINE_TYPE() and friends. Some related cleanup.

2005-12-19  Michael Natterer  <mitch@gimp.org>

	* app/widgets/*.c: port to G_DEFINE_TYPE() and friends. Some
	related cleanup.
parent b53e627e
2005-12-19 Michael Natterer <mitch@gimp.org>
* app/widgets/*.c: port to G_DEFINE_TYPE() and friends. Some
related cleanup.
2005-12-19 Sven Neumann <sven@gimp.org>
* plug-ins/common/svg.c: fixed handling of librsvg API change,
......
......@@ -47,55 +47,26 @@ 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);
G_DEFINE_TYPE (GimpAction, gimp_action, GTK_TYPE_ACTION);
static GtkActionClass *parent_class = NULL;
#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;
......
......@@ -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);
G_DEFINE_TYPE (GimpActionFactory, gimp_action_factory, GIMP_TYPE_OBJECT);
static GimpObjectClass *parent_class = NULL;
#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;
}
......
......@@ -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;
GType
gimp_action_group_get_type (void)
{
static GType type = 0;
G_DEFINE_TYPE (GimpActionGroup, gimp_action_group, GTK_TYPE_ACTION_GROUP);
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);
}
#define parent_class gimp_action_group_parent_class
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;
......
......@@ -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;
GType
gimp_action_view_get_type (void)
{
static GType view_type = 0;
G_DEFINE_TYPE (GimpActionView, gimp_action_view, GTK_TYPE_TREE_VIEW);
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);
}
#define parent_class gimp_action_view_parent_class
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;
}
......
......@@ -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
......
......@@ -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_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_brush_shape (GtkWidget *widget,
GimpBrushEditor *editor);
static void gimp_brush_editor_notify_brush (GimpBrushGenerated *brush,
GParamSpec *pspec,
GimpBrushEditor *editor);
G_DEFINE_TYPE (GimpBrushEditor, gimp_brush_editor, GIMP_TYPE_DATA_EDITOR);
static GimpDataEditorClass *parent_class = NULL;
#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;
......
......@@ -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;
......
......@@ -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;
GType
gimp_brush_select_get_type (void)
{
static GType dialog_type = 0;
G_DEFINE_TYPE (GimpBrushSelect, gimp_brush_select, GIMP_TYPE_PDB_DIALOG);
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);
}
#define parent_class gimp_brush_select_parent_class
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,
......
......@@ -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;
GType
gimp_buffer_view_get_type (void)
{
static GType view_type = 0;
G_DEFINE_TYPE (GimpBufferView, gimp_buffer_view, GIMP_TYPE_CONTAINER_EDITOR);
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);
}
#define parent_class gimp_buffer_view_parent_class
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;
}
......
......@@ -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);
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;
G_DEFINE_TYPE (GimpCellRendererAccel, gimp_cell_renderer_accel,
GTK_TYPE_CELL_RENDERER_TEXT);
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
};
#define parent_class gimp_cell_renderer_accel_parent_class
type = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT,
"GimpCellRendererAccel",
&info, 0);
}
return type;
}
static guint accel_cell_signals[LAST_SIGNAL] = { 0 };
static void
gimp_cell_renderer_accel_init (GimpCellRendererAccel *cell)
{
}