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 /widgets/misc/e-search-bar.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 'widgets/misc/e-search-bar.c')
-rw-r--r-- | widgets/misc/e-search-bar.c | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index aaf18b3912..c0b2d43e97 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -59,9 +59,13 @@ enum { LAST_SIGNAL }; -static gpointer parent_class; static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE ( + ESearchBar, + e_search_bar, + GTK_TYPE_HBOX) + static void search_bar_update_matches (ESearchBar *search_bar) { @@ -350,7 +354,7 @@ search_bar_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_search_bar_parent_class)->dispose (object); } static void @@ -363,7 +367,7 @@ search_bar_finalize (GObject *object) g_free (priv->active_search); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_search_bar_parent_class)->finalize (object); } static void @@ -386,7 +390,7 @@ search_bar_show (GtkWidget *widget) search_bar = E_SEARCH_BAR (widget); /* Chain up to parent's show() method. */ - GTK_WIDGET_CLASS (parent_class)->show (widget); + GTK_WIDGET_CLASS (e_search_bar_parent_class)->show (widget); gtk_widget_grab_focus (search_bar->priv->entry); @@ -401,7 +405,7 @@ search_bar_hide (GtkWidget *widget) search_bar = E_SEARCH_BAR (widget); /* Chain up to parent's hide() method. */ - GTK_WIDGET_CLASS (parent_class)->hide (widget); + GTK_WIDGET_CLASS (e_search_bar_parent_class)->hide (widget); search_bar_update_tokenizer (search_bar); } @@ -418,7 +422,7 @@ search_bar_key_press_event (GtkWidget *widget, } /* Chain up to parent's key_press_event() method. */ - widget_class = GTK_WIDGET_CLASS (parent_class); + widget_class = GTK_WIDGET_CLASS (e_search_bar_parent_class); return widget_class->key_press_event (widget, event); } @@ -440,12 +444,11 @@ search_bar_clear (ESearchBar *search_bar) } static void -search_bar_class_init (ESearchBarClass *class) +e_search_bar_class_init (ESearchBarClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ESearchBarPrivate)); object_class = G_OBJECT_CLASS (class); @@ -523,7 +526,7 @@ search_bar_class_init (ESearchBarClass *class) } static void -search_bar_init (ESearchBar *search_bar) +e_search_bar_init (ESearchBar *search_bar) { GtkWidget *label; GtkWidget *widget; @@ -691,32 +694,6 @@ search_bar_init (ESearchBar *search_bar) gtk_widget_show (widget); } -GType -e_search_bar_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ESearchBarClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) search_bar_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ESearchBar), - 0, /* n_preallocs */ - (GInstanceInitFunc) search_bar_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_HBOX, "ESearchBar", &type_info, 0); - } - - return type; -} - GtkWidget * e_search_bar_new (EWebView *web_view) { |