GNOME Goal: Install theme-friendly icons
Many applications install their icon by putting it into $datadir/pixmaps and hardcoding the URL to it in their application. The problem with this is that icon themes cannot override the icon for your application. To fix this, one should follow the icon theme specification. This memo summarizes what you need to do in your GNOME application to make all theme designers happier.
First you should prepare your icon. If your application icon is too old and doesn't look good, consider asking somebody on Planet or IRC to draw a new one for you. It is preferred to follow the Tango guidelines when designing new icons. You should then prepare a 48x48 PNG version of the icon, and preferably an SVG version too. It's recommended to ship 16x16, 22x22, 24x24 (for gnome-panel), 32x32 and 48x48 SVG.
Build system
In your Makefile.am, this is how you install it (say your application name is gurilla):
icondir = $(datadir)/icons/hicolor/48x48/apps icon_DATA = gurilla.png svgicondir = $(datadir)/icons/hicolor/scalable/apps svgicon_DATA = gurilla.svg gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor install-data-hook: update-icon-cache uninstall-hook: update-icon-cache update-icon-cache: @-if test -z "$(DESTDIR)"; then \ echo "Updating Gtk icon cache."; \ $(gtk_update_icon_cache); \ else \ echo "*** Icon cache not updated. After (un)install, run this:"; \ echo "*** $(gtk_update_icon_cache)"; \ fi EXTRA_DIST = \ $(icon_DATA) \ $(svgicon_DATA)
(If you copy and paste that snippet, note that the indentation in the update-icon-cache target should be with tabs instead of spaces.)
Application code
The preferred way to refer to icons is by their name. You should set a default icon name in your main function before creating any windows, like after setting application name for example:
g_set_application_name (_("Gurilla")); gtk_window_set_default_icon_name ("gurilla");
That is all you need to do for most applications. It will set the icon for any window created in your application (that does not set its own icon.)
If your application also exposes a library with window widgets that other applications may use, and you want to set an icon on those windows too, you can do that by setting the icon for the window in its constructor. But before doing that make sure it is really what you want. For example, you don't want the Gtk+ icon on a font dialog. Anyhow, here it is:
static void gurilla_window_init (GurillaWindow *guw) { ... gtk_window_set_title (GTK_WINDOW (guw), _("Gurilla Dialog")); gtk_window_set_icon_name (GTK_WINDOW (guw), "gurilla"); }
Last, you should set the icon name in your about dialog:
gtk_show_about_dialog (GTK_WINDOW (guw), ... "logo-icon-name", "gurilla", ... NULL);
Desktop file
The icon name in the .desktop file should not have an extension, for obvious reasons.
Status of this goal
Completed.
When starting to work on one module, you can also put your name in the status so that other people don't duplicate the work you're doing.
State |
Markup |
todo |
<: #ff8080> todo |
patch |
<: #ffc849> [[GnomeBug:xxxxx|patch]] |
done |
<: #80ff80> [[GnomeBug:xxxxx|done]] |
not needed |
<: #80ff80> not needed |
Above are the states and corresponding markup to update the modules state table below.
Module |
Status |
Desktop |
|
alacarte |
|
bug-buddy |
|
cheese |
not needed |
control-center |
|
dasher |
|
deskbar-applet |
|
eel |
not needed |
ekiga |
|
eog |
|
epiphany |
not needed |
evince |
not needed |
evolution-data-server |
not needed |
evolution |
|
evolution-exchange |
not needed |
evolution-webcal |
not needed |
fast-user-switch-applet |
not needed |
file-roller |
|
gcalctool |
not needed |
gconf-editor |
|
gdm |
|
gedit |
not needed |
gnome-applets |
|
gnome-backgrounds |
not needed |
gnome-desktop |
not needed |
gnome-doc-utils |
not needed |
gnome-games |
|
gnome-icon-theme |
not needed |
gnome-keyring |
not needed |
gnome-netstatus |
|
gnome-nettool |
|
gnome-mag |
|
gnome-media |
|
gnome-menus |
not needed |
gnome-panel |
|
gnome-power-manager |
|
gnome-python-desktop |
not needed |
gnome-screensaver |
not needed |
gnome-session |
not needed |
gnome-settings-daemon |
not needed |
gnome-speech |
not needed |
gnome-system-monitor |
not needed |
gnome-system-tools |
|
gnome-terminal |
|
gnome-themes |
not needed |
gnome-user-docs |
not needed |
gnome-utils |
|
gnome-volume-manager |
|
gok |
|
gstreamer |
not needed |
gst-plugins |
not needed |
gtk-engines |
not needed |
gtkhtml |
not needed |
gtksourceview |
not needed |
gucharmap |
|
gvfs |
not needed |
libgail-gnome |
not needed |
libgnomekbd |
|
libgtop |
not needed |
libgweather |
not needed |
liboobs |
not needed |
librsvg |
not needed |
libsoup |
not needed |
libwnck |
not needed |
metacity |
not needed |
mousetweaks |
not needed |
nautilus |
not needed |
nautilus-cd-burner |
|
orca |
not needed |
pygtksourceview |
not needed |
seahorse |
|
sound-juicer |
not needed |
swfdec-gnome |
not needed |
tomboy |
not needed |
totem |
|
totem-pl-parser |
not needed |
vinagre |
not needed |
vino |
|
vte |
not needed |
yelp |
not needed |
zenity |
not needed |
Desktop (to be deprecated) |
|
gnome-keyring-manager |
not needed |
libgnomeprint |
not needed |
libgnomeprintui |
not needed |
Platform |
|
GConf |
not needed |
at-spi |
not needed |
atk |
not needed |
gail |
not needed |
glib |
not needed |
gnome-mime-data |
not needed |
gnome-vfs |
not needed |
gtk+ |
not needed |
gtk-doc |
not needed |
intltool |
not needed |
libglade |
not needed |
libxml2 |
not needed |
libxslt |
not needed |
pango |
not needed |
pkgconfig |
not needed |
Platform (to be deprecated) |
|
ORBit2 |
not needed |
audiofile |
not needed |
esound |
not needed |
libIDL |
not needed |
libart_lgpl |
not needed |
libbonobo |
not needed |
libbonoboui |
not needed |
libgnome |
not needed |
libgnomecanvas |
not needed |
libgnomeui |
not needed |
Admin |
|
pessulus |
not needed |
sabayon |
|
Development Tools |
|
accerciser |
not needed |
anjuta |
|
devhelp |
not needed |
gdl |
not needed |
glade-3 |
done |
gnome-build |
not needed |
gnome-devel-docs |
not needed |
Bindings (C++) |
|
glibmm |
not needed |
gtkmm |
not needed |
libglademm |
not needed |
gconfmm |
not needed |
libgnomecanvasmm |
not needed |
libgnome-vfsmm |
not needed |
libgnomemm |
not needed |
libgnomeuimm |
not needed |
libxml++ |
not needed |
Bindings (java) |
|
glib-java (jg-common) |
not needed |
libgtk-java |
not needed |
libgnome-java |
not needed |
libgconf-java |
not needed |
libglade-java |
not needed |
Bindings (perl) |
|
Glib |
not needed |
Gtk2 |
not needed |
Gtk2-GladeXML |
not needed |
Gnome2-GConf |
not needed |
Gnome2-Canvas |
not needed |
Gnome2-VFS |
not needed |
Gnome2 |
not needed |
Bindings (python) |
|
pygobject |
not needed |
pygtk |
not needed |
Gnome-Python |
not needed |
Other |
|
gnome-blog |
|
gossip |
|
nautilus-actions |
|
rhythmbox |
|
startup-notification |
not needed |
xchat-gnome |
|
smuxi |
|
gthumb |
done |
this goal in other languages
AppIconZhCN for Simplified Chinese (简体中文)