I'm trying to write a client for MPRIS 2.0 specs, and one of my TODO list is to 
get all Media players which activated.
This is done by passing all DBus addresses and check if it's in the format of 
"org.mpris.MediaPlayer2.*".
For doing this, I need to add callback to method "list_names" in interface 
"/org/freedesktop/DBus"(which I called MasterDBus) in "org.freedesktop.DBus".
This is a relevant part of my code:

[DBus (name = "org.freedesktop.DBus")]
public interface MasterDBus {
    public abstract void list_names (MDBusCallBack cb);
}

public delegate void MDBusCallBack (string[] addresses);

class ... {
    private bool on_ready () {

        try {
            bus.list_names (list_names_reply_cb);
        } catch (GLib.Error e) {
            message ("Can't list: %s", e.message);
        }

        return false;
    }

    private void create () {
        change_background.connect (on_change_background);

        try {
            bus = Bus.get_proxy_sync (BusType.SESSION, "org.freedesktop.DBus",
              "/org/freedesktop/DBus");
        }
        catch(IOError e) {
            print("%s", e.message);
        }
}

For me it looks fine. Even for valac, but it still fails(assertion):

** [Some warnings, not related.]

** (valac:2252): CRITICAL **: vala_gvariant_module_get_basic_type_info: 
assertion `signature != NULL' failed
src/main.vala:6.35-6.47: error: GVariant serialization of type `MDBusCallBack' 
is not supported
    public abstract void list_names (MDBusCallBack cb);
                                     ^^^^^^^^^^^^^

** (valac:2252): CRITICAL **: vala_ccode_identifier_construct: assertion `_name 
!= NULL' failed

** (valac:2252): CRITICAL **: vala_gvariant_module_get_basic_type_info: 
assertion `signature != NULL' failed
src/main.vala:6.35-6.47: error: GVariant deserialization of type 
`MDBusCallBack' is not supported
    public abstract void list_names (MDBusCallBack cb);
                                     ^^^^^^^^^^^^^

** (valac:2252): CRITICAL **: vala_ccode_identifier_construct: assertion `_name 
!= NULL' failed
src/main.vala:16.2-16.11: error: missing class prerequisite for interface 
`MasterDBus', add GLib.Object to interface declaration if unsure
    MasterDBus bus;
    ^^^^^^^^^^
src/main.vala:16.2-16.11: error: missing class prerequisite for interface 
`MasterDBus', add GLib.Object to interface declaration if unsure
    MasterDBus bus;
    ^^^^^^^^^^
Compilation failed: 4 error(s), 3 warning(s)


Why this is happening? How shell I fix it?
                                          
_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to