From d1d2a708b1607520b082830dd590a03dc1fb70d3 Mon Sep 17 00:00:00 2001 From: leigh123linux Date: Fri, 21 Jul 2017 11:43:56 +0200 Subject: Added gi.require_version() taken from: https://github.com/linuxmint/nemo-extensions/commit/67cc631 --- src/caja-python.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/caja-python.c b/src/caja-python.c index 10d23b5..03a5c67 100644 --- a/src/caja-python.c +++ b/src/caja-python.c @@ -157,7 +157,7 @@ caja_python_load_dir (GTypeModule *module, static gboolean caja_python_init_python (void) { - PyObject *caja; + PyObject *gi, *require_version, *args, *caja; GModule *libpython; char *argv[] = { "caja", NULL }; @@ -204,6 +204,19 @@ caja_python_init_python (void) /* import caja */ g_setenv("INSIDE_CAJA_PYTHON", "", FALSE); debug("import caja"); + gi = PyImport_ImportModule ("gi"); + if (!gi) { + g_critical ("can't find gi"); + return FALSE; + } + + require_version = PyObject_GetAttrString (gi, (char *) "require_version"); + args = PyTuple_Pack (2, PyUnicode_FromString ("Caja"), + PyUnicode_FromString ("2.0")); + PyObject_CallObject (require_version, args); + Py_DECREF (require_version); + Py_DECREF (args); + Py_DECREF (gi); caja = PyImport_ImportModule("gi.repository.Caja"); if (!caja) { -- cgit v1.2.1