After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 63305 - GtkImage doesn't gray image when insensitive
GtkImage doesn't gray image when insensitive
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2001-10-29 17:31 UTC by Matt Wilson
Modified: 2011-02-04 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Matt Wilson 2001-10-29 17:31:09 UTC
GnomeImage did.  At least an option to do so would be nice.
Comment 1 Owen Taylor 2001-11-12 14:47:56 UTC
One way to achieve this effect currently is to create 
a new stock item for your image.
Comment 2 Owen Taylor 2001-11-19 22:53:56 UTC
OK, easier way to get the effect:

 GtkIconSet *icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
 gtk_image_new_from_icon_set (icon_set);
 gtk_icon_set_unref (icon_set);

Graying things out generically is a pain (imagine doing
it for GtkImage), so I think we should skip it for now.
In the future, we can add a convenience function:

 gtk_image_new_from_icon_pixbuf()

That does the above. Or a property ::build_insensitive,
or just implement insensitivation always. (Though that
might be a incompatible API change, I guess)

Comment 3 Matt Wilson 2001-11-20 22:54:11 UTC
Currently this is what we have to do to get images that do insensitive
without scaling them to random stock sizes:

        source = gtk.IconSource()
        source.set_pixbuf(pixbuf)
        source.set_size(gtk.ICON_SIZE_DIALOG)
        source.set_size_wildcarded(gtk.FALSE)
        iconset = gtk.IconSet()
        iconset.add_source(source)
        p = gtk.image_new_from_icon_set(iconset, gtk.ICON_SIZE_DIALOG)

Note that this would be a lot more code in C...
Comment 4 Havoc Pennington 2001-11-20 23:20:14 UTC
I think we can trivially implement the build_insensitive thing, if
we're willing to be slow (we can get a pixbuf from a GdkImage, or a
GdkPixmap).

Do we desensitize animations? ;-)
Comment 5 Darin Adler 2002-01-24 20:26:35 UTC
I'd like to find out soon whether we're going to fix this in
GtkImage, or if I need to change Bonobo and Nautilus to make an
icon set.

I'm also unclear on whether the simple code Owen posted will work,
or if I have to do something more complicated like what Matt alluded
to.
Comment 6 Owen Taylor 2002-01-29 23:58:53 UTC
Tue Jan 29 18:50:59 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkimage.c (gtk_image_expose): Optimize exposes of
        partial insensitive images.

2002-01-24  Havoc Pennington  <hp@redhat.com>

        * gtk/gtkimage.c (gtk_image_expose): create insensitive version of
        the image regardless of storage type, #63305

        * demos/gtk-demo/images.c: add toggle button to demonstrate that
        GtkImage makes its contents insensitive