summaryrefslogtreecommitdiff
path: root/gtk/gtkaspectframe.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2006-05-02 23:56:43 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-05-02 23:56:43 +0000
commitf26aad1916445d25c99878138dfc384de67a2060 (patch)
treeb72263ecb326e82a49f1e8d1871ec4288b8aa299 /gtk/gtkaspectframe.c
parent33cddd12d78abb2efe6facba9c859017f8df9819 (diff)
downloadgtk+-f26aad1916445d25c99878138dfc384de67a2060.tar.gz
Boilerplate reduction
Diffstat (limited to 'gtk/gtkaspectframe.c')
-rw-r--r--gtk/gtkaspectframe.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c
index f15ccec17c..5606752f0b 100644
--- a/gtk/gtkaspectframe.c
+++ b/gtk/gtkaspectframe.c
@@ -43,8 +43,6 @@ enum {
PROP_OBEY_CHILD
};
-static void gtk_aspect_frame_class_init (GtkAspectFrameClass *klass);
-static void gtk_aspect_frame_init (GtkAspectFrame *aspect_frame);
static void gtk_aspect_frame_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -59,35 +57,7 @@ static void gtk_aspect_frame_compute_child_allocation (GtkFrame *fram
#define MAX_RATIO 10000.0
#define MIN_RATIO 0.0001
-static GtkFrameClass *parent_class = NULL;
-
-GType
-gtk_aspect_frame_get_type (void)
-{
- static GType aspect_frame_type = 0;
-
- if (!aspect_frame_type)
- {
- static const GTypeInfo aspect_frame_info =
- {
- sizeof (GtkAspectFrameClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_aspect_frame_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkAspectFrame),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_aspect_frame_init,
- };
-
- aspect_frame_type =
- g_type_register_static (GTK_TYPE_FRAME, I_("GtkAspectFrame"),
- &aspect_frame_info, 0);
- }
-
- return aspect_frame_type;
-}
+G_DEFINE_TYPE (GtkAspectFrame, gtk_aspect_frame, GTK_TYPE_FRAME);
static void
gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
@@ -95,8 +65,6 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
GObjectClass *gobject_class;
GtkFrameClass *frame_class;
- parent_class = g_type_class_peek_parent (class);
-
gobject_class = (GObjectClass*) class;
frame_class = (GtkFrameClass*) class;
@@ -317,7 +285,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
else
ratio = aspect_frame->ratio;
- parent_class->compute_child_allocation (frame, &full_allocation);
+ GTK_FRAME_CLASS (gtk_aspect_frame_parent_class)->compute_child_allocation (frame, &full_allocation);
if (ratio * full_allocation.height > full_allocation.width)
{
@@ -334,7 +302,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
child_allocation->y = full_allocation.y + aspect_frame->yalign * (full_allocation.height - child_allocation->height);
}
else
- parent_class->compute_child_allocation (frame, child_allocation);
+ GTK_FRAME_CLASS (gtk_aspect_frame_parent_class)->compute_child_allocation (frame, child_allocation);
}
#define __GTK_ASPECT_FRAME_C__