[nautilus/gnome-3-20] floating-bar: make the stop smaller than normal buttons



commit 510df65843192f42630b3a6113ebd6cc2dee1147
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Mar 7 21:03:19 2016 +0100

    floating-bar: make the stop smaller than normal buttons
    
    With the latest changes on gtk+ the button sizing changed and made
    the button in the floating bar taller.
    
    To fix it, remove the padding from the button.
    Also improve how the button is created using the "new" gtk+ functions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763249

 src/nautilus-floating-bar.c   |   15 ++++++++-------
 src/resources/css/Adwaita.css |    4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index da1bde0..7345f71 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -478,14 +478,15 @@ nautilus_floating_bar_add_action (NautilusFloatingBar *self,
                                  const gchar *icon_name,
                                  gint action_id)
 {
-       GtkWidget *w, *button;
-
-       w = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
-       gtk_widget_show (w);
+       GtkWidget *button;
+       GtkStyleContext *context;
 
-       button = gtk_button_new ();
-       gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-       gtk_button_set_image (GTK_BUTTON (button), w);
+       button = gtk_button_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+       context = gtk_widget_get_style_context (button);
+       gtk_button_set_relief (button, GTK_RELIEF_NONE);
+       gtk_style_context_add_class (context, "circular");
+       gtk_style_context_add_class (context, "flat");
+       gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
        gtk_box_pack_end (GTK_BOX (self), button, FALSE, FALSE, 0);
        gtk_widget_show (button);
 
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 8c79677..0d20f21 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -63,7 +63,7 @@
 
 /* Floating status bar */
 .floating-bar {
-  padding: 2px;
+  padding: 1px;
   background-color: @theme_base_color;
   border-width: 1px;
   border-style: solid solid none;
@@ -86,7 +86,7 @@
 }
 
 .floating-bar button {
-    padding: 4px;
+  padding: 0px;
 }
 
 .search-bar {


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