← Back to team overview

elementaryart team mailing list archive

[Merge] lp:~xapantu/granite/fix-956544 into lp:granite

 

xapantu has proposed merging lp:~xapantu/granite/fix-956544 into lp:granite.

Requested reviews:
  elementary Pantheon team (elementary-pantheon)
Related bugs:
  Bug #956544 in Granite: "dynamic notebook should use window-close"
  https://bugs.launchpad.net/granite/+bug/956544

For more details, see:
https://code.launchpad.net/~xapantu/granite/fix-956544/+merge/98269

Fix bug #956544
-- 
https://code.launchpad.net/~xapantu/granite/fix-956544/+merge/98269
Your team elementaryart (old) is subscribed to branch lp:granite.
=== modified file 'lib/Widgets/DynamicNotebook.vala'
--- lib/Widgets/DynamicNotebook.vala	2012-03-19 18:39:32 +0000
+++ lib/Widgets/DynamicNotebook.vala	2012-03-19 19:27:35 +0000
@@ -158,6 +158,33 @@
     public signal void switch_page (Tab tab);
     public signal void page_removed (Tab tab);
 
+    // FIXME: probably needs to be moved somewhere with a public API
+    Gdk.Pixbuf load_pixbuf_with_fallbacks (string[] icons_name, int icon_size) {
+        Gdk.Pixbuf pixbuf = null;
+        foreach (var icon_name in icons_name) {
+            try {
+                var icon_info = Gtk.IconTheme.get_default ().lookup_icon (icon_name, icon_size, 0);
+                if (icon_info != null) {
+                    pixbuf = icon_info.load_symbolic_for_context (button_context, null);
+                }
+            }
+            catch (Error e) {
+                debug ("The icon %s is not present in the theme, let's try the next one.", icon_name);
+            }
+            if (pixbuf != null) {
+                return pixbuf;
+            }
+        }
+        try {
+            pixbuf = Gtk.IconTheme.get_default ().load_icon ("gtk-missing-image", icon_size, 0);
+        }
+        catch (Error e) {
+            error ("gtk-missing-image not found");
+        }
+        return pixbuf;
+    }
+
+
     public Tabs () {
         tabs = new Gee.ArrayList<Tab>();
         
@@ -175,11 +202,6 @@
             }
         }
 
-        try {
-            close_pixbuf = Gtk.IconTheme.get_default ().load_icon ("gtk-close", close_size, 0);
-        }
-        catch (Error e) {
-        }
 
         height_request = 35;
         width_request = (int)(2*max_width);
@@ -229,6 +251,7 @@
             }
             return true;
         });
+        close_pixbuf = load_pixbuf_with_fallbacks ( {"window-close-symbolic", "window-close", "gtk-close"}, close_size);
     }
 
     public void add_tab (Tab tab) {


Follow ups