summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-08-01 16:43:45 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-01 16:43:45 +0000
commit85612d1460845935e4c6747f8dc666d4f499dee1 (patch)
tree2e1bee13c72823f2abbae6c31d3ce44d4ea8c396
parent60d03ac1b8f211e805ea129b54d2a60b40627255 (diff)
downloadpygobject-85612d1460845935e4c6747f8dc666d4f499dee1.tar.gz
pygobject-85612d1460845935e4c6747f8dc666d4f499dee1.tar.xz
pygobject-85612d1460845935e4c6747f8dc666d4f499dee1.zip
Bug 545861 – g_file_info_get_modification_time is missing
2008-08-01 Johan Dahlin <johan@gnome.org> Bug 545861 – g_file_info_get_modification_time is missing * gio/gfileinfo.override: * gio/gio.defs: * tests/test_gio.py: Wrap, add test and documentation svn path=/trunk/; revision=905
-rw-r--r--ChangeLog8
-rw-r--r--gio/gfileinfo.override15
-rw-r--r--gio/gio.defs3
-rw-r--r--tests/test_gio.py12
4 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 6940203..3b265e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2008-08-01 Johan Dahlin <johan@gnome.org>
+ Bug 545861 – g_file_info_get_modification_time is missing
+ * gio/gfileinfo.override:
+ * gio/gio.defs:
+ * tests/test_gio.py:
+ Wrap, add test and documentation
+
+2008-08-01 Johan Dahlin <johan@gnome.org>
+
Bug 545846 – g_vfs_get_supported_uri_schemes is missing
* gio/gio.defs:
diff --git a/gio/gfileinfo.override b/gio/gfileinfo.override
index b572eaa..0827acc 100644
--- a/gio/gfileinfo.override
+++ b/gio/gfileinfo.override
@@ -50,8 +50,21 @@ _wrap_g_file_info_list_attributes(PyGObject *self,
return ret;
}
+%%
+override g_file_info_get_modification_time noargs
+static PyObject *
+_wrap_g_file_info_get_modification_time(PyGObject *self, PyObject *unused)
+{
+ GTimeVal timeval;
+ double ret;
+
+ g_file_info_get_modification_time(G_FILE_INFO(self->obj), &timeval);
+
+ ret = (double)timeval.tv_sec + (double)timeval.tv_usec * 0.000001;
+ return PyFloat_FromDouble(ret);
+}
+
/* GFileInfo.get_attribute_data: No ArgType for GFileAttributeType* */
/* GFileInfo.set_attribute: No ArgType for gpointer */
-/* GFileInfo.get_modification_time: No ArgType for GTimeVal* */
/* GFileInfo.set_attribute_mask: No ArgType for GFileAttributeMatcher* */
/* GFileInfo.set_modification_time: No ArgType for GTimeVal* */
diff --git a/gio/gio.defs b/gio/gio.defs
index be3087d..612e5c5 100644
--- a/gio/gio.defs
+++ b/gio/gio.defs
@@ -2563,6 +2563,9 @@
)
(define-method get_modification_time
+ (docstring
+"INFO.get_modification_time() -> modification time\n"
+"Returns the modification time, in UNIX time format\n")
(of-object "GFileInfo")
(c-name "g_file_info_get_modification_time")
(return-type "none")
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 39f7796..d4054de 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -429,12 +429,18 @@ class TestContentTypeGuess(unittest.TestCase):
class TestFileInfo(unittest.TestCase):
+ def setUp(self):
+ self.fileinfo = gio.File("test_gio.py").query_info("*")
+
def testListAttributes(self):
- fileinfo = gio.File("test_gio.py").query_info("*")
- attributes = fileinfo.list_attributes("standard")
+ attributes = self.fileinfo.list_attributes("standard")
self.failUnless(attributes)
self.failUnless('standard::name' in attributes)
+ def testModificationTime(self):
+ mtime = self.fileinfo.get_modification_time()
+ self.assertEqual(type(mtime), float)
+
class TestAppInfo(unittest.TestCase):
def setUp(self):
@@ -450,4 +456,4 @@ class TestVfs(unittest.TestCase):
def testGetSupportedURISchemes(self):
result = self.vfs.get_supported_uri_schemes()
- self.failUnless(isinstance(result, [])
+ self.failUnless(type(result), [])