thunar: plugin improvements (close #9908)

Improve thunar/thunarx so that thunar's plugin directory
could be overriden using a `THUNARX_MODULE_DIR`
environment variable so that plugins not built along
with the `thunar` package could be installed as well.

This could allow one to wrap `thunar` in a `thunar-with-plugins`
package where plugins are declared instead of being found (a
bit in the same fashion as gstreamer plugins).

authored by Raymond Gauthier and committed by Vladimír Čunát e9f2dc88 c405f222

+50
+2
pkgs/desktops/xfce/core/thunar.nix
··· 14 }; 15 name = "${p_name}-${ver_maj}.${ver_min}"; 16 17 buildInputs = [ 18 pkgconfig intltool 19 gtk dbus_glib libstartup_notification libnotify libexif pcre udev
··· 14 }; 15 name = "${p_name}-${ver_maj}.${ver_min}"; 16 17 + patches = [ ./thunarx_plugins_directory.patch ]; 18 + 19 buildInputs = [ 20 pkgconfig intltool 21 gtk dbus_glib libstartup_notification libnotify libexif pcre udev
+48
pkgs/desktops/xfce/core/thunarx_plugins_directory.patch
···
··· 1 + diff --git a/thunarx/thunarx-provider-factory.c b/thunarx/thunarx-provider-factory.c 2 + index 31b8835..a3e7f4e 100644 3 + --- a/thunarx/thunarx-provider-factory.c 4 + +++ b/thunarx/thunarx-provider-factory.c 5 + @@ -141,12 +141,19 @@ static GList* 6 + thunarx_provider_factory_load_modules (ThunarxProviderFactory *factory) 7 + { 8 + ThunarxProviderModule *module; 9 + + const gchar *thunar_dir; 10 + const gchar *name; 11 + GList *modules = NULL; 12 + GList *lp; 13 + GDir *dp; 14 + 15 + - dp = g_dir_open (THUNARX_DIRECTORY, 0, NULL); 16 + + thunar_dir = g_getenv("THUNARX_MODULE_DIR"); 17 + + if (NULL == thunar_dir) 18 + + { 19 + + thunar_dir = THUNARX_DIRECTORY; 20 + + } 21 + + 22 + + dp = g_dir_open (thunar_dir, 0, NULL); 23 + if (G_LIKELY (dp != NULL)) 24 + { 25 + /* determine the types for all existing plugins */ 26 + diff --git a/thunarx/thunarx-provider-module.c b/thunarx/thunarx-provider-module.c 27 + index 023ad2a..6c21997 100644 28 + --- a/thunarx/thunarx-provider-module.c 29 + +++ b/thunarx/thunarx-provider-module.c 30 + @@ -174,10 +174,17 @@ static gboolean 31 + thunarx_provider_module_load (GTypeModule *type_module) 32 + { 33 + ThunarxProviderModule *module = THUNARX_PROVIDER_MODULE (type_module); 34 + + const gchar *thunar_dir; 35 + gchar *path; 36 + + 37 + + thunar_dir = g_getenv("THUNARX_MODULE_DIR"); 38 + + if (NULL == thunar_dir) 39 + + { 40 + + thunar_dir = THUNARX_DIRECTORY; 41 + + } 42 + 43 + /* load the module using the runtime link editor */ 44 + - path = g_build_filename (THUNARX_DIRECTORY, type_module->name, NULL); 45 + + path = g_build_filename (thunar_dir, type_module->name, NULL); 46 + module->library = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); 47 + g_free (path); 48 +