diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-24 23:21:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-25 02:37:02 +0800 |
commit | ecf3434da05b1f39f793c24b38bfd278e10b5786 (patch) | |
tree | 485ed2399920ecb10dbee2b4db4c437c22574a20 /composer/e-composer-header.c | |
parent | f1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff) | |
download | gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.zst gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.zip |
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.
Diffstat (limited to 'composer/e-composer-header.c')
-rw-r--r-- | composer/e-composer-header.c | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/composer/e-composer-header.c b/composer/e-composer-header.c index 0c634175de..76c5d89b14 100644 --- a/composer/e-composer-header.c +++ b/composer/e-composer-header.c @@ -56,9 +56,13 @@ struct _EComposerHeaderPrivate { guint visible : 1; }; -static gpointer parent_class; static guint signal_ids[LAST_SIGNAL]; +G_DEFINE_ABSTRACT_TYPE ( + EComposerHeader, + e_composer_header, + G_TYPE_OBJECT) + static void composer_header_button_clicked_cb (GtkButton *button, EComposerHeader *header) @@ -78,7 +82,8 @@ composer_header_constructor (GType type, GtkWidget *label; /* Chain up to parent's constructor() method. */ - object = G_OBJECT_CLASS (parent_class)->constructor ( + object = G_OBJECT_CLASS ( + e_composer_header_parent_class)->constructor ( type, n_construct_properties, construct_properties); header = E_COMPOSER_HEADER (object); @@ -197,15 +202,14 @@ composer_header_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_composer_header_parent_class)->dispose (object); } static void -composer_header_class_init (EComposerHeaderClass *class) +e_composer_header_class_init (EComposerHeaderClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EComposerHeaderPrivate)); object_class = G_OBJECT_CLASS (class); @@ -276,38 +280,11 @@ composer_header_class_init (EComposerHeaderClass *class) } static void -composer_header_init (EComposerHeader *header) +e_composer_header_init (EComposerHeader *header) { header->priv = E_COMPOSER_HEADER_GET_PRIVATE (header); } -GType -e_composer_header_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EComposerHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) composer_header_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EComposerHeader), - 0, /* n_preallocs */ - (GInstanceInitFunc) composer_header_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EComposerHeader", - &type_info, G_TYPE_FLAG_ABSTRACT); - } - - return type; -} - gchar * e_composer_header_get_label (EComposerHeader *header) { |