Signed-off-by: Anya Harter <aharter@xxxxxxxxxx> --- data/org.libvirt.Interface.xml | 5 +++++ src/interface.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml index 93fa32f..ad7c326 100644 --- a/data/org.libvirt.Interface.xml +++ b/data/org.libvirt.Interface.xml @@ -3,5 +3,10 @@ <node name="/org/libvirt/interface"> <interface name="org.libvirt.Interface"> + <property name="Name" type="s" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetName"/> + <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> + </property> </interface> </node> diff --git a/src/interface.c b/src/interface.c index 6dbc702..733ce44 100644 --- a/src/interface.c +++ b/src/interface.c @@ -24,7 +24,29 @@ virtDBusInterfaceGetVirInterface(virtDBusConnect *connect, return interface; } +static void +virtDBusInterfaceGetName(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virInterface) interface = NULL; + const gchar *name; + + interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error); + if (!interface) + return; + + name = virInterfaceGetName(interface); + if (!name) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("s", name); +} + static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = { + { "Name", virtDBusInterfaceGetName, NULL }, { 0 } }; -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list