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

gEDA-dev: libdbus in PCB... work progresses..



Hi,

I just thought I'd send an update as to the status of my work in getting
DBUS support in PCB.

I am pleased to report that I just had the first gimpse of dbus working
with both the lesstif GUI and the GTK GUI. 

There are still some issues to work out in the code common to both, and
to tidy up the GTK HID I added to support the necessary callbacks.
(Funnily, the Lesstif version was much neater and easier to implement!)

The following functions are added to the HID interface:

    /* Causes func to be called when some condition occurs on the file
       descriptor passed. Conditions include data for reading, writing,
       hangup, and errors. user_data can be anything, it's just passed
       to func. */
      hidval (*watch_file) (int fd, unsigned int condition, void (*func)
(hidval watch, int fd, unsigned int condition, hidval user_data),
			   hidval user_data);
    /* Use this to stop a file watch. */
    void (*unwatch_file) (hidval watch);

    /* Causes func to be called in the mainloop prior to blocking */
      hidval (*add_block_hook) (void (*func) (hidval data), hidval
data);
    /* Use this to stop a mainloop block hook. */
    void (*stop_block_hook) (hidval block_hook);


I'd previously had add_mainloop_poll, which implemented a gtk'ism, where
three callback functions are registered and called at various points in
the mainloop.

When implementing the lesstif version, I found XtAppAddBlockHook, which
suffices for what we want to do, and doesn't require the mainloop to be
reimplemented by hand in our code. I have since changed the complicated
interface to the one you see above, and modified the GTK code to emulate
this behaviour. (A custom GSource, which lets you do a bit of work
before the mainloop blocks).

I still have to write the code which tracks the addition and removal of
dbus requested watches and timeouts, but the HID interface seems ok so
far.


One question...

what sort of mainloop can PCB's nogui / batch hid provide? I'm wondering
if I should try and implement the necessary timeouts and file watching?
I can see it potentially being useful to allow dbus based live scripting
of a GUI'less PCB instance.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173



_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev