summary refs log tree commit diff
path: root/pkgs/development/libraries/gtk+
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-05-18 06:26:56 +0100
committerJörg Thalheim <joerg@thalheim.io>2017-05-18 06:32:45 +0100
commit1810b3f64b8f4711d8a2be08e38334c2442f69c3 (patch)
tree6b88f692ae98ef8e6148d7e68dc9decb852fcc38 /pkgs/development/libraries/gtk+
parentafec912d81e08339868e0e1e84234e6ed7f6b3fd (diff)
downloadnixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.tar
nixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.tar.gz
nixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.tar.bz2
nixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.tar.lz
nixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.tar.xz
nixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.tar.zst
nixlib-1810b3f64b8f4711d8a2be08e38334c2442f69c3.zip
gtk2: search for themes in XDG_DATA_DIRS
This patch was adapted from GUIX.
At the moment we still have to rely on GTK_DATA_PREFIX, which can only
point to one profile at the time and is also not set in all desktop
environments. This patch makes it possible to use installed themes, no
matter if system-wide or by in a user profile.
Diffstat (limited to 'pkgs/development/libraries/gtk+')
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix2
-rw-r--r--pkgs/development/libraries/gtk+/gtk2-theme-paths.patch40
2 files changed, 41 insertions, 1 deletions
diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index 306e2db29ce9..f6e718d82e9a 100644
--- a/pkgs/development/libraries/gtk+/2.x.nix
+++ b/pkgs/development/libraries/gtk+/2.x.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ setupHook perl pkgconfig gettext ];
 
-  patches = [ ./2.0-immodules.cache.patch ];
+  patches = [ ./2.0-immodules.cache.patch ./gtk2-theme-paths.patch ];
 
   propagatedBuildInputs = with xorg;
     [ glib cairo pango gdk_pixbuf atk ]
diff --git a/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch b/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch
new file mode 100644
index 000000000000..edd69b078076
--- /dev/null
+++ b/pkgs/development/libraries/gtk+/gtk2-theme-paths.patch
@@ -0,0 +1,40 @@
+Subject: [PATCHv2] gtk: Patch GTK+ to look for themes in profiles.
+To: guix-devel@gnu.org
+Date: Sun, 13 Mar 2016 15:17:37 +1100
+Url: https://lists.gnu.org/archive/html/guix-devel/2016-03/msg00492.html
+
+diff -Naur gtk+-2.24.28.new/gtk/gtkrc.c gtk+-2.24.28/gtk/gtkrc.c
+--- gtk+-2.24.28.new/gtk/gtkrc.c	2016-03-13 10:31:14.413644362 +1100
++++ gtk+-2.24.28/gtk/gtkrc.c	2016-03-13 12:51:34.723398423 +1100
+@@ -808,6 +808,8 @@
+   gchar *path = NULL;
+   const gchar *home_dir;
+   gchar *subpath;
++  const gchar * const *xdg_data_dirs;
++  gint i;
+ 
+   if (type)
+     subpath = g_strconcat ("gtk-2.0-", type,
+@@ -830,6 +832,22 @@
+     }
+ 
+   if (!path)
++    {
++      xdg_data_dirs = g_get_system_data_dirs ();
++      for (i = 0; xdg_data_dirs[i]; i++)
++        {
++          path = g_build_filename (xdg_data_dirs[i], "themes", name, subpath, NULL);
++          if (g_file_test (path, G_FILE_TEST_EXISTS))
++            break;
++          else
++            {
++              g_free (path);
++              path = NULL;
++            }
++        }
++    }
++
++  if (!path)
+     {
+       gchar *theme_dir = gtk_rc_get_theme_dir ();
+       path = g_build_filename (theme_dir, name, subpath, NULL);