[patch] xfdesktop: improved menu icon support

Brian J. Tarricone bjt23 at cornell.edu
Sun Jan 11 11:23:27 CET 2004


hello all-

i took the patch danny posted a few days ago and made some 
changes/improvements:
*icon search path is much more extensive, found pretty much everything 
as specified in all the .desktop files on my system, except for a few 
icons kept in braindead places
*will search in the directory in /usr/share/icons and 
/usr/share/xfce4/themes for icons matching the current theme selected 
for the panel (and listens to the settings manager for theme changes)
*searches kde icon directories, either based on a standard location 
(assuming the kde prefix is /usr), or following the KDEDIRS environment 
var (i'm not sure if this is standard, but my machine has it, so...)
*if the icon given doesn't have an extension (as is the case with the 
icon entry in many .desktop files), we try a few file types - svgz, svg, 
png, xpm
*sped up the icon search code.  originally it was g_strdup_printf()-ing 
each guess for a filename; i'm using i PATH_MAX size static buffer now.
*also slowed down the icon search code, since there are many more paths 
to search, and extensions on top of that when there isn't one provided ^_~
*reduce icon size from 32x32 to 24x24, as menu entries without icons end 
up being much smaller than entries with icons.

still on my mental todo/wish list:
*search in other places depending upon xfce's $prefix.  right now i just 
search assuming everything is in /usr (except for kde stuff).  i'm 
somewhat ambivalent on this, as i'm already searching in 17 directories 
(23 if KDEDIRS is set)
*add icons to menuitems with submenus.  unfortunately there doesn't 
appear to be a way to do this via GtkItemFactory, so this doesn't sound 
like something that's going to happen.
*more intelligently scale the icons.  it either needs to pick a 
reasonable size based on the font size (such that the icon height is 
about the same as the font height), or it needs to be user-configurable, 
which means a new prefs panel (yuck).

ok, now that i've rambled on, to the patch.  it supercedes danny's 
original patch (i.e., it already has danny's changes in it).  sorry, 
there's a little whitespace-change noise in the patch, as there were 
some oddly-indented portions that i needed to fix to be able to read 
better.  i tried to put it back, but failed miserably in some areas.  
the patch is in a tarball:
xfdesktop/xfce4-deskmenu-gen.pl
xfdesktop/xfdesktop-menu-icons.diff
xfdesktop/src/dummy.png
the first is a script to look around your hard drive for .desktop files 
and organise them into a menu with categories.  it makes a file that 
should be included in menu.xml as an xml entity (like the menu2.xml 
example).  the second is the patch itself, and the third is apparently a 
dummy icon that i don't think is really necessary but i'm putting it in 
there for completeness.  annoying how you can't put binary files in 
diffs ^_~.  i tossed the patch on my webserver[1] in case there are 
those that can't read the attachment and want to play.

anyway, that's it.  i put up a screenshot[2] so you can get an idea of 
what it looks like (tho it's rather obvious). comments and suggestions 
welcome.

    -brian

[1] http://kelnos.homelinux.org/stuff/xfdesktop-menu-icons2.tar.gz
[2] http://kelnos.homelinux.org/stuff/xfdesktop-menu-icons.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xfdesktop-menu-icons2.tar.gz
Type: application/gzip
Size: 7614 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20040111/709245d6/attachment.bin>


More information about the Xfce4-dev mailing list