pygobject r933 - in trunk: . gio tests
- From: paulp svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r933 - in trunk: . gio tests
- Date: Sat, 9 Aug 2008 15:09:42 +0000 (UTC)
Author: paulp
Date: Sat Aug 9 15:09:42 2008
New Revision: 933
URL: http://svn.gnome.org/viewvc/pygobject?rev=933&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/gio/gio.defs
trunk/tests/test_gicon.py
Modified: trunk/gio/gio.defs
==============================================================================
--- trunk/gio/gio.defs (original)
+++ trunk/gio/gio.defs Sat Aug 9 15:09:42 2008
@@ -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
Modified: trunk/tests/test_gicon.py
==============================================================================
--- trunk/tests/test_gicon.py (original)
+++ trunk/tests/test_gicon.py Sat Aug 9 15:09:42 2008
@@ -8,21 +8,21 @@
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 @@
'<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 @@
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")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]