Re: Getting a GDK_CONFIGURE event from a GtkImage



On Mon, 25 Jun 2007 17:41:51 -0600 Jim George wrote:

[...] caused an infinite loop, because I'm trying to
do the following:

gboolean solar_cal_pixbuf_resize(GtkWidget *widget, GtkAllocation
*alloc, gpointer user_data)
{
 GtkImage *img_widget = user_data;
 GdkPixbuf *pixbuf = gtk_image_get_pixbuf(img_widget);
 if (pixbuf) g_object_unref(pixbuf);
 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, alloc->width,
alloc->height);
 gtk_image_set_from_pixbuf(img_widget, pixbuf);
}

The call to gtk_image_set_from_pixbuf causes a size-alloc to be
emitted, leading to the infinite loop. I don't see why the
size-request signal is not being emitted.

Just put a call to g_signal_handlers_block_by_func() before
gtk_Image_set_from_pixbuf(), and then after, a call to
g_signal_handlers_unblock_by_func().  There may be a more elegant way
of handling that, but this'll work.

        -brian



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