From ecf3434da05b1f39f793c24b38bfd278e10b5786 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 24 Aug 2010 11:21:41 -0400 Subject: GObject boilerplate cleanup. Prefer thread-safe G_DEFINE_TYPE and G_DEFINE_INTERFACE macros over manual GType registration. This is just a start... lots more to do. --- composer/e-composer-text-header.c | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'composer/e-composer-text-header.c') diff --git a/composer/e-composer-text-header.c b/composer/e-composer-text-header.c index efbf141cea..d92901d55e 100644 --- a/composer/e-composer-text-header.c +++ b/composer/e-composer-text-header.c @@ -30,7 +30,10 @@ struct _EComposerTextHeaderPrivate { guint destination_index; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EComposerTextHeader, + e_composer_text_header, + E_TYPE_COMPOSER_HEADER) static void composer_text_header_changed_cb (GtkEntry *entry, @@ -59,13 +62,12 @@ composer_text_header_query_tooltip_cb (GtkEntry *entry, } static void -composer_text_header_class_init (EComposerTextHeaderClass *class) +e_composer_text_header_class_init (EComposerTextHeaderClass *class) { - parent_class = g_type_class_peek_parent (class); } static void -composer_text_header_init (EComposerTextHeader *header) +e_composer_text_header_init (EComposerTextHeader *header) { GtkWidget *widget; @@ -80,33 +82,6 @@ composer_text_header_init (EComposerTextHeader *header) E_COMPOSER_HEADER (header)->input_widget = widget; } -GType -e_composer_text_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerTextHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_text_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerTextHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_text_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_COMPOSER_HEADER, "EComposerTextHeader", - &type_info, 0); - } - - return type; -} - EComposerHeader * e_composer_text_header_new_label (const gchar *label) { -- cgit