guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.


From: Jookia
Subject: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
Date: Sat, 12 Mar 2016 14:34:09 +1100

A long running complaint has been that GTK themes aren't found, thus making
GTK look terrible on GuixSD. To solve this, GTK+ now searches the user's
profile as well as the system's profile for themes, in addition to where
themes are currently searched.

* gnu/packages/gtk.scm (gtk+-2): Add gtk2-theme-paths.patch.
  (gtk+): Add gtk3-theme-paths.patch.
* gnu/packages/patches/gtk2-theme-paths.patch: Add patch.
* gnu/packages/patches/gtk3-theme-paths.patch: Add patch.
---
 gnu/packages/gtk.scm                        |  6 +++--
 gnu/packages/patches/gtk2-theme-paths.patch | 33 +++++++++++++++++++++++++
 gnu/packages/patches/gtk3-theme-paths.patch | 38 +++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/gtk2-theme-paths.patch
 create mode 100644 gnu/packages/patches/gtk3-theme-paths.patch

diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index a234b89..9bfc05f 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -525,7 +525,8 @@ is part of the GNOME accessibility project.")
             (sha256
              (base32
               "0mj6xn40py9r9lvzg633fal81xfwfm89d9mvz7jk4lmwk0g49imj"))
-            (patches (list (search-patch 
"gtk2-respect-GUIX_GTK2_PATH.patch")))))
+            (patches (list (search-patch "gtk2-respect-GUIX_GTK2_PATH.patch")
+                           (search-patch "gtk2-theme-paths.patch")))))
    (build-system gnu-build-system)
    (outputs '("out" "doc"))
    (propagated-inputs
@@ -586,7 +587,8 @@ application suites.")
             (sha256
              (base32
               "0lp1hn0qydxx03bianzzr0a4maqzsvylrkzr7c3p0050qihwbgjx"))
-            (patches (list (search-patch 
"gtk3-respect-GUIX_GTK3_PATH.patch")))))
+            (patches (list (search-patch "gtk3-respect-GUIX_GTK3_PATH.patch")
+                           (search-patch "gtk3-theme-paths.patch")))))
    (propagated-inputs
     `(("at-spi2-atk" ,at-spi2-atk)
       ("atk" ,atk)
diff --git a/gnu/packages/patches/gtk2-theme-paths.patch 
b/gnu/packages/patches/gtk2-theme-paths.patch
new file mode 100644
index 0000000..b3a5030
--- /dev/null
+++ b/gnu/packages/patches/gtk2-theme-paths.patch
@@ -0,0 +1,33 @@
+diff -Naur gtk+-2.24.28/gtk/gtkrc.c gtk+-2.24.28.new/gtk/gtkrc.c
+--- gtk+-2.24.28/gtk/gtkrc.c   1970-01-01 10:00:00.000000000 +1000
++++ gtk+-2.24.28.new/gtk/gtkrc.c       2016-03-11 17:25:19.549137754 +1100
+@@ -829,6 +829,29 @@
+       }
+     }
+ 
++  if (!path && home_dir)
++    {
++      path = g_build_filename (home_dir, ".guix-profile",
++                               "share", "themes", subpath, NULL);
++      if (!g_file_test (path, G_FILE_TEST_EXISTS))
++      {
++        g_free (path);
++        path = NULL;
++      }
++    }
++
++  if (!path)
++    {
++      const gchar *theme_dir = "/run/current-system/profile/share/themes";
++      path = g_build_filename (theme_dir, name, subpath, NULL);
++      
++      if (!g_file_test (path, G_FILE_TEST_EXISTS))
++      {
++        g_free (path);
++        path = NULL;
++      }
++    }
++
+   if (!path)
+     {
+       gchar *theme_dir = gtk_rc_get_theme_dir ();
diff --git a/gnu/packages/patches/gtk3-theme-paths.patch 
b/gnu/packages/patches/gtk3-theme-paths.patch
new file mode 100644
index 0000000..9eb656c
--- /dev/null
+++ b/gnu/packages/patches/gtk3-theme-paths.patch
@@ -0,0 +1,38 @@
+diff -Naur gtk+-3.18.2.new/gtk/gtkcssprovider.c 
gtk+-3.18.2/gtk/gtkcssprovider.c
+--- gtk+-3.18.2/gtk/gtkcssprovider.c   2016-03-11 17:59:50.115405137 +1100
++++ gtk+-3.18.2.new/gtk/gtkcssprovider.c       2016-03-11 18:06:25.105363787 
+1100
+@@ -3043,6 +3043,16 @@
+   if (path)
+     return path;
+ 
++  /* Then check the user's Guix profile */
++  path = _gtk_css_find_theme_dir (g_get_home_dir (), 
".guix-profile/share/themes", name, variant);
++  if (path)
++    return path;
++
++  /* And then the system's Guix profile */
++  path = _gtk_css_find_theme_dir ("/run/current-system/profile/share/themes", 
NULL, name, variant);
++  if (path)
++    return path;
++
+   /* Finally, try in the default theme directory */
+   var = g_getenv ("GTK_DATA_PREFIX");
+   if (!var)
+diff -Naur gtk+-3.18.2.new/gtk/inspector/visual.c 
gtk+-3.18.2/gtk/inspector/visual.c
+--- gtk+-3.18.2/gtk/inspector/visual.c 2016-03-11 17:59:50.815408609 +1100
++++ gtk+-3.18.2.new/gtk/inspector/visual.c     2016-03-11 18:08:49.122077927 
+1100
+@@ -247,6 +247,14 @@
+   fill_gtk (path, t);
+   g_free (path);
+ 
++  path = g_build_filename (g_get_home_dir (), ".guix-profile/share/themes", 
NULL);
++  fill_gtk (path, t);
++  g_free (path);
++
++  path = g_build_filename ("/run/current-system/profile/share/themes", NULL);
++  fill_gtk (path, t);
++  g_free (path);
++
+   g_hash_table_iter_init (&iter, t);
+   while (g_hash_table_iter_next (&iter, (gpointer *)&theme, NULL))
+     gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (vis->priv->theme_combo), 
theme, theme);
-- 
2.6.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]