[Xfce4-commits] <thunarx-python:master> Allow thunarx-python to work with thunarx-1 (i.e. versions that use thunar-vfs)

Adam Plumb noreply at xfce.org
Thu May 27 18:14:26 CEST 2010


Updating branch refs/heads/master
         to 8bc31c1af4e39167e74425d17b2bc1427d1a6ec7 (commit)
       from 6047ce63d3c021f74252e1c19733c754c402e880 (commit)

commit 8bc31c1af4e39167e74425d17b2bc1427d1a6ec7
Author: Adam Plumb <adamplumb at gmail.com>
Date:   Tue Jan 26 11:18:00 2010 -0500

    Allow thunarx-python to work with thunarx-1 (i.e. versions that use thunar-vfs)

 configure.ac.in      |   21 ++++++++++++---
 src/Makefile.am      |    7 ++---
 src/thunarx.defs     |   18 -------------
 src/thunarx.override |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+), 26 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 87c73d8..367f4fd 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -30,7 +30,6 @@ dnl ***************************
 dnl *** Initialize automake ***
 dnl ***************************
 AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
-AC_PREFIX_DEFAULT([$(pkg-config --variable prefix thunarx-2 || echo /usr)])
 AM_CONFIG_HEADER([config.h])
 AM_MAINTAINER_MODE()
 
@@ -68,10 +67,24 @@ AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
 AM_CHECK_PYTHON_LIBS(,[AC_MSG_ERROR(could not find Python lib)])
 
 
+dnl ***************************
+dnl *** Determine the installed thunarx version ***
+dnl ***************************
+if test "`pkg-config --variable prefix thunarx-2`" != ""; then
+    THUNARX_API_VERSION=2
+    AC_PREFIX_DEFAULT([$(pkg-config --variable prefix thunarx-2 || echo /usr)])
+    XDT_CHECK_PACKAGE([THUNARX], [thunarx-2], [1.0.1])
+else
+    THUNARX_API_VERSION=1
+    AC_PREFIX_DEFAULT([$(pkg-config --variable prefix thunarx-1 || echo /usr)])
+    XDT_CHECK_PACKAGE([THUNARX], [thunarx-1], [0.4.0])
+fi
+AC_SUBST(THUNARX_API_VERSION)
+
+
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([THUNARX], [thunarx-2])
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.6.0])
 XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.6.0])
@@ -87,7 +100,7 @@ AC_SUBST(PYTHON_CFLAGS)
 AC_SUBST(PYTHON_LIBS)
 AC_SUBST(PYTHON_LDFLAGS)
 
-THUNARX_LIBDIR=`pkg-config --variable=libdir thunarx-2`
+THUNARX_LIBDIR=`pkg-config --variable=libdir thunarx-${THUNARX_API_VERSION}`
 AC_SUBST(THUNARX_LIBDIR)
 AC_DEFINE_UNQUOTED(THUNARX_LIBDIR, "$THUNARX_LIBDIR", [Thunarx libdir])
 
@@ -109,7 +122,7 @@ AC_MSG_RESULT($PYGTK_CODEGEN)
 dnl ---------------------------------
 dnl Get thunar extensions directory
 dnl ---------------------------------
-THUNARX_EXTENSION_DIR=`$PKG_CONFIG --variable=extensionsdir thunarx-2`
+THUNARX_EXTENSION_DIR=`$PKG_CONFIG --variable=extensionsdir thunarx-${THUNARX_API_VERSION}`
 AC_SUBST(THUNARX_EXTENSION_DIR)
 AC_DEFINE_UNQUOTED(THUNARX_EXTENSION_DIR, "$THUNARX_EXTENSION_DIR", [Thunar's extensions directory])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index ec2e10f..3874099 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,9 +6,10 @@ AM_CPPFLAGS =								\
 	-DEXO_API_SUBJECT_TO_CHANGE					\
 	-DLIBEXECDIR=\"$(libexecdir)\"					\
 	-DPY_LIB_LOC=\"$(PYTHON_LIB_LOC)\"				\
-	-DPYTHON_VERSION=\"$(PYTHON_VERSION)\"
+	-DPYTHON_VERSION=\"$(PYTHON_VERSION)\"				\
+	-DTHUNARX_API_VERSION=$(THUNARX_API_VERSION)
 
-extensionsdir = $(THUNARX_LIBDIR)/thunarx-2
+extensionsdir = $(THUNARX_LIBDIR)/thunarx-$(THUNARX_API_VERSION)
 extensions_LTLIBRARIES =						\
 	thunarx-python.la
 
@@ -70,8 +71,6 @@ EXTRA_DIST = thunarx.override thunarx.defs
 	    --register $(PYGTK_DEFSDIR)/pango-types.defs \
             --register $(PYGTK_DEFSDIR)/gdk-types.defs \
             --register $(PYGTK_DEFSDIR)/gtk-types.defs \
-            --register $(PYGOBJECT_DEFSDIR)/gio-types.defs \
-            --register $(PYGOBJECT_DEFSDIR)/unix-types.defs \
             --override $*.override \
             --prefix py$* $*.defs) > gen-$*.c \
         && cp gen-$*.c $*.c \
diff --git a/src/thunarx.defs b/src/thunarx.defs
index 746319e..dd94103 100644
--- a/src/thunarx.defs
+++ b/src/thunarx.defs
@@ -119,24 +119,6 @@
   (return-type "gboolean")
 )
 
-(define-method get_file_info
-  (of-object "ThunarxFileInfo")
-  (c-name "thunarx_file_info_get_file_info")
-  (return-type "GFileInfo*")
-)
-
-(define-method get_filesystem_info
-  (of-object "ThunarxFileInfo")
-  (c-name "thunarx_file_info_get_filesystem_info")
-  (return-type "GFileInfo*")
-)
-
-(define-method get_location
-  (of-object "ThunarxFileInfo")
-  (c-name "thunarx_file_info_get_location")
-  (return-type "GFile*")
-)
-
 (define-method changed
   (of-object "ThunarxFileInfo")
   (c-name "thunarx_file_info_changed")
diff --git a/src/thunarx.override b/src/thunarx.override
index 06a3452..d4b1832 100644
--- a/src/thunarx.override
+++ b/src/thunarx.override
@@ -311,3 +311,70 @@ _wrap_ThunarxRenamer__proxy_do_save(ThunarxRenamer  *self,
     Py_DECREF(py_self);
     pyg_gil_state_release(__py_state);
 }
+%%
+define ThunarxFileInfo.get_file_info
+static PyObject *
+_wrap_thunarx_file_info_get_file_info(PyGObject *self)
+{
+#if THUNARX_API_VERSION >= 2
+    GFileInfo *ret;
+    
+    ret = thunarx_file_info_get_file_info(THUNARX_FILE_INFO(self->obj));
+    
+    /* pygobject_new handles NULL checking */
+    return pygobject_new((GObject *)ret);
+#else
+    g_warning("thunarx_file_info.get_file_info is not implemented for your version of Thunar");
+
+    Py_DECREF(Py_None);
+    return Py_None;
+#endif
+}
+%%
+define ThunarxFileInfo.get_filesystem_info
+static PyObject *
+_wrap_thunarx_file_info_get_filesystem_info(PyGObject *self)
+{
+#if THUNARX_API_VERSION >= 2
+    GFileInfo *ret;
+    
+    ret = thunarx_file_info_get_filesystem_info(THUNARX_FILE_INFO(self->obj));
+    
+    /* pygobject_new handles NULL checking */
+    return pygobject_new((GObject *)ret);
+#else
+    g_warning("thunarx_file_info.get_filesystem_info is not implemented for your version of Thunar");
+        
+    Py_DECREF(Py_None);
+    return Py_None;
+#endif
+}
+%%
+define ThunarxFileInfo.get_location
+static PyObject *
+_wrap_thunarx_file_info_get_location(PyGObject *self)
+{
+#if THUNARX_API_VERSION >= 2
+    GFile *ret;
+    
+    ret = thunarx_file_info_get_location(THUNARX_FILE_INFO(self->obj));
+    
+    /* pygobject_new handles NULL checking */
+    return pygobject_new((GObject *)ret);
+#else
+    g_warning("thunarx_file_info.get_location is not implemented for your version of Thunar");
+
+    Py_DECREF(Py_None);
+    return Py_None;
+#endif
+}
+%%
+define ThunarxFileInfo.get_vfs_info
+static PyObject *
+_wrap_thunarx_file_info_get_vfs_info(PyGObject *self)
+{
+    g_warning("thunarx_file_info.get_vfs_info is not implemented for your version of Thunar");
+
+    Py_DECREF(Py_None);
+    return Py_None;
+}



More information about the Xfce4-commits mailing list