[pygobject] GtkIconSet: Add a default value for the pixbuf constructor parameter



commit 43c761d9f35252dcb58b9cf2278016d841eea4ec
Author: Johan Dahlin <johan gnome org>
Date:   Fri Mar 16 16:08:23 2012 -0300

    GtkIconSet: Add a default value for the pixbuf constructor parameter
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672260

 gi/overrides/Gtk.py     |   11 +++++++++++
 tests/test_overrides.py |    6 ++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 677bd4a..771f8cb 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1460,6 +1460,17 @@ Arrow = override(Arrow)
 __all__.append('Arrow')
 
 
+class IconSet(Gtk.IconSet):
+    def __new__(cls, pixbuf=None):
+        if pixbuf is not None:
+            iconset = Gtk.IconSet.new_from_pixbuf(pixbuf)
+        else:
+            iconset = Gtk.IconSet.__new__(cls)
+        return iconset
+
+IconSet = override(IconSet)
+__all__.append('IconSet')
+
 class TreeModelFilter(Gtk.TreeModelFilter):
     def set_visible_func(self, func, data=None):
         super(TreeModelFilter, self).set_visible_func(func, data)
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 5433a02..7f1cded 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1839,6 +1839,12 @@ class TestGtk(unittest.TestCase):
         button = Gtk.ToolButton('gtk-new')
         self.assertEquals(button.props.stock_id, 'gtk-new')
 
+    def test_iconset(self):
+        # PyGTK compat
+        iconset = Gtk.IconSet()
+        pixbuf = GdkPixbuf.Pixbuf()
+        iconset = Gtk.IconSet(pixbuf)
+
 
 class TestGio(unittest.TestCase):
     def setUp(self):



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