[Telepathy] Proposed API for client side of tp-glib

Xavier Claessens xclaesse at gmail.com
Mon Aug 6 12:07:06 PDT 2007


I was thinking about a new design for the client side API of tp-glib,
something more object-oriented than libtp. The main goal is to
completely remove dbus from the API, no more DBusGProxy, only GObjects.

First of all, dbus spec is about objects with interfaces. So I propose
to generate those GInterface from the spec. I started a branch with that
at http://projects.collabora.co.uk/~monkey/telepathy-glib-client/
(missing async API and GError param). Those interfaces should also
install all properties described by the spec.

Those interfaces can be implemented by a generated mixin that takes a
DBusGProxy object in its instance init function and for each method it
makes the corresponding dbus call, it will also connect all dbus signal
and emit the corresponding GObject signal, like that the user never see
dbus signals and can connect normal glib signals on the object.

When we get a dbus object from telepathy, we know at runtime what
interfaces it implements, so I suggest to create the GType at runtime,
that gtype would be a class inheriting from GObjectClass and
implementing the set of interfaces. Something like:

TpObject *tp_cli_channel_new (connection, name, path);

This function will get a dbus proxy for the channel interface and call
GetInterfaces. If no GType exists yet for that list of interfaces it
will create a new GType inheriting from GObjectClass and add to that
class all needed GInterface and mixins. Then it creates and return an
instance of that GType.

The benefit for client programs is to completely mask all DBus stuff, we
get one object implementing all interfaces instead of one proxy object
per interface. We have a real Object-oriented API that reflects
perfectly telepathy's spec.

But that's much more complicate that libtelepathy and will need more
work..

What do you think about? Should I continue in that way? Should I forget
about that idea and just generate functions like in libtp? Or should I
just keep using libtp and let tp-glib for CM only? Or any other idea?

Xavier Claessens.



More information about the Telepathy mailing list