Re: GtkStockIcon and GtkIconFactory

Salmaso Raffaele <r salmaso inwind it> writes:
> Hi, how it is possible to add new icons to standard stock?
> I can't figure how. Actually, I'm replicating anything shown in
> gtkiconfactory.c and gtkstock.c, but is a pain.
> There is a simper method?

To add a new icon in your application, the steps are something like:

 - create an icon factory for your application
 - call gtk_icon_factory_add_default() to add your icon factory 
   to the search path
 - for each icon you want to add, create an icon set, and call
   gtk_icon_set_add_source() to add sources to the icon set
   (usually only one source), then add the icon set to the 
   icon factory with gtk_icon_factory_add()

Typically, you want to use inline pixbufs for these icons, as in

Then themes can override your icons by specifying gtkrc entries.

Be sure to namespace your stock ID's, e.g. "gtk-open," or
"nautilus-foobar," because themes may want to ship icons for lots of
different apps.


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