]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkaspectframe.c
Include "config.h" instead of <config.h> Command used: find -name
[~andy/gtk] / gtk / gtkaspectframe.c
index ef5b833230b3040d299fdd34f1f781e05a185fb4..2661b29d2bc3245751bc39012e26be7d230f5d63 100644 (file)
@@ -29,8 +29,9 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 #include "gtkaspectframe.h"
+#include "gtkprivate.h"
 #include "gtkintl.h"
 #include "gtkalias.h"
 
@@ -42,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,
@@ -58,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, "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)
@@ -94,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;
   
@@ -104,36 +73,34 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
 
   frame_class->compute_child_allocation = gtk_aspect_frame_compute_child_allocation;
 
-#define STATIC_STRINGS G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
-
   g_object_class_install_property (gobject_class,
                                    PROP_XALIGN,
                                    g_param_spec_float ("xalign",
                                                        P_("Horizontal Alignment"),
                                                        P_("X alignment of the child"),
                                                        0.0, 1.0, 0.5,
-                                                       G_PARAM_READWRITE | STATIC_STRINGS));
+                                                       GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_YALIGN,
                                    g_param_spec_float ("yalign",
                                                        P_("Vertical Alignment"),
                                                        P_("Y alignment of the child"),
                                                        0.0, 1.0, 0.5,
-                                                       G_PARAM_READWRITE | STATIC_STRINGS));
+                                                       GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_RATIO,
                                    g_param_spec_float ("ratio",
                                                        P_("Ratio"),
                                                        P_("Aspect ratio if obey_child is FALSE"),
-                                                       MIN_RATIO, MAX_RATIO, 0.5,
-                                                       G_PARAM_READWRITE | STATIC_STRINGS));
+                                                       MIN_RATIO, MAX_RATIO, 1.0,
+                                                       GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_OBEY_CHILD,
                                    g_param_spec_boolean ("obey-child",
                                                          P_("Obey child"),
                                                          P_("Force aspect ratio to match that of the frame's child"),
                                                          TRUE,
-                                                         G_PARAM_READWRITE | STATIC_STRINGS));
+                                                         GTK_PARAM_READWRITE));
 }
 
 static void
@@ -278,7 +245,7 @@ gtk_aspect_frame_set (GtkAspectFrame *aspect_frame,
       if (aspect_frame->obey_child != obey_child)
         {
           aspect_frame->obey_child = obey_child;
-          g_object_notify (G_OBJECT (aspect_frame), "obey_child");
+          g_object_notify (G_OBJECT (aspect_frame), "obey-child");
         }
       g_object_thaw_notify (G_OBJECT (aspect_frame));
 
@@ -318,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)
        {
@@ -335,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__