git.iko.soy/typeable/nixpkgs
on master help sign in
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).

commite9f2dc883074fbba612f4e57a7bff06a8a6420e7 authorRaymond Gauthier <jraygauthier@gmail.com> dateFri 18 Sep 2015, 02:02 (11 years ago) parentc405f22
2 files changed+50
pkgs/desktops/xfce/core/thunar.nix+2 pkgs/desktops/xfce/core/thunarx_plugins_directory.patch+48
pkgs/desktops/xfce/core/thunar.nix+2
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
1414 };
1515 name = "${p_name}-${ver_maj}.${ver_min}";
1616
17+ patches = [ ./thunarx_plugins_directory.patch ];
18+
1719 buildInputs = [
1820 pkgconfig intltool
1921 gtk dbus_glib libstartup_notification libnotify libexif pcre udev
pkgs/desktops/xfce/core/thunarx_plugins_directory.patchnew file+48
@@ -0,0 +1,48 @@
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+