Re: WWW interface functions in Gnome libraries?



On 19 May, robert havoc pennington wrote:
> On Tue, 19 May 1998, Graham Hughes wrote:
>> 	void gnome_www_dispatch_browser(gchar * url);
> Looks good to me. The browser command line should be a setting in
> gnome-preferences, rather than hardcoded, with gnome-help-browser as the
> hardcoded fallback.  You can probably see what I mean in
> gnome-preferences.c. 

Oh, granted :-).

> Some kind of error handling would be nice too, because a dialog should
> come up if the browser launch fails. The dialog could be in the library or
> your function could have a return code, I don't know which would be best.

True.  Hmm..., this is sticky.  I'll do the dialog for now; maybe an
error callback can be made part of the interface at some later date.  I
don't like the function itself returning an error code, because it's
intended to be a convenience thing; if you really cared about what was
happening, you'd probably grab the data yourself and use the
gnome-mime.h stuff.

>> 	gint gnome_www_get_url(gchar * url, gchar * mimetype,
>> 			       gint size);
> How about gchar ** mimetype, returning an allocated string, and drop the
> size argument? A little simpler that way, and no fear of not getting the
> whole mimetype.

Works; the reason I did it the other way is that some people have
objections to any functions returning a malloced string to you; they
are why strdup is still considered questionable in some circles.  OTOH,
if glib does things this way there's no reason to be different, and
g_strconcat certainly implies that the current style leans toward
malloc()ing on my own.

> What happens if it's a bad URL or there's an http error?

I was figuring return -1 and set some errno, but then I realized that's
a very stdio-ish way of doing things, and may not be appropriate; what
is the usual Gnome manner?
-- 
Graham Hughes <thrag@treepeople.dyn.ml.org> 
http://treepeople.dyn.ml.org/thrag/
PGP Fingerprint: 36 15 AD 83 6D 2F D8 DE  EC 87 86 8A A2 79 E7 E6

PGP signature



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