W3C home > Mailing lists > Public > www-lib@w3.org > July to September 1999

Re: Using libwww with gnome/gtk+

From: James Henstridge <james@daa.com.au>
Date: Wed, 1 Sep 1999 21:49:01 +0800 (WST)
To: jose.kahan@w3.org
cc: www-lib@w3.org
Message-ID: <Pine.LNX.3.96.990901211417.3725O-100000@quoll.daa.com.au>
The code for doing handling libwww events in the glib mainloop was just a
few hours hacking.  I guess I did not get round to implementing the
HTTimer_registerSetTimerCallback stuff.  It should not be hard to do.

Go ahead and add it to the news page if you want.

As for the reason for using libwww, there are a few reasons.  The event
system in libwww looks like it will work better in the background, and not
affect the responsiveness of the program.  Also, the current ftp code I
am using is not very good (it was written for a command line program, so
it blocks the interface ocasionally).

Because of libwww's event system, I should be able to get rid of some of
the recusive main loops and keep the application logic code separate from
the interface code.  Currently when a file is requested, it starts
downloading it, and periodically checking to see if there are any events
that GTK needs to handle. With libwww, I can just make use of the
terminate handler for the request and not worry about what the interface
code is doing.  Also, experience has shown that the current polling
behaviour is not very efficient (when I changed some of the code from
using polling to being an idle callback in the mainloop, it ran faster and
the interface was smoother).

Another reason is that libghttp stores the file returned from the server
in memory while the request was in progress.  This is not particularly
good if the machine does not have much memory and you are trying to
transfer a large file.

Overall, it looks like libwww could make my program work better.

James.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Wed, 1 Sep 1999 jose.kahan@w3.org wrote:

> Hello James,
> 
> In our previous episode, James Henstridge said:
> > 
> > I have been looking at using at using libwww in one of the gnome
> > (www.gnome.org) programs I have written.  In doing this I have written up
> > some event register/unregister functions that use the glib event loop,
> > which makes libwww fit nicely into just about any gnome or gtk+ program.
> > 
> > If anyone else is interested in it, it is at /gnorpm/tests/glibwww.c in
> > the gnome CVS tree, which can be viewed at:
> >   http://cvs.gnome.org/lxr/source/gnorpm/tests/glibwww.c
> >
> > This code may be useful for other people wanting to use libwww with gtk.
> 
> Good work. Would you mind if I put a link to it from the libwww NEWS page?
> 
> One question, didn't you need to register the timers too with libwww?
> When I set up my X11 libwww interface in Amaya, I had to register them too,
> using:
> 
> 	   HTTimer_registerSetTimerCallback ();
> 	   HTTimer_registerDeleteTimerCallback ();
> 
> (Same principle as with HTEvent_setRegisterCallback).
> 
> > Now for my question:  what is the best way to only link with enough of
> > libwww to get http and ftp transfers (no HTML, XML, news, gopher, telnet,
> > etc)?  With libwww compiled as multiple shared libraries under unix, it
> > seems that if you use any of the higher level libraries you end up needing
> > to link with all the other libraries.
> > 
> > It seems that if you use the HTProfile_new* functions, you end up needing
> > symbols from every other library, even if the functionality is never used.
> > Is there a better way to initialise libwww?
> 
> You'll have to write your own HTInit.c module and link to it too. That's
> what I did in Amaya to minimize the number of mini-libwww's that need to
> be linked. Look at the tiny browser (Examples/tiny.c) for an example
> of how to do it.
> 
> One last interesting question, why are you using libwww instead of ghttp?
> 
> -Jose
> 
Received on Wednesday, 1 September 1999 09:37:42 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:17 UTC