Skip to content
Snippets Groups Projects
Commit 6319d0fa authored by Enrico Tröger's avatar Enrico Tröger
Browse files

Use the G_DEFINE_TYPE() macro to generate the *_get_type() code.

(Old svn revision: 6662)
parent b26c5e62
No related branches found
No related tags found
No related merge requests found
......@@ -28,10 +28,6 @@
#include "sexy-icon-entry.h"
static void xfd_search_entry_class_init (XfdSearchEntryClass *klass);
static void xfd_search_entry_init (XfdSearchEntry *self);
enum
{
ACTIVE_CHANGED,
......@@ -41,30 +37,7 @@ enum
static guint signals[LAST_SIGNAL];
GType xfd_search_entry_get_type(void)
{
static GType self_type = 0;
if (! self_type)
{
static const GTypeInfo self_info =
{
sizeof(XfdSearchEntryClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc)xfd_search_entry_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(XfdSearchEntry),
0,
(GInstanceInitFunc)xfd_search_entry_init,
NULL /* value_table */
};
self_type = g_type_register_static(GTK_TYPE_COMBO_BOX_ENTRY, "XfdSearchEntry", &self_info, 0);
}
return self_type;
}
G_DEFINE_TYPE(XfdSearchEntry, xfd_search_entry, GTK_TYPE_COMBO_BOX_ENTRY)
static void xfd_search_entry_class_init(XfdSearchEntryClass *klass)
......
......@@ -31,15 +31,10 @@
#include "wraplabel.h"
/* Local data */
static GObjectClass *parent_class = NULL;
#define XFD_WRAP_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
XFD_WRAP_LABEL_TYPE, XfdWrapLabelPrivate))
struct _XfdWrapLabelClass
{
GtkLabelClass parent_class;
......@@ -56,43 +51,17 @@ typedef struct
} XfdWrapLabelPrivate;
static void xfd_wrap_label_class_init (XfdWrapLabelClass *klass);
static void xfd_wrap_label_init (XfdWrapLabel *self);
G_DEFINE_TYPE(XfdWrapLabel, xfd_wrap_label, GTK_TYPE_LABEL);
static void xfd_wrap_label_size_request (GtkWidget *widget, GtkRequisition *req);
static void xfd_wrap_label_size_allocate (GtkWidget *widget, GtkAllocation *alloc);
static void xfd_wrap_label_set_wrap_width (GtkWidget *widget, gsize width);
GType xfd_wrap_label_get_type()
{
static GType type = G_TYPE_INVALID;
if (G_UNLIKELY(type == G_TYPE_INVALID))
{
GTypeInfo gwl_info = {
sizeof (XfdWrapLabelClass),
NULL, NULL,
(GClassInitFunc) xfd_wrap_label_class_init,
NULL,
NULL,
sizeof (XfdWrapLabel),
3,
(GInstanceInitFunc) xfd_wrap_label_init,
NULL
};
type = g_type_register_static(GTK_TYPE_LABEL, "XfdWrapLabel", &gwl_info, 0);
}
return type;
}
static void xfd_wrap_label_class_init(XfdWrapLabelClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
parent_class = g_type_class_peek_parent(klass);
widget_class->size_request = xfd_wrap_label_size_request;
widget_class->size_allocate = xfd_wrap_label_size_allocate;
......@@ -147,7 +116,7 @@ static void xfd_wrap_label_size_request(GtkWidget *widget, GtkRequisition *req)
/* Sets the wrap width to the width allocated to us. */
static void xfd_wrap_label_size_allocate(GtkWidget *widget, GtkAllocation *alloc)
{
(* GTK_WIDGET_CLASS(parent_class)->size_allocate)(widget, alloc);
(* GTK_WIDGET_CLASS(xfd_wrap_label_parent_class)->size_allocate)(widget, alloc);
xfd_wrap_label_set_wrap_width(widget, alloc->width);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment