[pygobject] GtkIconView: Add a default value for the model constructor parameter



commit 2f7789a5a1f55ec38c5ff0f96bc5c9023679a333
Author: Johan Dahlin <johan gnome org>
Date:   Fri Mar 16 16:05:55 2012 -0300

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

 gi/overrides/Gtk.py     |    3 +++
 tests/test_overrides.py |   11 +++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index c4f519e..83631a2 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -552,6 +552,9 @@ __all__.append('RecentChooserDialog')
 
 class IconView(Gtk.IconView):
 
+    def __init__(self, model=None):
+        Gtk.IconView.__init__(self, model=model)
+
     def get_item_at_pos(self, x, y):
         success, path, cell = super(IconView, self).get_item_at_pos(x, y)
         if success:
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 7e069b4..3794215 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1804,6 +1804,17 @@ class TestGtk(unittest.TestCase):
         self.assertTrue(hasattr(widget.drag_dest_set_proxy, '__call__'))
         self.assertTrue(hasattr(widget.drag_get_data, '__call__'))
 
+    def test_iconview(self):
+        # PyGTK compat
+        iconview = Gtk.IconView()
+        self.assertEquals(iconview.props.model, None)
+
+        model = Gtk.ListStore(str)
+        iconview = Gtk.IconView(model)
+
+        self.assertEquals(iconview.props.model, model)
+
+
 class TestGio(unittest.TestCase):
     def setUp(self):
         os.environ['GSETTINGS_BACKEND'] = 'memory'



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