summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorleigh123linux <[email protected]>2017-07-21 11:43:56 +0200
committerraveit65 <[email protected]>2017-07-21 13:56:28 +0200
commitd1d2a708b1607520b082830dd590a03dc1fb70d3 (patch)
tree2b92c93f0e6be0dc57be3e4d552b2de74fb4f17a /src
parentb9da13f659230ebea6c711da21c9887f5c399d8f (diff)
downloadpython-caja-d1d2a708b1607520b082830dd590a03dc1fb70d3.tar.bz2
python-caja-d1d2a708b1607520b082830dd590a03dc1fb70d3.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.c15
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)
{