[Xfce4-commits] <thunarx-python:master> Look in /thunarx-python/extensions for scripts now. Don't look in /usr/lib/thunarx-1/python anymore

Adam Plumb noreply at xfce.org
Wed Mar 23 20:36:01 CET 2011


Updating branch refs/heads/master
         to a5dfff3a52a1c39066f030363505ccddaf1e50bf (commit)
       from a80bb9ae1fd905420c985f7831693b00923916e1 (commit)

commit a5dfff3a52a1c39066f030363505ccddaf1e50bf
Author: Adam Plumb <adamplumb at gmail.com>
Date:   Wed Mar 23 15:34:16 2011 -0400

    Look in /thunarx-python/extensions for scripts now.  Don't look in /usr/lib/thunarx-1/python anymore

 README               |    6 ++++++
 src/Makefile.am      |    1 +
 src/thunarx-python.c |   13 ++++++++++++-
 3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/README b/README
index 8977f24..ce120da 100644
--- a/README
+++ b/README
@@ -16,6 +16,12 @@ pkgconfig path.
 
     export PKG_CONFIG_PATH="/thunar_prefix/lib/pkgconfig"
 
+Running Extensions
+------------------
+As of thunarx-python 0.3.0, scripts are loaded from $XDG_DATA_DIR/thunarx-python/extensions,
+which includes ~/.local/share and /usr/share (or whatever your $XDG_DATA_DIR is 
+set to).  Simply copy your python scripts into that folder and restart thunar.
+
 Dependencies
 ------------
  * thunar (0.4.0 or later)
diff --git a/src/Makefile.am b/src/Makefile.am
index 3874099..04dc610 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@
 AM_CPPFLAGS =								\
 	-I$(top_builddir)						\
 	-I$(top_srcdir)							\
+	-DDATADIR=\"$(datadir)\"					\
 	-DG_LOG_DOMAIN=\"thunarx-python\"				\
 	-DEXO_API_SUBJECT_TO_CHANGE					\
 	-DLIBEXECDIR=\"$(libexecdir)\"					\
diff --git a/src/thunarx-python.c b/src/thunarx-python.c
index f725750..b33dcdf 100644
--- a/src/thunarx-python.c
+++ b/src/thunarx-python.c
@@ -367,6 +367,7 @@ thunarx_python_load_dir (ThunarxProviderPlugin  *plugin,
 G_MODULE_EXPORT void
 thunar_extension_initialize (ThunarxProviderPlugin *plugin)
 {
+    gchar *user_extensions_dir;
     const gchar *mismatch;
     const gchar *env_string;
 
@@ -391,7 +392,17 @@ thunar_extension_initialize (ThunarxProviderPlugin *plugin)
 
     all_types = g_array_new(FALSE, FALSE, sizeof(GType));
 
-    thunarx_provider_plugin_set_resident (plugin, TRUE);  
+    thunarx_provider_plugin_set_resident (plugin, TRUE);
+
+	// Look in the new global path, $DATADIR/thunarx-python/extensions
+	thunarx_python_load_dir(plugin, DATADIR "/thunarx-python/extensions");
+
+	// Look in XDG_DATA_DIR, ~/.local/share/thunarx-python/extensions
+	user_extensions_dir = g_build_filename(g_get_user_data_dir(), 
+		"thunarx-python", "extensions", NULL);
+	thunarx_python_load_dir(plugin, user_extensions_dir);
+	g_free(user_extensions_dir);
+	
     thunarx_python_load_dir(plugin, THUNARX_EXTENSION_DIR "/python");
 }
 



More information about the Xfce4-commits mailing list