Re: Gnomepixmaps wishlist




On Sun, 21 Jun 1998, Eckehard Berns wrote:
> On Fri, Jun 19, 1998 at 10:11:44AM -0700, Scott D. Heavner wrote:
> > 1) gnome_pixmap_new_from_file() doesn't return NULL if we 
> > can't open the file.  How am I supposed to detect errors?
> > Maybe all the new routines do this, I haven't checked.
> > I wanted to preload my pixmaps with data at compile time
> > and replace them if the xpm files are available at run time.
> 
> Use g_file_exists before calling gnome_pixmap_new_from_file. The GnomePixmap
> will work without a pixmap, that's why a non-existent file returns a valid
> GnomePixmap.
> 

You can also check:

 GtkWidget * pixmap = gnome_pixmap_new_from_file(blah blah);
 if (GNOME_PIXMAP(pixmap)->pixmap == NULL) {
  /* Do something about the error */
 }

Maybe a little bit paranoid, but there could be reasons for failure other
than nonexistent files.

Havoc Pennington ==== http://pobox.com/~hp




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