[Telepathy] Ruby binding for Telepathy?
Alban Crequy
muadda at gmail.com
Mon Nov 26 10:39:55 PST 2007
Hi,
It would be nice to have Telepathy applications in Ruby. Ruby already
has a D-Bus port [1] and a Gtk binding [2], so I started to write a
tool inspired from Telepathy Inspector [3].
[1] Ruby D-Bus: http://trac.luon.net/ruby-dbus/
[2] Ruby-GNOME2: http://ruby-gnome2.sourceforge.jp/
[3] Telepathy Inspector http://telepathy.freedesktop.org/wiki/TelepathyInspector
My tool use the Glib main loop ; Ruby D-Bus is able to use the Glib
main loop too. It calls some D-Bus methods and subscribe to a few
signals to update the window when the presence changes. You can see
the screencast thanks to Istanbul:
http://dede.muadda.org/~alban/d/2007/11/rti.ogm
Or try yourself:
darcs get http://dede.muadda.org/~alban/darcs/ruby_telepathy_inspector/
cd ruby_telepathy_inspector/src/
# start Empathy before continue
ruby ./rti.rb
It still need works. For example, Telepathy constants I need are
manually copied/pasted from the spec into telepathy.rb.
Methods are discovered automatically with D-Bus introspection, but it
is not entirely clean: to call the method GetProtocol from the
org.freedesktop.Telepathy.Connection interface, I use:
@protocol = @connection_iface.GetProtocol[0]
The [0] is needed to get the first item in the array of out
parameters. I can also write:
@protocol, = @connection_iface.GetProtocol
but I would prefer to be able to write:
@protocol = @connection_iface.GetProtocol
--
Alban
More information about the Telepathy
mailing list