Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
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 5cce9d3..4270182 100644
--- a/data/org.libvirt.Secret.xml
+++ b/data/org.libvirt.Secret.xml
@@ -13,5 +13,10 @@
value="See
https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageID&...
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="const"/>
</property>
+ <property name="UsageType" type="u"
access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageTyp...
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="const"/>
+ </property>
</interface>
</node>
diff --git a/src/secret.c b/src/secret.c
index ef0ebcd..25b1934 100644
--- a/src/secret.c
+++ b/src/secret.c
@@ -65,9 +65,31 @@ virtDBusSecretGetUsageID(const gchar *objectPath,
*value = g_variant_new("s", usageID);
}
+static void
+virtDBusSecretGetUsageType(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virSecret) secret = NULL;
+ gint usageType;
+
+ secret = virtDBusSecretGetVirSecret(connect, objectPath, error);
+ if (!secret)
+ return;
+
+ usageType = virSecretGetUsageType(secret);
+ if (usageType < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *value = g_variant_new("u", usageType);
+}
+
static virtDBusGDBusPropertyTable virtDBusSecretPropertyTable[] = {
{ "UUID", virtDBusSecretGetUUID, NULL },
{ "UsageID", virtDBusSecretGetUsageID, NULL },
+ { "UsageType", virtDBusSecretGetUsageType, NULL },
{ 0 }
};
--
2.15.0