[banshee] [Preferences] Have source list use theme icon size (bgo#611796)



commit 7a75b5e44990840bd019943a84799242be1b54d3
Author: Jensen Somers <jensen jsomers be>
Date:   Sat Dec 4 16:48:43 2010 +0100

    [Preferences] Have source list use theme icon size (bgo#611796)
    
    Signed-off-by: Gabriel Burt <gabriel burt gmail com>

 .../Banshee.Gui/IconThemeUtils.cs                  |   18 ++++++++++++++++++
 .../Banshee.Preferences.Gui/PageComboBox.cs        |    2 +-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs
index 65f8ba7..4bebb1e 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/IconThemeUtils.cs
@@ -34,7 +34,10 @@ namespace Banshee.Gui
 {
     public static class IconThemeUtils
     {
+        private const int DEFAULT_MENU_ICON_SIZE = 22;
+
         private static Assembly executing_assembly = Assembly.GetExecutingAssembly ();
+        private static int menu_icon_size = GetIconSize (IconSize.Menu);
 
         public static bool HasIcon (string name)
         {
@@ -58,6 +61,11 @@ namespace Banshee.Gui
             return null;
         }
 
+        public static Gdk.Pixbuf LoadIcon (string name)
+        {
+            return LoadIcon (executing_assembly, name, menu_icon_size, true);
+        }
+
         public static Gdk.Pixbuf LoadIcon (string name, int size)
         {
             return LoadIcon (executing_assembly, name, size, true);
@@ -115,5 +123,15 @@ namespace Banshee.Gui
 
             return null;
         }
+
+        public static int GetIconSize (IconSize icon_size)
+        {
+            int width, height;
+            if (Icon.SizeLookup (icon_size, out width, out height)) {
+                return width;
+            }
+
+            return DEFAULT_MENU_ICON_SIZE;
+        }
     }
 }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs b/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs
index 8d9d427..0f65a2c 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs
@@ -59,7 +59,7 @@ namespace Banshee.Preferences.Gui
 
             foreach (Page page in pages) {
                 model.AppendValues (
-                    Banshee.Gui.IconThemeUtils.LoadIcon (page.IconName, 22),
+                    Banshee.Gui.IconThemeUtils.LoadIcon (page.IconName),
                     String.Format ("<b>{0}</b>", page.Name),
                     page.Order,
                     page



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