Re: gtk_image_new*() and GTK_IMAGE_EMPTY
- From: Havoc Pennington <hp redhat com>
- To: Vitaly Tishkov <tvv sparc spb su>
- Cc: gtk-devel-list gnome org
- Subject: Re: gtk_image_new*() and GTK_IMAGE_EMPTY
- Date: 27 Apr 2001 10:21:19 -0400
Vitaly Tishkov <tvv sparc spb su> writes:
>
> I have a suggestion about changing the behavior of gtk_image_new*() and
> gtk_image_get_storage_type() functions.
>
> As far as I understand if an image can't be created right way (eg if passed
> wrong path to gtk_image_new_from_file (char* filename)) the image is created
> with GTK_IMAGE_EMPTY as GtkImageType.
No, that's not the point of GTK_IMAGE_EMPTY. EMPTY just means there's
no image in there. So e.g. you called gtk_image_set_pixbuf (image,
NULL).
If new_from_file() fails, as the docs say, you get a "missing image"
icon, which is still an image, just not the one your asked for. The
storage type is actually _STOCK in this case.
> I don't think it's a good idea to return a faulty image created and I don't
> think that it's good even to create such images. I assume that it's better to
> return NULL if a new GtkImage can't be created and rid off GTK_IMAGE_EMPTY at
> all.
If you want to check errors, use gdk_pixbuf_new_from_file(),
image_new_from_file() is for the convenience case where you have
nothing sane to do on error really. So it just displays an error icon
for the image.
> I assume that GTK_IMAGE_EMPTY incorrectly used in gtk_image_get_storage_type().
> GTK_IMAGE_EMPTY is returned by gtk_image_get_storage_type() if a parameter
> passed to the function is not an GtkImage or it's type is GTK_IMAGE_EMPTY. So,
> the same value is returned for valid and invalid GtkImage's.
There is no concept of an invalid GtkImage. It's totally valid to have
a GtkImage that's empty. It's the same as a GtkLabel with no text.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]