diff options
author | Johan Dahlin <jdahlin@async.com.br> | 2008-04-08 20:50:46 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-04-08 20:50:46 +0000 |
commit | 5f743cddfc05aecf25b9713ae84259d2583b499e (patch) | |
tree | 66dfbc41d9afed9908dd28a2cde4fa20e46b1059 /gio/gappinfo.override | |
parent | b8ab661462d9312f4b723aa25bee8d08c5b46303 (diff) | |
download | pygobject-5f743cddfc05aecf25b9713ae84259d2583b499e.tar.gz pygobject-5f743cddfc05aecf25b9713ae84259d2583b499e.tar.xz pygobject-5f743cddfc05aecf25b9713ae84259d2583b499e.zip |
Implement GAppInfo constructor, add tests.
2008-04-08 Johan Dahlin <jdahlin@async.com.br>
* gio/Makefile.am:
* gio/__init__.py:
* gio/gappinfo.override:
* gio/gio.defs:
* gio/gio.override:
* tests/test_gio.py:
Implement GAppInfo constructor, add tests.
svn path=/trunk/; revision=772
Diffstat (limited to 'gio/gappinfo.override')
-rw-r--r-- | gio/gappinfo.override | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gio/gappinfo.override b/gio/gappinfo.override new file mode 100644 index 0000000..d41b977 --- /dev/null +++ b/gio/gappinfo.override @@ -0,0 +1,70 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gappinfo.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 + */ +%% +define _install_app_info_meta +static PyObject * +_wrap__install_app_info_meta(PyObject *self, PyObject *args) +{ + PyObject *metaclass; + + if (!PyArg_ParseTuple(args, "O", &metaclass)) + return NULL; + + Py_INCREF(metaclass); + PyGAppInfo_Type.ob_type = (PyTypeObject*)metaclass; + + Py_INCREF(Py_None); + return Py_None; +} +%% +define _app_info_init kwargs +static PyObject * +_wrap__app_info_init(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "commandline", "application_name", + "flags", NULL }; + char *commandline, *application_name = NULL; + PyObject *py_flags = NULL; + GAppInfo *ret; + GError *error = NULL; + GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s|zO:gio.AppInfo", + kwlist, + &commandline, &application_name, + &py_flags)) + return NULL; + if (py_flags && pyg_flags_get_value(G_TYPE_APP_INFO_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + return NULL; + + ret = g_app_info_create_from_commandline(commandline, + application_name, flags, &error); + + if (pyg_error_check(&error)) + return NULL; + + /* pygobject_new handles NULL checking */ + return pygobject_new((GObject *)ret); +} + |