Re: gtk_image_new*() and GTK_IMAGE_EMPTY

Vitaly Tishkov <tvv sparc spb su> writes: 
> I've looked into GdkImage.
> Docs for gdk_image_new() says
> "Returns : a new GdkImage, or NULL if the image could not be
> created. "

GdkImage is totally unrelated to GtkImage. GtkImage displays a picture
in any format. GdkImage is a client-side block of data in the format
of the X display.

> gtk_image_new_from_file() _always_ returned not null even if the image can't be loaded
> (=created).

The widget is always created. The widget displays a picture. Sometimes
the picture cannot be created; then the widget displays another
picture indicating that the desired picture was not obtained. But the
widget is always created.

If you want to load a picture, use gdk_pixbuf_new_from_file(). That
will return NULL if it can't load the picture, because it is loading
the picture.

gtk_image_new_from_file() does two things:
 a) creates a GtkImage widget
 b) attempts to load a picture and put it in the widget

It always does a). Sometimes b) fails. But that does not affect
whether a) succeeded.


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