pygobject r905 - in trunk: . gio tests



Author: johan
Date: Fri Aug  1 16:43:45 2008
New Revision: 905
URL: http://svn.gnome.org/viewvc/pygobject?rev=905&view=rev

Log:
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



Modified:
   trunk/ChangeLog
   trunk/gio/gfileinfo.override
   trunk/gio/gio.defs
   trunk/tests/test_gio.py

Modified: trunk/gio/gfileinfo.override
==============================================================================
--- trunk/gio/gfileinfo.override	(original)
+++ trunk/gio/gfileinfo.override	Fri Aug  1 16:43:45 2008
@@ -50,8 +50,21 @@
 
     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* */

Modified: trunk/gio/gio.defs
==============================================================================
--- trunk/gio/gio.defs	(original)
+++ trunk/gio/gio.defs	Fri Aug  1 16:43:45 2008
@@ -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")

Modified: trunk/tests/test_gio.py
==============================================================================
--- trunk/tests/test_gio.py	(original)
+++ trunk/tests/test_gio.py	Fri Aug  1 16:43:45 2008
@@ -429,12 +429,18 @@
 
 
 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 @@
 
     def testGetSupportedURISchemes(self):
         result = self.vfs.get_supported_uri_schemes()
-        self.failUnless(isinstance(result, [])
+        self.failUnless(type(result), [])



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