[gtk+/wip/matthiasc/kill-event-signals] toolbutton: Fix off-center icons



commit 95af0b64b6dfd63776310b066c461c0b4366e792
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 7 12:42:27 2018 -0500

    toolbutton: Fix off-center icons
    
    When the toolbar style is both-horiz, and the item
    is not important, we were not centering the icon in the
    same way as in gtk3. The reason is that we overlooked
    the expand child property being set to TRUE in this case.

 gtk/gtktoolbutton.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 4286a8e..5f25715 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -514,7 +514,11 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
        {
           box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
          if (icon)
-            gtk_box_pack_start (GTK_BOX (box), icon);
+            {
+              gtk_box_pack_start (GTK_BOX (box), icon);
+              if (!label)
+                gtk_widget_set_hexpand (icon, TRUE);
+            }
          if (label)
             gtk_box_pack_end (GTK_BOX (box), label);
        }
@@ -522,7 +526,11 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
        {
           box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
          if (icon)
-            gtk_box_pack_end (GTK_BOX (box), icon);
+            {
+              gtk_box_pack_end (GTK_BOX (box), icon);
+              if (!label)
+                gtk_widget_set_vexpand (icon, TRUE);
+            }
          if (label)
             gtk_box_pack_start (GTK_BOX (box), label);
        }


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