[Telepathy] TpHandler

Danielle Madeley danielle.madeley at collabora.co.uk
Mon Nov 23 15:40:00 PST 2009


Hey all,

Based on a suggestion from Sjoerd, I have put together TpHandler, a
GObject class that handles practically all of the heavy-lifting required
to implement a Handler.

https://bugs.freedesktop.org/show_bug.cgi?id=25236
http://git.collabora.co.uk/?p=user/danni/telepathy-glib.git;a=shortlog;h=refs/heads/tphandler

It's designed so that no subclassing is required (but is possible), an
example Handler looks like this:
http://git.collabora.co.uk/?p=user/danni/telepathy-glib.git;a=blob;f=tests/dbus/handler.c;hb=refs/heads/tphandlerh

Obviously a TpObserver and TpApprover class could also exist, however
it's not possible using this pattern to design a class that can be any
combination of the three (unless someone can think of a way to
optionally publish methods on the bus, based on what callbacks are
supplied, in which case.. neat).

The only thing I'm a bit dubious about is the automatic tracking of
channels for HandleChannels (all channels passed to HandleChannels are
automatically added to the HandledChannels list, and are removed when
the channel is closed). In turn, disposing the GObject closes all of the
still open channels. This is not going to fly in the case where you are
registering a temporary client with some special filter. It might be
possible to have a "close-channels-on-dispose" property that can be set
to FALSE, combined with a tp_handler_track_channel() method call so that
a temporary Handler can pass a channel off to the real Handler, but in
general things will work correctly.

I'm planning on extending this today to support
Client.Interface.Requests using GSignals (since implementing these
callbacks is neither here nor there, and you should be able to implement
as many of them as you want, unlike the main HandleChannels callback).

Everyone should feel free to jump on and bikeshed now.

--danni

-- 
Danielle Madeley

Collabora Ltd., Melbourne, Australia
http://www.collabora.co.uk/



More information about the telepathy mailing list