diff options
author | leigh123linux <[email protected]> | 2017-07-21 11:43:56 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-07-26 16:42:36 +0200 |
commit | adcc63097ffb93621d5d3919bc4351ac149cdc7b (patch) | |
tree | e7a2d5726406104e6003aa3aef3e6d028ba78f5b /src | |
parent | 1ec84bbf069254332c475a8b6b88e306d4e86168 (diff) | |
download | python-caja-adcc63097ffb93621d5d3919bc4351ac149cdc7b.tar.bz2 python-caja-adcc63097ffb93621d5d3919bc4351ac149cdc7b.tar.xz |
Added gi.require_version()
taken from:
https://github.com/linuxmint/nemo-extensions/commit/67cc631
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-python.c | 15 |
1 files changed, 14 insertions, 1 deletions
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) { |