[gtk+] button box: Set linked style for extend



commit 1258eadd7501d47111074997da4e2339c3f04b4f
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 17 12:39:30 2014 -0500

    button box: Set linked style for extend
    
    This is needed for proper styling of the new extend-placement
    in button boxes.

 gtk/gtkbbox.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index becdca2..58bed64 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -133,6 +133,13 @@ static void gtk_button_box_get_child_property (GtkContainer      *container,
 G_DEFINE_TYPE_WITH_PRIVATE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
 
 static void
+gtk_button_box_add (GtkContainer *container,
+                    GtkWidget    *widget)
+{
+  gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+}
+
+static void
 gtk_button_box_class_init (GtkButtonBoxClass *class)
 {
   GtkWidgetClass *widget_class;
@@ -154,6 +161,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
   widget_class->size_allocate = gtk_button_box_size_allocate;
 
   container_class->remove = gtk_button_box_remove;
+  container_class->add = gtk_button_box_add;
   container_class->set_child_property = gtk_button_box_set_child_property;
   container_class->get_child_property = gtk_button_box_get_child_property;
   gtk_container_class_handle_border_width (container_class);
@@ -349,10 +357,18 @@ gtk_button_box_set_layout (GtkButtonBox      *widget,
   if (priv->layout_style != layout_style)
     {
       priv->layout_style = layout_style;
+
       if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
-        gtk_box_set_homogeneous (GTK_BOX (widget), TRUE);
+        {
+          gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (widget)), "linked");
+          gtk_box_set_homogeneous (GTK_BOX (widget), TRUE);
+        }
       else
-        gtk_box_set_homogeneous (GTK_BOX (widget), FALSE);
+        {
+          gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (widget)), "linked");
+          gtk_box_set_homogeneous (GTK_BOX (widget), FALSE);
+        }
+
       g_object_notify (G_OBJECT (widget), "layout-style");
       gtk_widget_queue_resize (GTK_WIDGET (widget));
     }
@@ -435,8 +451,7 @@ gtk_button_box_set_child_secondary (GtkButtonBox *widget,
 
   if (bbox->priv->layout_style == GTK_BUTTONBOX_EXPAND)
     {
-      gtk_box_set_child_packing (GTK_BOX (bbox), child, TRUE, TRUE, 0,
-                                 is_secondary ? GTK_PACK_START : GTK_PACK_END);
+      gtk_box_reorder_child (GTK_BOX (bbox), child, is_secondary ? 0 : -1);
     }
 
   if (gtk_widget_get_visible (GTK_WIDGET (widget)) &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]