[Xfce4-commits] [bindings/thunarx-python] 01/01: Improve extension loading to better follow XDG semantics
noreply at xfce.org
noreply at xfce.org
Sat Dec 23 03:15:29 CET 2017
This is an automated email from the git hooks/post-receive script.
a d a m p l u m b p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository bindings/thunarx-python.
commit bedb26aad61296af6e5c327caf3b17ec403fdf8b
Author: Adam Plumb <adamplumb at gmail.com>
Date: Fri Dec 22 21:15:21 2017 -0500
Improve extension loading to better follow XDG semantics
---
src/thunarx-python.c | 52 +++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 41 insertions(+), 11 deletions(-)
diff --git a/src/thunarx-python.c b/src/thunarx-python.c
index 91b3bcf..16a9fb7 100644
--- a/src/thunarx-python.c
+++ b/src/thunarx-python.c
@@ -231,9 +231,48 @@ thunarx_python_load_dir (ThunarxProviderPlugin *plugin,
}
}
+static void
+thunarx_python_check_all_directories(ThunarxProviderPlugin *plugin) {
+ gchar *extensions_dir = NULL;
+
+ GList *dirs = NULL;
+
+ // Check ~/.local/share first
+ dirs = g_list_append(dirs, g_build_filename(g_get_user_data_dir(),
+ "thunarx-python", "extensions", NULL));
+
+ // If thunar is built in a non-standard prefix
+ // Check that' prefix's DATADIR
+ gchar *prefix_extension_dir = DATADIR "/thunarx-python/extensions";
+ dirs = g_list_append(dirs, prefix_extension_dir);
+
+ // Check all system data dirs
+ const gchar *const *temp = g_get_system_data_dirs();
+ while (*temp != NULL) {
+ gchar *dir = g_build_filename(*temp,
+ "thunarx-python", "extensions", NULL);
+ if (dir != prefix_extension_dir) {
+ dirs = g_list_append(dirs, dir);
+ }
+
+ temp++;
+ }
+
+ // Finally, check the old thunarx-python <0.3.0 extension dir
+ dirs = g_list_append(dirs, THUNARX_EXTENSION_DIR "/python");
+
+ dirs = g_list_first(dirs);
+ while (dirs != NULL) {
+ gchar *dir = dirs->data;
+ thunarx_python_load_dir(plugin, dir);
+ dirs = dirs->next;
+ }
+
+ g_list_free(dirs);
+}
+
G_MODULE_EXPORT void
thunar_extension_initialize (ThunarxProviderPlugin *plugin) {
- gchar *user_extensions_dir;
const gchar *mismatch;
const gchar *env_string;
@@ -258,16 +297,7 @@ thunar_extension_initialize (ThunarxProviderPlugin *plugin) {
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");
+ thunarx_python_check_all_directories(plugin);
}
G_MODULE_EXPORT void
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list