Commit 33ae55f8 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

libgimp/*.c libgimpconfig/*.c libgimpmodule/*.c libgimpthumb/*.c port to

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

	* libgimp/*.c
	* libgimpconfig/*.c
	* libgimpmodule/*.c
	* libgimpthumb/*.c
	* libgimpwidgets/*.c: port to G_DEFINE_TYPE() and friends. Some
	related cleanup.
parent a4c54f7a
2005-12-20 Michael Natterer <mitch@gimp.org>
* libgimp/*.c
* libgimpconfig/*.c
* libgimpmodule/*.c
* libgimpthumb/*.c
* libgimpwidgets/*.c: port to G_DEFINE_TYPE() and friends. Some
related cleanup.
2005-12-20 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpscrolledpreview.c: removed unused variable.
......
......@@ -34,46 +34,18 @@
#include "gimpaspectpreview.h"
static void gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass);
static void gimp_aspect_preview_init (GimpAspectPreview *preview);
static void gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_aspect_preview_draw (GimpPreview *preview);
static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
static void gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_aspect_preview_draw (GimpPreview *preview);
static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
G_DEFINE_TYPE (GimpAspectPreview, gimp_aspect_preview, GIMP_TYPE_PREVIEW);
static GimpPreviewClass *parent_class = NULL;
#define parent_class gimp_aspect_preview_parent_class
GType
gimp_aspect_preview_get_type (void)
{
static GType preview_type = 0;
if (! preview_type)
{
static const GTypeInfo preview_info =
{
sizeof (GimpAspectPreviewClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_aspect_preview_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpAspectPreview),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_aspect_preview_init,
};
preview_type = g_type_register_static (GIMP_TYPE_PREVIEW,
"GimpAspectPreview",
&preview_info, 0);
}
return preview_type;
}
static void
gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
......@@ -81,8 +53,6 @@ gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
widget_class->style_set = gimp_aspect_preview_style_set;
preview_class->draw = gimp_aspect_preview_draw;
......
......@@ -40,59 +40,32 @@ typedef struct
gboolean update;
} PreviewSettings;
static void gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass);
static void gimp_drawable_preview_init (GimpDrawablePreview *preview);
static void gimp_drawable_preview_destroy (GtkObject *object);
static void gimp_drawable_preview_destroy (GtkObject *object);
static void gimp_drawable_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_drawable_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_drawable_preview_draw_original (GimpPreview *preview);
static void gimp_drawable_preview_draw_thumb (GimpPreview *preview,
GimpPreviewArea *area,
gint width,
gint height);
static void gimp_drawable_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
static gboolean gimp_drawable_preview_get_bounds (GimpDrawable *drawable,
gint *xmin,
gint *ymin,
gint *xmax,
gint *ymax);
static void gimp_drawable_preview_draw_original (GimpPreview *preview);
static void gimp_drawable_preview_draw_thumb (GimpPreview *preview,
GimpPreviewArea *area,
gint width,
gint height);
static void gimp_drawable_preview_draw_buffer (GimpPreview *preview,
const guchar *buffer,
gint rowstride);
static gboolean gimp_drawable_preview_get_bounds (GimpDrawable *drawable,
gint *xmin,
gint *ymin,
gint *xmax,
gint *ymax);
static GimpScrolledPreviewClass *parent_class = NULL;
G_DEFINE_TYPE (GimpDrawablePreview, gimp_drawable_preview,
GIMP_TYPE_SCROLLED_PREVIEW);
#define parent_class gimp_drawable_preview_parent_class
GType
gimp_drawable_preview_get_type (void)
{
static GType preview_type = 0;
if (!preview_type)
{
static const GTypeInfo drawable_preview_info =
{
sizeof (GimpDrawablePreviewClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_drawable_preview_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDrawablePreview),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_drawable_preview_init
};
preview_type = g_type_register_static (GIMP_TYPE_SCROLLED_PREVIEW,
"GimpDrawablePreview",
&drawable_preview_info, 0);
}
return preview_type;
}
static void
gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
......@@ -101,8 +74,6 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_drawable_preview_destroy;
widget_class->style_set = gimp_drawable_preview_style_set;
......
......@@ -67,11 +67,6 @@ enum
};
/* local function prototypes */
static void gimp_proc_browser_dialog_class_init (GimpProcBrowserDialogClass *klass);
static void gimp_proc_browser_dialog_init (GimpProcBrowserDialog *dialog);
static void browser_selection_changed (GtkTreeSelection *sel,
GimpProcBrowserDialog *dialog);
static void browser_row_activated (GtkTreeView *treeview,
......@@ -86,43 +81,17 @@ static void browser_search (GimpBrowser *browser,
GimpProcBrowserDialog *dialog);
static GimpDialogClass *parent_class = NULL;
static guint dialog_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (GimpProcBrowserDialog, gimp_proc_browser_dialog,
GIMP_TYPE_DIALOG);
#define parent_class gimp_proc_browser_dialog_parent_class
GType
gimp_proc_browser_dialog_get_type (void)
{
static GType type = 0;
static guint dialog_signals[LAST_SIGNAL] = { 0, };
if (! type)
{
static const GTypeInfo info =
{
sizeof (GimpProcBrowserDialogClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_proc_browser_dialog_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpProcBrowserDialog),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_proc_browser_dialog_init,
};
type = g_type_register_static (GIMP_TYPE_DIALOG,
"GimpProcBrowserDialog",
&info, 0);
}
return type;
}
static void
gimp_proc_browser_dialog_class_init (GimpProcBrowserDialogClass *klass)
{
parent_class = g_type_class_peek_parent (klass);
/**
* GimpProcBrowserDialog::selection-changed:
* @dialog: the object that received the signal
......
......@@ -39,61 +39,30 @@
#include "gimpprogressbar.h"
static void gimp_progress_bar_class_init (GimpProgressBarClass *klass);
static void gimp_progress_bar_init (GimpProgressBar *bar);
static void gimp_progress_bar_destroy (GtkObject *object);
static void gimp_progress_bar_destroy (GtkObject *object);
static void gimp_progress_bar_start (const gchar *message,
gboolean cancelable,
gpointer user_data);
static void gimp_progress_bar_end (gpointer user_data);
static void gimp_progress_bar_set_text (const gchar *message,
gpointer user_data);
static void gimp_progress_bar_set_value (gdouble percentage,
gpointer user_data);
static void gimp_progress_bar_pulse (gpointer user_data);
static guint32 gimp_progress_bar_get_window (gpointer user_data);
static void gimp_progress_bar_start (const gchar *message,
gboolean cancelable,
gpointer user_data);
static void gimp_progress_bar_end (gpointer user_data);
static void gimp_progress_bar_set_text (const gchar *message,
gpointer user_data);
static void gimp_progress_bar_set_value (gdouble percentage,
gpointer user_data);
static void gimp_progress_bar_pulse (gpointer user_data);
static guint32 gimp_progress_bar_get_window (gpointer user_data);
G_DEFINE_TYPE (GimpProgressBar, gimp_progress_bar, GTK_TYPE_PROGRESS_BAR);
static GtkProgressBarClass *parent_class = NULL;
#define parent_class gimp_progress_bar_parent_class
GType
gimp_progress_bar_get_type (void)
{
static GType bar_type = 0;
if (! bar_type)
{
static const GTypeInfo bar_info =
{
sizeof (GimpProgressBarClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_progress_bar_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpProgressBar),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_progress_bar_init,
};
bar_type = g_type_register_static (GTK_TYPE_PROGRESS_BAR,
"GimpProgressBar",
&bar_info, 0);
}
return bar_type;
}
static void
gimp_progress_bar_class_init (GimpProgressBarClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_progress_bar_destroy;
}
......
......@@ -84,70 +84,29 @@ enum
};
static void gimp_color_config_class_init (GimpColorConfigClass *klass);
static void gimp_color_config_finalize (GObject *object);
static void gimp_color_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_color_config_finalize (GObject *object);
static void gimp_color_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GObjectClass *parent_class = NULL;
G_DEFINE_TYPE_WITH_CODE (GimpColorConfig, gimp_color_config, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL)
gimp_type_set_translation_domain (g_define_type_id,
GETTEXT_PACKAGE "-libgimp"));
#define parent_class gimp_color_config_parent_class
GType
gimp_color_config_get_type (void)
{
static GType config_type = 0;
if (! config_type)
{
static const GTypeInfo config_info =
{
sizeof (GimpColorConfigClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_color_config_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorConfig),
0, /* n_preallocs */
NULL /* instance_init */
};
static const GInterfaceInfo config_iface_info =
{
NULL, /* iface_init */
NULL, /* iface_finalize */
NULL /* iface_data */
};
config_type = g_type_register_static (G_TYPE_OBJECT,
"GimpColorConfig",
&config_info, 0);
g_type_add_interface_static (config_type,
GIMP_TYPE_CONFIG, &config_iface_info);
gimp_type_set_translation_domain (config_type,
GETTEXT_PACKAGE "-libgimp");
}
return config_type;
}
static void
gimp_color_config_class_init (GimpColorConfigClass *klass)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gimp_color_config_finalize;
object_class->set_property = gimp_color_config_set_property;
......@@ -217,6 +176,11 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
#endif
}
static void
gimp_color_config_init (GimpColorConfig *config)
{
}
static void
gimp_color_config_finalize (GObject *object)
{
......
......@@ -40,52 +40,23 @@ enum
};
static void gimp_module_class_init (GimpModuleClass *klass);
static void gimp_module_init (GimpModule *module);
static void gimp_module_finalize (GObject *object);
static void gimp_module_finalize (GObject *object);
static gboolean gimp_module_load (GTypeModule *module);
static void gimp_module_unload (GTypeModule *module);
static gboolean gimp_module_load (GTypeModule *module);
static void gimp_module_unload (GTypeModule *module);
static gboolean gimp_module_open (GimpModule *module);
static gboolean gimp_module_close (GimpModule *module);
static void gimp_module_set_last_error (GimpModule *module,
const gchar *error_str);
static gboolean gimp_module_open (GimpModule *module);
static gboolean gimp_module_close (GimpModule *module);
static void gimp_module_set_last_error (GimpModule *module,
const gchar *error_str);
G_DEFINE_TYPE (GimpModule, gimp_module, G_TYPE_TYPE_MODULE);
static guint module_signals[LAST_SIGNAL];
static GTypeModuleClass *parent_class = NULL;
GType
gimp_module_get_type (void)
{
static GType module_type = 0;
#define parent_class gimp_module_parent_class
if (! module_type)
{
static const GTypeInfo module_info =
{
sizeof (GimpModuleClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_module_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpModule),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_module_init,
};
module_type = g_type_register_static (G_TYPE_TYPE_MODULE,
"GimpModule",
&module_info, 0);
}
static guint module_signals[LAST_SIGNAL];
return module_type;
}
static void
gimp_module_class_init (GimpModuleClass *klass)
......@@ -93,8 +64,6 @@ gimp_module_class_init (GimpModuleClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
module_signals[MODIFIED] =
g_signal_new ("modified",
G_TYPE_FROM_CLASS (klass),
......
......@@ -43,9 +43,6 @@ enum
/* #define DUMP_DB 1 */
static void gimp_module_db_class_init (GimpModuleDBClass *klass);
static void gimp_module_db_init (GimpModuleDB *db);
static void gimp_module_db_finalize (GObject *object);
static void gimp_module_db_module_initialize (const GimpDatafileData *file_data,
......@@ -67,46 +64,18 @@ static void gimp_module_db_module_modified (GimpModule *module,
GimpModuleDB *db);
static GObjectClass *parent_class = NULL;
static guint db_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GimpModuleDB, gimp_module_db, G_TYPE_OBJECT);
#define parent_class gimp_module_db_parent_class
GType
gimp_module_db_get_type (void)
{
static GType db_type = 0;
if (! db_type)
{
static const GTypeInfo db_info =
{
sizeof (GimpModuleDBClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_module_db_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpModuleDB),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_module_db_init,
};
db_type = g_type_register_static (G_TYPE_OBJECT,
"GimpModuleDB",
&db_info, 0);
}
static guint db_signals[LAST_SIGNAL] = { 0 };
return db_type;
}
static void
gimp_module_db_class_init (GimpModuleDBClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
db_signals[ADD] =
g_signal_new ("add",
G_TYPE_FROM_CLASS (klass),
......
......@@ -89,74 +89,42 @@ enum
};
static void gimp_thumbnail_class_init (GimpThumbnailClass *klass);
static void gimp_thumbnail_init (GimpThumbnail *thumbnail);
static void gimp_thumbnail_finalize (GObject *object);
static void gimp_thumbnail_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_thumbnail_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_thumbnail_reset_info (GimpThumbnail *thumbnail);
static void gimp_thumbnail_update_image (GimpThumbnail *thumbnail);
static void gimp_thumbnail_update_thumb (GimpThumbnail *thumbnail,
GimpThumbSize size);
static gboolean gimp_thumbnail_save (GimpThumbnail *thumbnail,
GimpThumbSize size,
const gchar *filename,
GdkPixbuf *pixbuf,
const gchar *software,
GError **error);
static void gimp_thumbnail_finalize (GObject *object);
static void gimp_thumbnail_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_thumbnail_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_thumbnail_reset_info (GimpThumbnail *thumbnail);
static void gimp_thumbnail_update_image (GimpThumbnail *thumbnail);
static void gimp_thumbnail_update_thumb (GimpThumbnail *thumbnail,
GimpThumbSize size);
static gboolean gimp_thumbnail_save (GimpThumbnail *thumbnail,
GimpThumbSize size,
const gchar *filename,
GdkPixbuf *pixbuf,
const gchar *software,
GError **error);
#ifdef GIMP_THUMB_DEBUG
static void gimp_thumbnail_debug_notify (GObject *object,
GParamSpec *pspec);
static void gimp_thumbnail_debug_notify (GObject *object,
GParamSpec *pspec);
#endif
static GObjectClass *parent_class = NULL;
G_DEFINE_TYPE (GimpThumbnail, gimp_thumbnail, G_TYPE_OBJECT);
#define parent_class gimp_thumbnail_parent_class
GType
gimp_thumbnail_get_type (void)
{
static GType thumbnail_type = 0;
if (!thumbnail_type)
{
static const GTypeInfo thumbnail_info =
{
sizeof (GimpThumbnailClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_thumbnail_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpThumbnail),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_thumbnail_init,
};
thumbnail_type = g_type_register_static (G_TYPE_OBJECT,
"GimpThumbnail",
&thumbnail_info, 0);
}
return thumbnail_type;
}
static void
gimp_thumbnail_class_init (GimpThumbnailClass *klass)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gimp_thumbnail_finalize;
object_class->set_property = gimp_thumbnail_set_property;
......
......@@ -41,56 +41,25 @@ enum
};
static void gimp_browser_class_init (GimpBrowserClass *klass);
static void gimp_browser_init (GimpBrowser *browser);
static void gimp_browser_destroy (GtkObject *object);
static void gimp_browser_destroy (GtkObject *object);
static void gimp_browser_entry_changed (GtkEditable *editable,
GimpBrowser *browser);
static gboolean gimp_browser_search_timeout (gpointer data);
static void gimp_browser_entry_changed (GtkEditable *editable,
GimpBrowser *browser);
static gboolean gimp_browser_search_timeout (gpointer data);
G_DEFINE_TYPE (GimpBrowser, gimp_browser, GTK_TYPE_HPANED);
static GtkHPanedClass *parent_class = NULL;
#define parent_class gimp_browser_parent_class
static guint browser_signals[LAST_SIGNAL] = { 0 };
GType
gimp_browser_get_type (void)
{
static GType type = 0;
if (! type)
{
static const GTypeInfo info =
{
sizeof (GimpBrowserClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_browser_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrowser),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_browser_init,
};
type = g_type_register_static (GTK_TYPE_HPANED,
"GimpBrowser",
&info, 0);
}
return type;
}
static void
gimp_browser_class_init (GimpBrowserClass *klass)
{
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
browser_signals[SEARCH] =
g_signal_new ("search",
G_TYPE_FROM_CLASS (klass),
......
......@@ -36,55 +36,24 @@ enum
};
static void gimp_button_class_init (GimpButtonClass *klass);
static void gimp_button_init (GimpButton *button);
static gboolean gimp_button_button_press (GtkWidget *widget,
GdkEventButton *event);
static gboolean gimp_button_button_release (GtkWidget *widget,
GdkEventButton *event);
static gboolean gimp_button_button_press (GtkWidget *widget,
GdkEventButton *event);
static gboolean gimp_button_button_release (GtkWidget *widget,
GdkEventButton *event);
G_DEFINE_TYPE (GimpButton, gimp_button, GTK_TYPE_BUTTON);
static guint button_signals[LAST_SIGNAL] = { 0 };
static GtkButtonClass *parent_class = NULL;
GType
gimp_button_get_type (void)
{