]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkbbox.c
Practically everything changed.
[~andy/gtk] / gtk / gtkbbox.c
index a2747e9593328295a73d57d8ae63583fdf4800e7..edb23ad00f158a3e008c4714d032a90a6833a13c 100644 (file)
@@ -1,4 +1,4 @@
-/* GTK - The GIMP Toolkit
+/* GTK - The GTK+ Toolkit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 #include "gtkbbox.h"
+#include "gtkprivate.h"
 #include "gtkintl.h"
 #include "gtkalias.h"
 
 enum {
   PROP_0,
-  PROP_LAYOUT_STYLE,
-  PROP_LAST
+  PROP_LAYOUT_STYLE
 };
 
 enum {
@@ -40,8 +40,6 @@ enum {
   CHILD_PROP_SECONDARY
 };
 
-static void gtk_button_box_class_init         (GtkButtonBoxClass *klass);
-static void gtk_button_box_init               (GtkButtonBox      *box);
 static void gtk_button_box_set_property       (GObject           *object,
                                               guint              prop_id,
                                               const GValue      *value,
@@ -66,34 +64,7 @@ static void gtk_button_box_get_child_property (GtkContainer      *container,
 #define DEFAULT_CHILD_IPAD_X 4
 #define DEFAULT_CHILD_IPAD_Y 0
 
-GType
-gtk_button_box_get_type (void)
-{
-  static GType button_box_type = 0;
-
-  if (!button_box_type)
-    {
-      static const GTypeInfo button_box_info =
-      {
-       sizeof (GtkButtonBoxClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_button_box_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkButtonBox),
-       0,               /* n_preallocs */
-       (GInstanceInitFunc) gtk_button_box_init,
-       NULL,           /* value_table */
-      };
-
-      button_box_type =
-       g_type_register_static (GTK_TYPE_BOX, "GtkButtonBox",
-                               &button_box_info, G_TYPE_FLAG_ABSTRACT);
-    }
-
-  return button_box_type;
-}
+G_DEFINE_ABSTRACT_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
 
 static void
 gtk_button_box_class_init (GtkButtonBoxClass *class)
@@ -115,7 +86,6 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
   /* FIXME we need to override the "spacing" property on GtkBox once
    * libgobject allows that.
    */
-
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_int ("child-min-width",
                                                             P_("Minimum child width"),
@@ -123,7 +93,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
                                                             0,
                                                             G_MAXINT,
                                                              DEFAULT_CHILD_MIN_WIDTH,
-                                                            G_PARAM_READABLE));
+                                                            GTK_PARAM_READABLE));
 
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_int ("child-min-height",
@@ -132,7 +102,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
                                                             0,
                                                             G_MAXINT,
                                                              DEFAULT_CHILD_MIN_HEIGHT,
-                                                            G_PARAM_READABLE));
+                                                            GTK_PARAM_READABLE));
 
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_int ("child-internal-pad-x",
@@ -141,7 +111,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
                                                             0,
                                                             G_MAXINT,
                                                              DEFAULT_CHILD_IPAD_X,
-                                                            G_PARAM_READABLE));
+                                                            GTK_PARAM_READABLE));
 
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_int ("child-internal-pad-y",
@@ -150,7 +120,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
                                                             0,
                                                             G_MAXINT,
                                                              DEFAULT_CHILD_IPAD_Y,
-                                                            G_PARAM_READABLE));
+                                                            GTK_PARAM_READABLE));
   g_object_class_install_property (gobject_class,
                                    PROP_LAYOUT_STYLE,
                                    g_param_spec_enum ("layout-style",
@@ -158,7 +128,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
                                                       P_("How to layout the buttons in the box. Possible values are default, spread, edge, start and end"),
                                                      GTK_TYPE_BUTTON_BOX_STYLE,
                                                      GTK_BUTTONBOX_DEFAULT_STYLE,
-                                                      G_PARAM_READWRITE));
+                                                      GTK_PARAM_READWRITE));
 
   gtk_container_class_install_child_property (container_class,
                                              CHILD_PROP_SECONDARY,
@@ -166,7 +136,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
                                                                    P_("Secondary"),
                                                                    P_("If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons"),
                                                                    FALSE,
-                                                                   G_PARAM_READWRITE));
+                                                                   GTK_PARAM_READWRITE));
 }
 
 static void
@@ -282,12 +252,12 @@ gtk_button_box_set_layout (GtkButtonBox      *widget,
 {
   g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
   g_return_if_fail (layout_style >= GTK_BUTTONBOX_DEFAULT_STYLE &&
-                   layout_style <= GTK_BUTTONBOX_END);
+                   layout_style <= GTK_BUTTONBOX_CENTER);
 
   if (widget->layout_style != layout_style)
     {
       widget->layout_style = layout_style;
-      g_object_notify (G_OBJECT (widget), "layout_style");
+      g_object_notify (G_OBJECT (widget), "layout-style");
       gtk_widget_queue_resize (GTK_WIDGET (widget));
     }
 }
@@ -449,14 +419,11 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
   bbox = GTK_BUTTON_BOX (widget);
 
   gtk_widget_style_get (widget,
-                        "child_min_width",
-                        &width_default,
-                        "child_min_height",
-                        &height_default,
-                        "child_internal_pad_x",
-                        &ipad_x_default,
-                        "child_internal_pad_y",
-                        &ipad_y_default, NULL);
+                        "child-min-width", &width_default,
+                        "child-min-height", &height_default,
+                        "child-internal-pad-x", &ipad_x_default,
+                        "child-internal-pad-y", &ipad_y_default, 
+                       NULL);
   
   child_min_width = bbox->child_min_width   != GTK_BUTTONBOX_DEFAULT
          ? bbox->child_min_width : width_default;