diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | gio/gio.defs | 10 | ||||
-rw-r--r-- | tests/test_gicon.py | 21 |
3 files changed, 32 insertions, 10 deletions
@@ -1,5 +1,16 @@ 2008-08-09 Paul Pogonyshev <pogonyshev@gmx.net> + Bug 546135 – GIcon and implementations improvements + + * gio/gio.defs (g_file_icon_new): Change from method of gio.File + to constructor of gio.FileIcon. + + * tests/test_gicon.py (TestIcon.test_eq, Test_Eq.test_hash) + (TestLoadableIcon.setUp): Adapt accordingly. + (TestFileIcon): New test case. + +2008-08-09 Paul Pogonyshev <pogonyshev@gmx.net> + Bug 546591 – File.copy progress_callback does not work * gio/gfile.override (file_progress_callback_marshal): Use diff --git a/gio/gio.defs b/gio/gio.defs index 0396d65..c083ff3 100644 --- a/gio/gio.defs +++ b/gio/gio.defs @@ -2314,10 +2314,16 @@ (return-type "GType") ) -(define-method icon_new - (of-object "GFile") +(define-function file_icon_new (c-name "g_file_icon_new") + (is-constructor-of "GFileIcon") (return-type "GIcon*") + ;; Note: starting with GLib 2.18 we could use (properties ...) + ;; instead, but I don't know if it is possible to branch on version + ;; in codegen. + (parameters + '("GFile*" "file") + ) ) (define-method get_file diff --git a/tests/test_gicon.py b/tests/test_gicon.py index 0a66c9e..b71105d 100644 --- a/tests/test_gicon.py +++ b/tests/test_gicon.py @@ -8,21 +8,21 @@ from common import gio, glib class TestIcon(unittest.TestCase): def test_eq(self): - self.assertEquals(gio.File('foo.png').icon_new(), - gio.File('foo.png').icon_new()) + self.assertEquals(gio.FileIcon(gio.File('foo.png')), + gio.FileIcon(gio.File('foo.png'))) self.assertEquals(gio.ThemedIcon('foo'), gio.ThemedIcon('foo')) - self.assertNotEqual(gio.File('foo.png').icon_new(), - gio.File('bar.png').icon_new()) + self.assertNotEqual(gio.FileIcon(gio.File('foo.png')), + gio.FileIcon(gio.File('bar.png'))) self.assertNotEquals(gio.ThemedIcon('foo'), gio.ThemedIcon('bar')) - self.assertNotEquals(gio.File('foo.png').icon_new(), + self.assertNotEquals(gio.FileIcon(gio.File('foo.png')), gio.ThemedIcon('foo')) def test_hash(self): - self.assertEquals(hash(gio.File('foo.png').icon_new()), - hash(gio.File('foo.png').icon_new())) + self.assertEquals(hash(gio.FileIcon(gio.File('foo.png'))), + hash(gio.FileIcon(gio.File('foo.png')))) self.assertEquals(hash(gio.ThemedIcon('foo')), hash(gio.ThemedIcon('foo'))) @@ -35,7 +35,7 @@ class TestLoadableIcon(unittest.TestCase): '<svg width="32" height="32"/>') self.file.write(self.svg) self.file.close() - self.icon = gio.File('temp.svg').icon_new() + self.icon = gio.FileIcon(gio.File('temp.svg')) def tearDown(self): if os.path.exists('temp.svg'): @@ -64,6 +64,11 @@ class TestLoadableIcon(unittest.TestCase): loop = glib.MainLoop() loop.run() +class TestFileIcon(unittest.TestCase): + def test_constructor(self): + file = gio.File('foo.png') + self.assert_(file is gio.FileIcon(file).get_file()) + class TestThemedIcon(unittest.TestCase): def setUp(self): self.icon = gio.ThemedIcon("open") |