unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
@ 2016-03-12  3:34 Jookia
  2016-03-12  9:13 ` Ricardo Wurmus
  0 siblings, 1 reply; 8+ messages in thread
From: Jookia @ 2016-03-12  3:34 UTC (permalink / raw)
  To: guix-devel

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
  2016-03-12  3:34 Jookia
@ 2016-03-12  9:13 ` Ricardo Wurmus
  2016-03-13  1:30   ` Mark H Weaver
  0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2016-03-12  9:13 UTC (permalink / raw)
  To: Jookia; +Cc: guix-devel


Jookia <166291@gmail.com> writes:

> 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.

Thanks for the patches!  While I think it’s important for us to patch
GTK+ I don’t think hard-coding ~/.guix-profile and the system profile is
a good idea.  Instead we should make GTK+ respect a search path, I
think.

Users can have themes installed elsewhere than somewhere in
~/.guix-profile (using Guix or not).

~~ Ricardo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
  2016-03-12  9:13 ` Ricardo Wurmus
@ 2016-03-13  1:30   ` Mark H Weaver
  0 siblings, 0 replies; 8+ messages in thread
From: Mark H Weaver @ 2016-03-13  1:30 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <rekado@elephly.net> writes:

> Jookia <166291@gmail.com> writes:
>
>> 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.
>
> Thanks for the patches!  While I think it’s important for us to patch
> GTK+ I don’t think hard-coding ~/.guix-profile and the system profile is
> a good idea.  Instead we should make GTK+ respect a search path, I
> think.

I agree.

     Mark

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
@ 2016-03-14  6:27 Jookia
  2016-04-05  9:43 ` 宋文武
  2016-04-05  9:43 ` 宋文武
  0 siblings, 2 replies; 8+ messages in thread
From: Jookia @ 2016-03-14  6:27 UTC (permalink / raw)
  To: guix-devel

Hey there, just an update.

There's an old bug report that deals with this issue. It seems it's something
wanted by GTK+, even if it's a formality in dealing with XDG across the board.

I've commented on it and hopefully gears will start turning again.
https://bugzilla.gnome.org/show_bug.cgi?id=641354

Jookia.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
  2016-03-14  6:27 [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles Jookia
@ 2016-04-05  9:43 ` 宋文武
  2016-04-05 20:23   ` Ludovic Courtès
  2016-04-05  9:43 ` 宋文武
  1 sibling, 1 reply; 8+ messages in thread
From: 宋文武 @ 2016-04-05  9:43 UTC (permalink / raw)
  To: Jookia; +Cc: guix-devel

Jookia <166291@gmail.com> writes:

> Hey there, just an update.
>
> There's an old bug report that deals with this issue. It seems it's something
> wanted by GTK+, even if it's a formality in dealing with XDG across the board.
>
> I've commented on it and hopefully gears will start turning again.
> https://bugzilla.gnome.org/show_bug.cgi?id=641354

Great work, and upstream has merged it in gtk+-3.20.1.

I'm doing package updates to gnome packages using 'guix refresh',
gtk+ will be update to 3.20.2, so we only need apply the patch for our
gtk+-2 package.

Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
  2016-03-14  6:27 [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles Jookia
  2016-04-05  9:43 ` 宋文武
@ 2016-04-05  9:43 ` 宋文武
  1 sibling, 0 replies; 8+ messages in thread
From: 宋文武 @ 2016-04-05  9:43 UTC (permalink / raw)
  To: Jookia; +Cc: guix-devel

Jookia <166291@gmail.com> writes:

> Hey there, just an update.
>
> There's an old bug report that deals with this issue. It seems it's something
> wanted by GTK+, even if it's a formality in dealing with XDG across the board.
>
> I've commented on it and hopefully gears will start turning again.
> https://bugzilla.gnome.org/show_bug.cgi?id=641354

Great work, and glad to hear that upstream has merged it in gtk+-3.20.1.

I'm doing package updates to gnome packages using 'guix refresh',
gtk+ will be update to 3.20.2, so we only need apply the patch for our
gtk+-2 package.

Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
  2016-04-05  9:43 ` 宋文武
@ 2016-04-05 20:23   ` Ludovic Courtès
  2016-04-05 21:49     ` Jookia
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2016-04-05 20:23 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

iyzsong@member.fsf.org (宋文武) skribis:

> Jookia <166291@gmail.com> writes:
>
>> Hey there, just an update.
>>
>> There's an old bug report that deals with this issue. It seems it's something
>> wanted by GTK+, even if it's a formality in dealing with XDG across the board.
>>
>> I've commented on it and hopefully gears will start turning again.
>> https://bugzilla.gnome.org/show_bug.cgi?id=641354
>
> Great work, and upstream has merged it in gtk+-3.20.1.

\o/

> I'm doing package updates to gnome packages using 'guix refresh',
> gtk+ will be update to 3.20.2, so we only need apply the patch for our
> gtk+-2 package.

Thinking about it, is the theme mechanism in GTK+2 similar enough that
the patch would make sense?

Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles.
  2016-04-05 20:23   ` Ludovic Courtès
@ 2016-04-05 21:49     ` Jookia
  0 siblings, 0 replies; 8+ messages in thread
From: Jookia @ 2016-04-05 21:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Tue, Apr 05, 2016 at 10:23:19PM +0200, Ludovic Courtès wrote:
> Thinking about it, is the theme mechanism in GTK+2 similar enough that
> the patch would make sense?

It's almost identical.

> Ludo’.

Jookia.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-04-05 21:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14  6:27 [PATCH 2/2] gtk: Patch GTK+ to look for themes in profiles Jookia
2016-04-05  9:43 ` 宋文武
2016-04-05 20:23   ` Ludovic Courtès
2016-04-05 21:49     ` Jookia
2016-04-05  9:43 ` 宋文武
  -- strict thread matches above, loose matches on Subject: below --
2016-03-12  3:34 Jookia
2016-03-12  9:13 ` Ricardo Wurmus
2016-03-13  1:30   ` Mark H Weaver

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).