diff --git a/lib/searchentry.c b/lib/searchentry.c index deb1512e5f2e83999a72b6218994ab0dc4728f93..3c3971bf8155503fbafec049795df0401d0de4ca 100644 --- a/lib/searchentry.c +++ b/lib/searchentry.c @@ -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) diff --git a/lib/wraplabel.c b/lib/wraplabel.c index 22c371ef544837bc102450514daf42ee189edc4a..a50b413e68cca7f4e34eb406c83c1196678d76b4 100644 --- a/lib/wraplabel.c +++ b/lib/wraplabel.c @@ -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); }