Describe Vala/DBus here. This is some ideas.


Full flexible DBus supporting is important for vala:

  • vala aims to be the development language of gnome.
  • gnome is utilizing dbus in the future.

Inherited Members

Inherieted members are also member of current class. Thus they should be treated equally.

  • signals
    • being able to put signals inherited from base class on the bus.
  • methods
    • ordinary method
    • overriding an ordinary method
    • overriding an virtual method
      • a special case, because vala only generate a vtable-function but not a seperate member function to invoke it; we need to use the base class member function, which will forward the request to the proper real vtable-function.
  • properties
    • being able to put properties inherited from base class on the bus.

Visibility Issue

  • not every public member shall be exposed on the bus
  • extend [DBus ] directive to support selectively exposing members;
    • [DBus signals = "signal list"]
    • [DBus properties = " prop list"]
    • [DBus methods = "method list"]
    • not clearly showing which is inherited which is not.
  • can not use [DBusMember] or similiar per member directive, because of the inherited members are not shown here.
  • Does it make sense to expose private member on the bus?
    • possibly, because public/private intends to restrict the access from objects with-in the process; whereas exposing an object on DBus is a different story.

Task Tracking

Things to be done:

  1. signals, from the base class and from the class
  2. properties, from the base class and from the class
  3. overriden methods
  4. void return value
  5. string[] return value
  6. Transparent object access, if fails, use 7
  7. lookup registered object from a connection.

So far has been done at svn:// (in the patch files)

  1. done, [DBus (signals = "sig1, sig2")]; Bug 531132

  2. intrepolation is done, [DBus (properties = "p1, p2")] but no dynamic object supporting yet; Bug 531132;

  3. done, using the parent class method cname; Bug 531132 and Bug 531135;
  4. not done; don't know why it fails.
  5. string[] return value; finished in Bug 530455 and Bug 531251, also Bug 529351.
  6. not easy to done(DBus returns a DBusGObjectPath, which is a string) and not seeming to be reliable.
  7. done in dbus-glib-1.vapi (weak Object DBus.Connection::lookup_object(string path)); Bug 531131

Use Case

Then it follows a piece of example code, which is excepted to work after all are done:

Server side code:

class Funk : Object {
  public void signal funky();
  public virtual void funk() {

[DBus (name = "org.gnome.TestServer", signals = "funky, echo", properties = "name, mess")]
class TestServer: Funk {
  public string name {get; construct;}
  public string mess {get; set;}

  public TestServer(string name) { = name;
  construct {
     mess = name;
  public void signal echo(string msg);
  public override void funk() {
  public string ping(string msg) {

  public void main(string[] args){
     MainLoop loop = new MainLoop(..);
     .... Setup dbus connection....
     TestServer server = new TestServer("funky server");
     conn.register_object("/org/gnome/TestServer", server);;

Client side code

   public void main(string[] args {
     ... Setup dbus connection...
     var server = conn.get_object(..., "/org/gnome/TestServer", ......);
     server.echo += (o, s) => {
     server.funky += (o) => {
        message("funky signal received");
     };"pingping ping");
     server.mess = "messy echo";"ping a mess");


Projects/Vala/DBus (last edited 2013-11-22 16:48:25 by WilliamJonMcCann)