guix-devel
[Top][All Lists]
Advanced

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

Re: Helping programs find their icons


From: 宋文武
Subject: Re: Helping programs find their icons
Date: Thu, 05 Feb 2015 20:43:19 +0800
User-agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-unknown-linux-gnu)

Mark H Weaver <address@hidden> writes:

> Hello Guix,
>
> I've investigated why wicd-gtk is unable to find its icons and fixed it.
> Looking at the output of strace, I found that when wicd-gtk looks for
> icons, it searches for 'index.theme' files in many different directories
> of the form:
>
>   /gnu/store/.../share/icons/hicolor/
>
> The icons it wanted were in one of the directories it searched, but
> apparently the lack of 'index.theme' inhibited it from loading the fonts
> from that directory.
>
> I've found only one package that includes
> share/icons/hicolor/index.theme, and that's 'hicolor-icon-theme'.  The
> 'index.theme' file turned out to be quite generic.  It describes the
> directory structure, but does not list the individual icons present.
>
> I modified the 'wicd' package to copy 'index.theme' from
> 'hicolor-icon-theme' into the same directory of 'wicd', and that fixed
> the problem: wicd-gtk now has working icons.
I think you mean the icon now show in wicd-gtk itself?
then wrap it with XDG_DATA_DIRS=$hicolor-icon-theme/share:$wicd/share
should have same effect.
>
> However, this problem is quite widespread.  Many of our gtk packages
> install icons into $out/share/icons/hicolor but have no 'index.theme',
> and I suspect that's the reason the xfce application menu is missing so
> many icons.
>
>   inkscape-0.91
>   emacs-24.4
>   gtk+-3.14.7
>   xfce4-session-4.10.0
>   xfwm4-4.10.0
>   exo-0.8.0
>   thunar-1.4.0
>   xfce4-panel-4.10.0
>   xfdesktop-4.10.0
>   xfce4-battery-plugin-1.0.5
>   transmission-2.84
This is another story, I think the icon finding path is:

THEME=0
for dir in "$XDG_DATA_DIRS:$out/share"; do
  if [ ! -e "$dir/icons/hicolor/index.theme" && $THEME = 0 ]; then
    continue 
  else
    THEME=1
  fi
  
  if [ -e "$dir/icons/hicoror/icon-theme.cache" ]; then
    icon = $(lookup from icon-theme.cache)
    if $icon; then
      return $icon
    else
      continue # even we may have the icon in dir
  fi

  icon = $(lookup from dir) # slow
  if $icon; then
    return $icon
  fi
done

I just pushed the 'xfce' meta-package, it use 'glib-or-gtk-build-system'
to set a XDG_DATA_DIRS contain xfce4-panel, xfce4-battery-plugin, etc.
Icons from those propagated packages can be found, but packages from
user's profile can not.

The problem is we have a incomplete icon-theme.cache in profile,
we should either remove it or generate a complete one.

>
> I think it might be helpful to add a post-install phase to
> 'glib-or-gtk-build-system' that installs 'index.theme' from
> 'hicolor-icon-theme' if $out/share/icons/hicolor exists.
>
> We might also have to install 'index.theme' from 'gnome-icon-theme' if
> $out/share/icons/gnome exists.
>
> That is, unless someone has a better suggestion.  Any ideas?
>
>     Thanks,
>       Mark



reply via email to

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