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 /e-util/e-activity.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 'e-util/e-activity.c')
-rw-r--r-- | e-util/e-activity.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/e-util/e-activity.c b/e-util/e-activity.c index f8a3510049..631915db89 100644 --- a/e-util/e-activity.c +++ b/e-util/e-activity.c @@ -60,9 +60,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static gulong signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + EActivity, + e_activity, + G_TYPE_OBJECT) + static gboolean activity_describe_accumulator (GSignalInvocationHint *ihint, GValue *return_accu, @@ -183,7 +187,7 @@ activity_finalize (GObject *object) g_free (priv->secondary_text); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_activity_parent_class)->finalize (object); } static void @@ -241,11 +245,10 @@ activity_describe (EActivity *activity) } static void -activity_class_init (EActivityClass *class) +e_activity_class_init (EActivityClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EActivityPrivate)); object_class = G_OBJECT_CLASS (class); @@ -364,37 +367,11 @@ activity_class_init (EActivityClass *class) } static void -activity_init (EActivity *activity) +e_activity_init (EActivity *activity) { activity->priv = E_ACTIVITY_GET_PRIVATE (activity); } -GType -e_activity_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EActivityClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) activity_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EActivity), - 0, /* n_preallocs */ - (GInstanceInitFunc) activity_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EActivity", &type_info, 0); - } - - return type; -} - EActivity * e_activity_new (const gchar *primary_text) { |