diff options
author | Vincent Geddes <vgeddes@src.gnome.org> | 2007-07-12 20:49:35 +0000 |
---|---|---|
committer | Vincent Geddes <vgeddes@src.gnome.org> | 2007-07-12 20:49:35 +0000 |
commit | 0fb53631661139b88fbeb0c1844d577009772e51 (patch) | |
tree | 9270a3a5bf64b21fef5a1e12d0421fe3088e5431 /gladeui/glade-placeholder.c | |
parent | 25ab68be16a85e3f476449176074200af66cf200 (diff) | |
download | glade-0fb53631661139b88fbeb0c1844d577009772e51.tar.gz |
Update to use G_DEFINE_TYPE macros. Removed the manual peeks to get theBINDINGS_BRANCHPOINT
* gladeui/glade-widget.c
gladeui/glade-design-layout.c
gladeui/glade-placeholder.c
gladeui/glade-placeholder.h: Update to use G_DEFINE_TYPE macros. Removed
the manual peeks to get the parent class.
svn path=/trunk/; revision=1465
Diffstat (limited to 'gladeui/glade-placeholder.c')
-rw-r--r-- | gladeui/glade-placeholder.c | 85 |
1 files changed, 29 insertions, 56 deletions
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c index 2ca84444..d3175a4c 100644 --- a/gladeui/glade-placeholder.c +++ b/gladeui/glade-placeholder.c @@ -2,6 +2,9 @@ /* * Copyright (C) 2003, 2004 Joaquin Cuenca Abela * + * Authors: + * Joaquin Cuenca Abela <e98cuenc@yahoo.com> + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the @@ -16,9 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Authors: - * Joaquin Cuenca Abela <e98cuenc@yahoo.com> - */ +*/ #include "config.h" @@ -34,23 +35,29 @@ #include "glade-widget.h" #include "glade-app.h" -static void glade_placeholder_class_init (GladePlaceholderClass *klass); -static void glade_placeholder_init (GladePlaceholder *placeholder); -static void glade_placeholder_finalize (GObject *object); -static void glade_placeholder_realize (GtkWidget *widget); -static void glade_placeholder_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void glade_placeholder_send_configure (GladePlaceholder *placeholder); -static gboolean glade_placeholder_expose (GtkWidget *widget, - GdkEventExpose *event); -static gboolean glade_placeholder_motion_notify_event (GtkWidget *widget, - GdkEventMotion *event); -static gboolean glade_placeholder_button_press (GtkWidget *widget, - GdkEventButton *event); -static gboolean glade_placeholder_popup_menu (GtkWidget *widget); +#define WIDTH_REQUISITION 20 +#define HEIGHT_REQUISITION 20 + +static void glade_placeholder_finalize (GObject *object); +static void glade_placeholder_realize (GtkWidget *widget); + +static void glade_placeholder_size_allocate (GtkWidget *widget, + GtkAllocation *allocation); + +static void glade_placeholder_send_configure (GladePlaceholder *placeholder); + +static gboolean glade_placeholder_expose (GtkWidget *widget, + GdkEventExpose *event); + +static gboolean glade_placeholder_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event); + +static gboolean glade_placeholder_button_press (GtkWidget *widget, + GdkEventButton *event); + +static gboolean glade_placeholder_popup_menu (GtkWidget *widget); -static GtkWidgetClass *parent_class = NULL; static char *placeholder_xpm[] = { /* columns rows colors chars-per-pixel */ @@ -68,39 +75,7 @@ static char *placeholder_xpm[] = { " .. " }; -/** - * glade_placeholder_get_type: - * - * Creates the typecode for the #GladePlaceholder object type. - * - * Returns: the typecode for the #GladePlaceholder object type - */ -GType -glade_placeholder_get_type (void) -{ - static GType placeholder_type = 0; - - if (!placeholder_type) - { - static const GTypeInfo placeholder_info = - { - sizeof (GladePlaceholderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) glade_placeholder_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GladePlaceholder), - 0, /* n_preallocs */ - (GInstanceInitFunc) glade_placeholder_init, - }; - - placeholder_type = g_type_register_static (GTK_TYPE_WIDGET, "GladePlaceholder", - &placeholder_info, 0); - } - - return placeholder_type; -} +G_DEFINE_TYPE (GladePlaceholder, glade_placeholder, GTK_TYPE_WIDGET) static void glade_placeholder_class_init (GladePlaceholderClass *klass) @@ -108,8 +83,6 @@ glade_placeholder_class_init (GladePlaceholderClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = glade_placeholder_finalize; widget_class->realize = glade_placeholder_realize; widget_class->size_allocate = glade_placeholder_size_allocate; @@ -147,8 +120,8 @@ glade_placeholder_init (GladePlaceholder *placeholder) GTK_WIDGET_SET_FLAGS (GTK_WIDGET (placeholder), GTK_CAN_FOCUS); gtk_widget_set_size_request (GTK_WIDGET (placeholder), - GLADE_PLACEHOLDER_WIDTH_REQ, - GLADE_PLACEHOLDER_HEIGHT_REQ); + WIDTH_REQUISITION, + HEIGHT_REQUISITION); g_signal_connect (placeholder, "notify::parent", G_CALLBACK (glade_placeholder_notify_parent), @@ -187,7 +160,7 @@ glade_placeholder_finalize (GObject *object) g_list_free (placeholder->packing_actions); } - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (glade_placeholder_parent_class)->finalize (object); } static void |