/* -*- Mode: C; c-basic-offset: 4 -*-
 * pygobject - Python bindings for GObject
 * Copyright (C) 2008 Gian Mario Tagliaretti
 *
 *   gapplaunchcontext.override: module overrides for GAppLaunchContext
 *
 * 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_app_launch_context_get_display kwargs
static PyObject *
_wrap_g_app_launch_context_get_display(PyGObject *self,
                                       PyObject *args,
                                       PyObject *kwargs)
{
    static char *kwlist[] = { "info", "files", NULL };

    GList *file_list = NULL;
    PyGObject *py_info;
    PyObject *pyfile_list;
    gchar *ret;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
			    "O!O:gio.AppLaunchContext.get_display",
			    kwlist,
			    &PyGAppInfo_Type, &py_info, &pyfile_list))
        return NULL;

    if (!PySequence_Check (pyfile_list)) {
        PyErr_Format (PyExc_TypeError,
                      "argument must be a list or tuple of GFile objects");
        return NULL;
    }

    file_list = pygio_pylist_to_gfile_glist(pyfile_list);

    ret = g_app_launch_context_get_display(G_APP_LAUNCH_CONTEXT(self->obj),
                                           G_APP_INFO(py_info->obj), file_list);
    g_list_free(file_list);

    if (ret)
        return PyString_FromString(ret);

    Py_INCREF(Py_None);
    return Py_None;
}
%%
override g_app_launch_context_get_startup_notify_id kwargs
static PyObject *
_wrap_g_app_launch_context_get_startup_notify_id(PyGObject *self,
                                                 PyObject *args,
                                                 PyObject *kwargs)
{
    static char *kwlist[] = { "info", "files", NULL };

    GList       *file_list = NULL;
    PyGObject   *py_info;
    PyObject    *pyfile_list;
    gchar       *ret;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
			    "O!O:gio.AppLaunchContext.get_startup_notify_id",
			    kwlist,
			    &PyGAppInfo_Type, &py_info, &pyfile_list))
        return NULL;

    if (!PySequence_Check (pyfile_list)) {
        PyErr_Format (PyExc_TypeError,
                      "argument must be a list or tuple of GFile objects");
        return NULL;
    }

    file_list = pygio_pylist_to_gfile_glist(pyfile_list);

    ret = g_app_launch_context_get_startup_notify_id(
                                        G_APP_LAUNCH_CONTEXT(self->obj),
                                        G_APP_INFO(py_info->obj), file_list);
    g_list_free(file_list);

    if (ret)
        return PyString_FromString(ret);

    Py_INCREF(Py_None);
    return Py_None;
}
