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 /filter/e-rule-context.c | |
parent | f1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff) | |
download | gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.bz2 gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.lz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.xz 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 'filter/e-rule-context.c')
-rw-r--r-- | filter/e-rule-context.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/filter/e-rule-context.c b/filter/e-rule-context.c index 9abe7599e6..727c546373 100644 --- a/filter/e-rule-context.c +++ b/filter/e-rule-context.c @@ -68,7 +68,6 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; struct _revert_data { @@ -76,6 +75,11 @@ struct _revert_data { gint rank; }; +G_DEFINE_TYPE ( + ERuleContext, + e_rule_context, + G_TYPE_OBJECT) + static void rule_context_set_error (ERuleContext *context, gchar *error) @@ -184,7 +188,7 @@ rule_context_finalize (GObject *obj) g_list_foreach (context->rules, (GFunc)g_object_unref, NULL); g_list_free (context->rules); - G_OBJECT_CLASS (parent_class)->finalize (obj); + G_OBJECT_CLASS (e_rule_context_parent_class)->finalize (obj); } static gint @@ -463,11 +467,10 @@ rule_context_new_element (ERuleContext *context, } static void -rule_context_class_init (ERuleContextClass *class) +e_rule_context_class_init (ERuleContextClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ERuleContextPrivate)); object_class = G_OBJECT_CLASS (class); @@ -512,7 +515,7 @@ rule_context_class_init (ERuleContextClass *class) } static void -rule_context_init (ERuleContext *context) +e_rule_context_init (ERuleContext *context) { context->priv = E_RULE_CONTEXT_GET_PRIVATE (context); @@ -522,32 +525,6 @@ rule_context_init (ERuleContext *context) context->flags = E_RULE_CONTEXT_GROUPING; } -GType -e_rule_context_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ERuleContextClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) rule_context_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ERuleContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) rule_context_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "ERuleContext", &type_info, 0); - } - - return type; -} - /** * e_rule_context_new: * |