diff options
Diffstat (limited to 'gtk/gtkviewport.c')
-rw-r--r-- | gtk/gtkviewport.c | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index be304a3aff..d2c4495dac 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -39,8 +39,6 @@ enum { }; -static void gtk_viewport_class_init (GtkViewportClass *klass); -static void gtk_viewport_init (GtkViewport *viewport); static void gtk_viewport_finalize (GObject *object); static void gtk_viewport_destroy (GtkObject *object); static void gtk_viewport_set_property (GObject *object, @@ -71,34 +69,7 @@ static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment, static void gtk_viewport_style_set (GtkWidget *widget, GtkStyle *previous_style); -static GtkBinClass *parent_class; - -GType -gtk_viewport_get_type (void) -{ - static GType viewport_type = 0; - - if (!viewport_type) - { - static const GTypeInfo viewport_info = - { - sizeof (GtkViewportClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gtk_viewport_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GtkViewport), - 0, /* n_preallocs */ - (GInstanceInitFunc) gtk_viewport_init, - }; - - viewport_type = g_type_register_static (GTK_TYPE_BIN, I_("GtkViewport"), - &viewport_info, 0); - } - - return viewport_type; -} +G_DEFINE_TYPE (GtkViewport, gtk_viewport, GTK_TYPE_BIN); static void gtk_viewport_class_init (GtkViewportClass *class) @@ -113,8 +84,6 @@ gtk_viewport_class_init (GtkViewportClass *class) widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; - parent_class = g_type_class_peek_parent (class); - gobject_class->finalize = gtk_viewport_finalize; gobject_class->set_property = gtk_viewport_set_property; gobject_class->get_property = gtk_viewport_get_property; @@ -288,7 +257,7 @@ gtk_viewport_finalize (GObject *object) viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL); viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gtk_viewport_parent_class)->finalize (object); } static void @@ -299,7 +268,7 @@ gtk_viewport_destroy (GtkObject *object) viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL); viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL); - GTK_OBJECT_CLASS (parent_class)->destroy (object); + GTK_OBJECT_CLASS (gtk_viewport_parent_class)->destroy (object); } /** @@ -668,8 +637,8 @@ gtk_viewport_unrealize (GtkWidget *widget) gdk_window_destroy (viewport->bin_window); viewport->bin_window = NULL; - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); + if (GTK_WIDGET_CLASS (gtk_viewport_parent_class)->unrealize) + (* GTK_WIDGET_CLASS (gtk_viewport_parent_class)->unrealize) (widget); } static void @@ -711,7 +680,7 @@ gtk_viewport_expose (GtkWidget *widget, &event->area, widget, "viewportbin", 0, 0, -1, -1); - (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); + (* GTK_WIDGET_CLASS (gtk_viewport_parent_class)->expose_event) (widget, event); } } @@ -731,7 +700,7 @@ gtk_viewport_add (GtkContainer *container, gtk_widget_set_parent_window (child, GTK_VIEWPORT (bin)->bin_window); - GTK_CONTAINER_CLASS (parent_class)->add (container, child); + GTK_CONTAINER_CLASS (gtk_viewport_parent_class)->add (container, child); } static void |