]> 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 b0c58b1c739797c8d6a84b7bb1a84f71e4a8c65d..2661b29d2bc3245751bc39012e26be7d230f5d63 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include "config.h"
 #include "gtkaspectframe.h"
+#include "gtkprivate.h"
 #include "gtkintl.h"
+#include "gtkalias.h"
 
 enum {
   PROP_0,
@@ -40,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,
@@ -56,44 +57,15 @@ 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;
-
-GtkType
-gtk_aspect_frame_get_type (void)
-{
-  static GtkType aspect_frame_type = 0;
-  
-  if (!aspect_frame_type)
-    {
-      static const GtkTypeInfo aspect_frame_info =
-      {
-       "GtkAspectFrame",
-       sizeof (GtkAspectFrame),
-       sizeof (GtkAspectFrameClass),
-       (GtkClassInitFunc) gtk_aspect_frame_class_init,
-       (GtkObjectInitFunc) gtk_aspect_frame_init,
-        /* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
-      };
-      
-      aspect_frame_type = gtk_type_unique (GTK_TYPE_FRAME, &aspect_frame_info);
-    }
-  
-  return aspect_frame_type;
-}
+G_DEFINE_TYPE (GtkAspectFrame, gtk_aspect_frame, GTK_TYPE_FRAME)
 
 static void
 gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
 {
   GObjectClass *gobject_class;
-  GtkObjectClass *object_class;
   GtkFrameClass *frame_class;
   
-  parent_class = gtk_type_class (GTK_TYPE_FRAME);
-
   gobject_class = (GObjectClass*) class;
-  object_class = (GtkObjectClass*) class;
   frame_class = (GtkFrameClass*) class;
   
   gobject_class->set_property = gtk_aspect_frame_set_property;
@@ -104,31 +76,31 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
   g_object_class_install_property (gobject_class,
                                    PROP_XALIGN,
                                    g_param_spec_float ("xalign",
-                                                       _("Horizontal Alignment"),
-                                                       _("X alignment of the child"),
+                                                       P_("Horizontal Alignment"),
+                                                       P_("X alignment of the child"),
                                                        0.0, 1.0, 0.5,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE ));
+                                                       GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_YALIGN,
                                    g_param_spec_float ("yalign",
-                                                       _("Vertical Alignment"),
-                                                       _("Y alignment of the child"),
+                                                       P_("Vertical Alignment"),
+                                                       P_("Y alignment of the child"),
                                                        0.0, 1.0, 0.5,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE ));
+                                                       GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_RATIO,
                                    g_param_spec_float ("ratio",
-                                                       _("Ratio"),
-                                                       _("Aspect ratio if obey_child is FALSE"),
-                                                       MIN_RATIO, MAX_RATIO, 0.5,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE ));
+                                                       P_("Ratio"),
+                                                       P_("Aspect ratio if obey_child is FALSE"),
+                                                       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",
-                                                         _("Obey child"),
-                                                         _("Force aspect ratio to match that of the frame's 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_READABLE | G_PARAM_WRITABLE));
+                                                         GTK_PARAM_READWRITE));
 }
 
 static void
@@ -222,7 +194,7 @@ gtk_aspect_frame_new (const gchar *label,
 {
   GtkAspectFrame *aspect_frame;
 
-  aspect_frame = gtk_type_new (gtk_aspect_frame_get_type ());
+  aspect_frame = g_object_new (GTK_TYPE_ASPECT_FRAME, NULL);
 
   aspect_frame->xalign = CLAMP (xalign, 0.0, 1.0);
   aspect_frame->yalign = CLAMP (yalign, 0.0, 1.0);
@@ -273,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));
 
@@ -313,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)
        {
@@ -330,5 +302,8 @@ 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__
+#include "gtkaliasdef.c"