[gtk/matthiasc/for-master: 2/2] button: Center images



commit b5267220005bf82949951777533df6257cfacaa8
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jun 15 12:23:32 2020 -0400

    button: Center images
    
    If we leave the valign to be the default fill, then
    the images pick up baseline alignment from the environment,
    which can occasionally lead to misplaced -/+ icons in
    spinbuttons, for example in the "Page Setup" tab of
    the print dialog.

 gtk/gtkbutton.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index dc96c752b1..425bac0675 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -973,6 +973,7 @@ gtk_button_set_icon_name (GtkButton  *button,
     {
       GtkWidget *child = gtk_image_new_from_icon_name (icon_name);
       gtk_button_set_child (GTK_BUTTON (button), child);
+      gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
       gtk_widget_remove_css_class (GTK_WIDGET (button), "text-button");
       gtk_widget_add_css_class (GTK_WIDGET (button), "image-button");
     }


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