Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Secret.xml | 5 +++++ src/secret.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 8ee6f0c..5cce9d3 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -8,5 +8,10 @@ value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUUIDString"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> </property> + <property name="UsageID" type="s" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageID"/> + <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> + </property> </interface> </node> diff --git a/src/secret.c b/src/secret.c index 1780d96..ef0ebcd 100644 --- a/src/secret.c +++ b/src/secret.c @@ -44,8 +44,30 @@ virtDBusSecretGetUUID(const gchar *objectPath, *value = g_variant_new("s", uuid); } +static void +virtDBusSecretGetUsageID(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virSecret) secret = NULL; + const gchar *usageID; + + secret = virtDBusSecretGetVirSecret(connect, objectPath, error); + if (!secret) + return; + + usageID = virSecretGetUsageID(secret); + if (!usageID) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("s", usageID); +} + static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] = { { "UUID", virtDBusSecretGetUUID, NULL }, + { "UsageID", virtDBusSecretGetUsageID, NULL }, { 0 } }; -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list