Provide a way to access the DBusProxy GLib.Type
Currently, when one use a
[DBus (name="org.foo.bar")]
interface Foo.Bar : GLib.Object {
}
Using typeof(Foo.Bar)
only returns the Foo.Bar interface GType.
In order to use GLib.DBusProxyTypeFunc to create a GLib.DBusObjectManagerClient, I need to provide the GType of a DBusProxy.
I'm able to workaround the issue by knowing the internal of Valac and cheating with this:
delegate GLib.Type type_getter ();
private GLib.Type object_manager_proxy_get_type (DBusObjectManagerClient manager, string object_path, string? interface_name) {
if (interface_name == null)
return typeof (GLib.DBusObjectProxy);
switch (interface_name) {
case "org.foo.bar":
return ((type_getter)((typeof (Foo.Bar)).get_qdata (GLib.Quark.from_string ("vala-dbus-proxy-type"))))();
default:
return typeof (GLib.DBusProxy);
}
}
or simply with an extern GLib.Type get_foo_bar_proxy_type ()
and some annotations.
I, of course, don't want to do that anymore.