Re: gtk_image_new*() and GTK_IMAGE_EMPTY

On Fri, 27 Apr 2001, Vitaly Tishkov wrote:

> > 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.
> If you try to create a GtkWindow object by this call
>     widget = gtk_window_new (99); /* 99 is incorrect parameter */
> widget is NULL, i.e. gtk_window_new() returns NULL if incorrect parameter passed to
> it and you can't create faulty GtkWindow object but can create a faulty GtkImage
> one. I think that Gtk+ behaviour when creating widgets should be the same for all
> the widgets: if a valid widget can't be created it should't be created.

But with the code fragment I gave, the meaning was "create a GtkImage
widget using default values for construct properties (if any)".  The
widget needs some default state for this case.  It would be in a similar
state inside the instance init function of a widget class derived from
GtkImage (before any image had been set).

In your example, you are passing a value that isn't part of the
GtkWindowType enumeration.

I am arguing that the GTK_IMAGE_EMPTY state is a valid state for the
widget to be in, so shouldn't be removed.  I don't have an opinion one way
or the other whether gtk_image_new_from_file should return a GtkImage for
an invalid file.


Email: james daa com au

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