# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1049283098 0 # Node ID a07e08f708d6e56bc09005d37e574c1cd31d1682 # Parent 89eac0990c67eebd8cfe4abde1497f78ba9ecfae Fixed icons in the tree control in GTK 2.x when loaded from a file. diff -r 89eac0990c67 -r a07e08f708d6 gtk/dw.c --- a/gtk/dw.c Wed Apr 02 10:55:08 2003 +0000 +++ b/gtk/dw.c Wed Apr 02 11:31:38 2003 +0000 @@ -100,6 +100,9 @@ GdkBitmap *mask; int used; unsigned long width, height; +#if GTK_MAJOR_VERSION > 1 + GdkPixbuf *pixbuf; +#endif } DWPrivatePixmap; static DWPrivatePixmap *_PixmapArray = NULL; @@ -700,11 +703,21 @@ } #if GTK_MAJOR_VERSION > 1 +static GdkPixbuf *_find_private_pixbuf(long id) +{ + if(id < _PixmapCount && _PixmapArray[id].used) + return _PixmapArray[id].pixbuf; + return NULL; +} + static GdkPixbuf *_find_pixbuf(long id) { char *data = NULL; int z; + if(id & (1 << 31)) + return _find_private_pixbuf((id & 0xFFFFFF)); + for(z=0;z<_resources.resource_max;z++) { if(_resources.resource_id[z] == id) @@ -4350,11 +4363,11 @@ if(pixbuf) { + _PixmapArray[found].pixbuf = pixbuf; _PixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); _PixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); gdk_pixbuf_render_pixmap_and_mask(pixbuf, &_PixmapArray[found].pixmap, &_PixmapArray[found].mask, 1); - g_object_unref(pixbuf); } #elif defined(USE_IMLIB) image = gdk_imlib_load_image(file); @@ -4400,6 +4413,13 @@ if(id < _PixmapCount && _PixmapArray[id].used) { +#if GTK_MAJOR_VERSION > 1 + if(_PixmapArray[id].pixbuf) + { + g_object_unref(_PixmapArray[id].pixbuf); + _PixmapArray[id].pixbuf = NULL; + } +#endif if(_PixmapArray[id].mask) { gdk_bitmap_unref(_PixmapArray[id].mask);