[patch] xfdesktop: improved menu icon support

Danny Milosavljevic danny.milo at gmx.net
Sun Jan 11 15:18:08 CET 2004


Hi,

Am Son, den 11.01.2004 schrieb Brian J. Tarricone um 11:23:
> 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.  

yeah, had trouble with that aswell... nevermind that, Jasper will just
run his make-it-pretty tool and it will be ok :)

> 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 

dummy.png is the icon the dummy.h is generated of. dummy.h is required
so that there is something meaningful in extra_data, otherwhise the item
factory downgrades the item from a <ImageItem> to a <Item>. 
dummy.png is the source of dummy.h, so it should be included in case
somebody gets a 1x1 transparent png working with gdk-pixbuf-csource (I
didn't) ;)

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

cool stuff, thanks :)






More information about the Xfce4-dev mailing list