gimp r24918 - in trunk: . plug-ins/pygimp



Author: yosh
Date: Tue Feb 19 10:26:06 2008
New Revision: 24918
URL: http://svn.gnome.org/viewvc/gimp?rev=24918&view=rev

Log:
2008-02-19  Manish Singh  <yosh gimp org>

        * plug-ins/pygimp/gimpmodule.c: add gimp.exit(), a wrapper around
        the PDB function gimp-quit.


Modified:
   trunk/ChangeLog
   trunk/plug-ins/pygimp/gimpmodule.c

Modified: trunk/plug-ins/pygimp/gimpmodule.c
==============================================================================
--- trunk/plug-ins/pygimp/gimpmodule.c	(original)
+++ trunk/plug-ins/pygimp/gimpmodule.c	Tue Feb 19 10:26:06 2008
@@ -275,6 +275,34 @@
 }
 
 static PyObject *
+pygimp_exit(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    gboolean force = FALSE;
+    int nreturn_vals;
+    GimpParam *return_vals;
+
+    static char *kwlist[] = { "force", NULL };
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:exit", kwlist, &force))
+        return NULL;
+
+    return_vals = gimp_run_procedure("gimp-quit",
+                                     &nreturn_vals,
+                                     GIMP_PDB_INT32, force,
+                                     GIMP_PDB_END);
+
+    if (return_vals[0].data.d_status != GIMP_PDB_SUCCESS) {
+        PyErr_SetString(pygimp_error, "error while exiting");
+        return NULL;
+    }
+
+    gimp_destroy_params(return_vals, nreturn_vals);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject *
 pygimp_set_data(PyObject *self, PyObject *args)
 {
     char *id, *data;
@@ -1659,6 +1687,7 @@
     {"main",    (PyCFunction)pygimp_main,       METH_VARARGS},
     {"quit",    (PyCFunction)pygimp_quit,       METH_NOARGS},
     {"message", (PyCFunction)pygimp_message,    METH_VARARGS},
+    {"exit",    (PyCFunction)pygimp_exit,       METH_VARARGS | METH_KEYWORDS},
     {"set_data",        (PyCFunction)pygimp_set_data,   METH_VARARGS},
     {"get_data",        (PyCFunction)pygimp_get_data,   METH_VARARGS},
     {"progress_init",   (PyCFunction)pygimp_progress_init,      METH_VARARGS},



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