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-filter-input.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 'filter/e-filter-input.c')
-rw-r--r-- | filter/e-filter-input.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/filter/e-filter-input.c b/filter/e-filter-input.c index 79d9fffb73..ec92030333 100644 --- a/filter/e-filter-input.c +++ b/filter/e-filter-input.c @@ -38,7 +38,10 @@ #include "e-filter-input.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EFilterInput, + e_filter_input, + E_TYPE_FILTER_ELEMENT) static void filter_input_entry_changed (GtkEntry *entry, @@ -65,7 +68,7 @@ filter_input_finalize (GObject *object) g_list_free (input->values); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_filter_input_parent_class)->finalize (object); } static gboolean @@ -122,7 +125,8 @@ filter_input_eq (EFilterElement *element_a, GList *link_b; /* Chain up to parent's eq() method. */ - if (!E_FILTER_ELEMENT_CLASS (parent_class)->eq (element_a, element_b)) + if (!E_FILTER_ELEMENT_CLASS (e_filter_input_parent_class)-> + eq (element_a, element_b)) return FALSE; if (g_strcmp0 (input_a->type, input_b->type) != 0) @@ -242,13 +246,11 @@ filter_input_format_sexp (EFilterElement *element, } static void -filter_input_class_init (EFilterInputClass *class) +e_filter_input_class_init (EFilterInputClass *class) { GObjectClass *object_class; EFilterElementClass *filter_element_class; - parent_class = g_type_class_peek_parent (class); - object_class = G_OBJECT_CLASS (class); object_class->finalize = filter_input_finalize; @@ -262,37 +264,11 @@ filter_input_class_init (EFilterInputClass *class) } static void -filter_input_init (EFilterInput *input) +e_filter_input_init (EFilterInput *input) { input->values = g_list_prepend (NULL, g_strdup ("")); } -GType -e_filter_input_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFilterInputClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) filter_input_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFilterInput), - 0, /* n_preallocs */ - (GInstanceInitFunc) filter_input_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_FILTER_ELEMENT, "EFilterInput", &type_info, 0); - } - - return type; -} - /** * filter_input_new: * |