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-menu-tool-button.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-menu-tool-button.c')
-rw-r--r-- | widgets/misc/e-menu-tool-button.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c index 5a87e7420a..7ca38bc1e9 100644 --- a/widgets/misc/e-menu-tool-button.c +++ b/widgets/misc/e-menu-tool-button.c @@ -21,7 +21,10 @@ #include "e-menu-tool-button.h" -static gpointer parent_class; +G_DEFINE_TYPE ( + EMenuToolButton, + e_menu_tool_button, + GTK_TYPE_MENU_TOOL_BUTTON) static GtkWidget * menu_tool_button_clone_image (GtkWidget *source) @@ -98,7 +101,8 @@ menu_tool_button_size_request (GtkWidget *widget, gint minimum_width; /* Chain up to parent's size_request() method. */ - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); + GTK_WIDGET_CLASS (e_menu_tool_button_parent_class)-> + size_request (widget, requisition); /* XXX This is a hack. This widget is only used for the New * button in the main window toolbar. The New button is @@ -126,13 +130,11 @@ menu_tool_button_clicked (GtkToolButton *tool_button) } static void -menu_tool_button_class_init (EMenuToolButtonClass *class) +e_menu_tool_button_class_init (EMenuToolButtonClass *class) { GtkWidgetClass *widget_class; GtkToolButtonClass *tool_button_class; - parent_class = g_type_class_peek_parent (class); - widget_class = GTK_WIDGET_CLASS (class); widget_class->size_request = menu_tool_button_size_request; @@ -141,40 +143,13 @@ menu_tool_button_class_init (EMenuToolButtonClass *class) } static void -menu_tool_button_init (EMenuToolButton *button) +e_menu_tool_button_init (EMenuToolButton *button) { g_signal_connect ( button, "notify::menu", G_CALLBACK (menu_tool_button_update_button), NULL); } -GType -e_menu_tool_button_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EMenuToolButtonClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) menu_tool_button_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMenuToolButton), - 0, /* n_preallocs */ - (GInstanceInitFunc) menu_tool_button_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_MENU_TOOL_BUTTON, "EMenuToolButton", - &type_info, 0); - } - - return type; -} - GtkToolItem * e_menu_tool_button_new (const gchar *label) { |