Re: gtk_image_new*() and GTK_IMAGE_EMPTY
- From: James Henstridge <james daa com au>
- To: Vitaly Tishkov <tvv sparc spb su>
- Cc: <gtk-devel-list gnome org>
- Subject: Re: gtk_image_new*() and GTK_IMAGE_EMPTY
- Date: Fri, 27 Apr 2001 18:20:05 +0800 (WST)
On Fri, 27 Apr 2001, Vitaly Tishkov wrote:
> Hi,
>
> 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.
>
> 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.
>
> As far as I can see GTK_IMAGE_EMPTY is used in gtk_image_new*() and
> gtk_image_get_storage_type(GtkImage *image) functions only.
>
> 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.
>
> So, I propose;
> 1) rid off GTK_IMAGE_EMPTY;
> 2) make gtk_image_new*() return NULL if a valid GtkImage can't be created;
> 3) add GTK_IMAGE_INVALID and make gtk_image_get_storage_type() return it if
> incorrect parameter to the function passed.
On the other hand, GTK_IMAGE_EMPTY is the only sane value to return from
the following function call:
widget = g_object_new(GTK_TYPE_IMAGE, NULL);
Whether the state should be called GTK_IMAGE_EMPTY or GTK_IMAGE_INVALID
seems to be a matter of taste.
James.
--
Email: james daa com au
WWW: http://www.daa.com.au/~james/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]