Built in themed icons



Here are the details of what I'm doing to resolve the tension
between:

 A) The desire to still have the default stock icons built into the 
    GTK+ binary as shared readonly data.

 B) Doing stock icons as lookups in the icon theme system.

===

Built in icons are registered with:

void       gtk_icon_theme_add_builtin_icon  (const gchar *icon_name,
                                             gint         size,
                                             GdkPixbuf   *pixbuf);

Each size of icon registered conceptually defines a directory 
in the default theme with the "threshold" lookup type a size
of @size and a threshold of 2. (The icon spec default.)

Then, if you pass the GTK_ICON_LOOKUP_USE_BUILTIN flag to 
gtk_icon_theme_lookup() it returns the magic filename ""
to indicate that you should then call:

GdkPixbuf *gtk_icon_theme_find_builtin_icon (const gchar *icon_name,
                                             gint         size,
                                             gint        *base_size);

to get the relevant GdkPixbuf. 

Questions:

 - Should it be possible to set the threshold?

 - Should it be possible to use other directory lookup types?

 - Instead of a magic filename "" (that has to be freed like any
   other filename), perhaps it would be better to use a magic 
   value GTK_ICON_THEME_BUILTIN that you compare against with
   == and don't free?

 - A question that also apples to gtk_icon_theme_lookup() - should
   there be more information returned from  
   gtk_icon_theme_add_builtin_icon() to allow detecting cases
   where the icon shouldn't be scaled - e.g., when the size matches
   the builtin icon size within the threshold?

What I do have seems to be working pretty well ... I can switch
between the builtin stock icons and stock icons from Bluecurve
on the fly.

Regards,
                                               Owen





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