[geary] Toolbar buttons too small: Closes bgo#723578



commit 6d7489e81d0c6855759c159ae2c48bb5d3070892
Author: Jim Nelson <jim yorba org>
Date:   Tue Feb 4 11:18:19 2014 -0800

    Toolbar buttons too small: Closes bgo#723578
    
    A partial revert of bgo#713837 (commit:a70d47) which was too
    aggressive in removing extra space from toolbar buttons.

 src/client/components/pill-toolbar.vala |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/client/components/pill-toolbar.vala b/src/client/components/pill-toolbar.vala
index ac86bb4..8bbe18c 100644
--- a/src/client/components/pill-toolbar.vala
+++ b/src/client/components/pill-toolbar.vala
@@ -21,6 +21,7 @@ public class PillToolbar : Gtk.Toolbar {
         b.image = new Gtk.Image.from_icon_name(icon_name != null ? icon_name :
             b.related_action.icon_name, Gtk.IconSize.MENU);
         b.always_show_image = true;
+        b.image.margin = get_icon_margin();
         
         if (!show_label)
             b.label = null;
@@ -94,6 +95,19 @@ public class PillToolbar : Gtk.Toolbar {
     }
     
     /**
+-     * Computes the margin for each icon (shamelessly stolen from Nautilus.)
+-     */
+    private int get_icon_margin() {
+        Gtk.IconSize toolbar_size = get_icon_size();
+        int toolbar_size_px, menu_size_px;
+        
+        Gtk.icon_size_lookup(Gtk.IconSize.MENU, out menu_size_px, null);
+        Gtk.icon_size_lookup(toolbar_size, out toolbar_size_px, null);
+        
+        return Geary.Numeric.int_floor((int) ((toolbar_size_px - menu_size_px) / 2.0), 0);
+    }
+    
+    /**
      * Returns an expandable spacer item.
      */
     public Gtk.ToolItem create_spacer() {


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