diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | gio/Makefile.am | 1 | ||||
-rw-r--r-- | gio/gfileinfo.override | 52 | ||||
-rw-r--r-- | gio/gio.defs | 26 | ||||
-rw-r--r-- | gio/gio.override | 1 | ||||
-rw-r--r-- | tests/test_gio.py | 9 |
6 files changed, 86 insertions, 13 deletions
@@ -1,5 +1,15 @@ 2008-04-08 Johan Dahlin <jdahlin@async.com.br> + * gio/Makefile.am: + * gio/gfileinfo.override: + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Wrap GFileInfo.list_attributes(), add tests and + set the default of GFileQueryInfoFlags args to G_FILE_QUERY_INFO_NONE. + +2008-04-08 Johan Dahlin <jdahlin@async.com.br> + * gobject/option.py: Fix a typo * tests/test_option.py: Update the tests after the latest "refactoring". diff --git a/gio/Makefile.am b/gio/Makefile.am index 482150b..d67269b 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -37,6 +37,7 @@ GIO_OVERRIDES = \ gio.override \ gfile.override \ gfileenumerator.override \ + gfileinfo.override \ ginputstream.override \ goutputstream.override \ gvolumemonitor.override diff --git a/gio/gfileinfo.override b/gio/gfileinfo.override new file mode 100644 index 0000000..aa55cac --- /dev/null +++ b/gio/gfileinfo.override @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gfile.override: module overrides for GInputStream + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ +%% +override g_file_info_list_attributes kwargs +static PyObject * +_wrap_g_file_info_list_attributes(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + char *kwlist[] = { "name_space", NULL}; + gchar *name_space; + gchar **names; + PyObject *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s:gio.FileInfo.list_attributes", + kwlist, &name_space)) + return NULL; + + names = g_file_info_list_attributes(G_FILE_INFO(self->obj), + name_space); + + ret = PyList_New(0); + while (names && *names) { + PyObject *item = PyString_FromString(names[0]); + PyList_Append(ret, item); + Py_DECREF(item); + + names++; + } + + return ret; +} diff --git a/gio/gio.defs b/gio/gio.defs index dfe70ec..32746a0 100644 --- a/gio/gio.defs +++ b/gio/gio.defs @@ -1398,7 +1398,7 @@ (return-type "GFileInfo*") (parameters '("const-char*" "attributes") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1410,7 +1410,7 @@ (return-type "none") (parameters '("const-char*" "attributes") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("int" "io_priority") '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GAsyncReadyCallback" "callback") @@ -1477,7 +1477,7 @@ (return-type "GFileEnumerator*") (parameters '("const-char*" "attributes") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1489,7 +1489,7 @@ (return-type "none") (parameters '("const-char*" "attributes") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("int" "io_priority") '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GAsyncReadyCallback" "callback") @@ -1638,7 +1638,7 @@ '("const-char*" "attribute") '("GFileAttributeType" "type") '("gpointer" "value_p") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1650,7 +1650,7 @@ (return-type "gboolean") (parameters '("GFileInfo*" "info") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1662,7 +1662,7 @@ (return-type "none") (parameters '("GFileInfo*" "info") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("int" "io_priority") '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GAsyncReadyCallback" "callback") @@ -1688,7 +1688,7 @@ (parameters '("const-char*" "attribute") '("const-char*" "value") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1701,7 +1701,7 @@ (parameters '("const-char*" "attribute") '("const-char*" "value") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1714,7 +1714,7 @@ (parameters '("const-char*" "attribute") '("guint32" "value") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1727,7 +1727,7 @@ (parameters '("const-char*" "attribute") '("gint32" "value") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1740,7 +1740,7 @@ (parameters '("const-char*" "attribute") '("guint64" "value") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) @@ -1753,7 +1753,7 @@ (parameters '("const-char*" "attribute") '("gint64" "value") - '("GFileQueryInfoFlags" "flags") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) '("GCancellable*" "cancellable" (null-ok) (default "NULL")) '("GError**" "error") ) diff --git a/gio/gio.override b/gio/gio.override index e34e5f9..41f6013 100644 --- a/gio/gio.override +++ b/gio/gio.override @@ -80,6 +80,7 @@ async_result_callback_marshal(GObject *source_object, include gfile.override gfileenumerator.override + gfileinfo.override ginputstream.override goutputstream.override gvolumemonitor.override diff --git a/tests/test_gio.py b/tests/test_gio.py index 5c1acdf..a01e270 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -229,3 +229,12 @@ class TestType(unittest.TestCase): data='<html></html>', want_uncertain=True) self.assertEquals('text/html', mime_type) self.assertEquals(bool, type(result_uncertain)) + + +class TestFileInfo(unittest.TestCase): + def testListAttributes(self): + gfile = gio.File("test_gio.py") + fileinfo = gfile.query_info("*") + attributes = fileinfo.list_attributes("standard") + self.failUnless(attributes) + self.failUnless('standard::name' in attributes) |