[gtk+] GtkHeaderBar: Center buttons



commit ea8bb7e0ea4cea093d977d616512695eee36d27b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Dec 14 22:32:11 2013 -0500

    GtkHeaderBar: Center buttons
    
    Header bars can get taller than the buttons require, and we don't
    want them to extend all the way. Center them instead.

 gtk/gtkheaderbar.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 7905509..e0a35b6 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -359,6 +359,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
               if (strcmp (t[j], "icon") == 0)
                 {
                   button = gtk_image_new ();
+                  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
                   priv->titlebar_icon = button;
                   gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
                   gtk_widget_set_size_request (button, 20, 20);
@@ -373,6 +374,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
               else if (strcmp (t[j], "menu") == 0 && menu != NULL)
                 {
                   button = gtk_menu_button_new ();
+                  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
                   gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
                   gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
                   image = gtk_image_new ();
@@ -391,6 +393,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
                        gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
                 {
                   button = gtk_button_new ();
+                  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
                   gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
                   image = gtk_image_new_from_icon_name ("window-minimize-symbolic", GTK_ICON_SIZE_MENU);
                   g_object_set (image, "use-fallback", TRUE, NULL);
@@ -413,6 +416,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
 
                   icon_name = maximized ? "window-restore-symbolic" : "window-maximize-symbolic";
                   button = gtk_button_new ();
+                  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
                   gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
                   image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
                   g_object_set (image, "use-fallback", TRUE, NULL);
@@ -431,6 +435,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
                        gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
                 {
                   button = gtk_button_new ();
+                  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
                   image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
                   gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
                   g_object_set (image, "use-fallback", TRUE, NULL);


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