Re: [gtk-list] gdk-pixbuf: new_from_file()




Yasushi Shoji <yashi@yashi.com> writes:

> hello,
> 
> has anyone wrote language binding for gdk-pixbuf, yet?  I'm writing
> one for Ruby, and I now has a question.  let me know if there is more
> apropriate list for this.  gtk-binding-list? ;p
> 
> anyway, a tiny problem I have is that gdk_pixbuf_new_from_file, or any
> loading function doesn't tell me what's wrong when it failed to load
> image, so that all I can do is raise generall exception in binding.
> 
> comment in the gdk-pixbuf-io.c says gdk-pixbuf can fail with four
> different errors:
> 
>  - the file could not be opened
>  - there was no loader for the file's format
>  - there was not enough memory to allocate the image buffer
>  - the image file contained invalid data.
> 
> is it possible to change API to return diffent value for each error?
> or, even, does it worth? ;P

I think at this point just throwing a general exception is probably best. 

Havoc and I have in mind adding a GException API to GLib for doing
detailed error reports, so we may eventually have a standard way
of doing:

 pixbuf = gdk_pixbuf_new_from_file_with_error ("myfile", &error);
 if (!pixbuf)
   g_print ("Could not load file, "%s\n", error->str);

But we don't have a standard way of doing this now.

You might want to file a wishlist bug report against gdk-pixbuf about
this in the GNOME bug tracker.

Regards,
                                        Owen



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