[Vala] Tidy way to have dbus client and server in the same project?



I have a project where my settings application uses dbus to talk to a
daemon, which is part of the same codebase, to collect runtime
information. Right now I have some code belonging to the settings
application that describes the daemon's dbus interface, and some other
code for the daemon that implements it.

What I would like to do is something like this:

[DBus (name = "org.brainbreak.Helper")]
public interface BreakHelperRemote : Object {
        public abstract string get_status_for_break(string break_name) throws IOError;
        public abstract void trigger_break(string break_name) throws IOError;
}

[DBus (name = "org.brainbreak.Helper")]
private class BreakHelperServer : BreakHelperRemote, Object {
        public string get_status_for_break(string break_name) {
                // blah
        }

        public void trigger_break(string break_name) {
                // blah
        }
}


Notes:
I'm not sure my design is particularly logical here because I kind of
guessed at it, so if it looks wrong it probably is.
BreakHelperRemote would really have made more sense as
IBreakHelperServer (or vice versa with the I).


When I was structuring this like the above, I got a warning:
helper/main.c:450:2: warning: implicit declaration of function
'break_helper_remote_get_status_for_break'
[-Wimplicit-function-declaration]
helper/main.c:450:9: warning: assignment makes pointer from integer
without a cast [enabled by default]
Function `break_helper_remote_get_status_for_break' implicitly
converted to pointer at helper/main.c:450

Because of that warning, Debian's build bot failed my build:
http://wiki.debian.org/ImplicitPointerConversions

Now, I worked around the problem by making BreakHelperServer _not_
implement BreakHelperRemote. This is fine (it's arguably 17 characters
less repetition now), but I kind of liked when a change in
BreakHelperRemote or BreakHelperServer would cause a build error until
I lined them up again.
So, is there a way to explicitly say “this class is an implementation
of this dbus interface,” or am I missing the point here? :)

Dylan



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