Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.NWFilter.xml | 5 +++++ src/nwfilter.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/data/org.libvirt.NWFilter.xml b/data/org.libvirt.NWFilter.xml index 9a1b44f..fae61dc 100644 --- a/data/org.libvirt.NWFilter.xml +++ b/data/org.libvirt.NWFilter.xml @@ -8,5 +8,10 @@ value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetName"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> </property> + <property name="UUID" type="s" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUIDString"/> + <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> + </property> </interface> </node> diff --git a/src/nwfilter.c b/src/nwfilter.c index c72317e..90183a7 100644 --- a/src/nwfilter.c +++ b/src/nwfilter.c @@ -45,8 +45,29 @@ virtDBusNWFilterGetName(const gchar *objectPath, *value = g_variant_new("s", name); } +static void +virtDBusNWFilterGetUUID(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virNWFilter) nwfilter = NULL; + gchar uuid[VIR_UUID_STRING_BUFLEN] = ""; + + nwfilter = virtDBusNWFilterGetVirNWFilter(connect, objectPath, error); + if (!nwfilter) + return; + + if (virNWFilterGetUUIDString(nwfilter, uuid) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("s", uuid); +} + static virtDBusGDBusPropertyTable virtDBusNWFilterPropertyTable[] = { { "Name", virtDBusNWFilterGetName, NULL }, + { "UUID", virtDBusNWFilterGetUUID, NULL }, { 0 } }; -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list