Commit 77f8b24e authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Name property for NWFilter Interface

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent 5565b453
......@@ -3,5 +3,10 @@
<node name="/org/libvirt/nwfilter">
<interface name="org.libvirt.NWFilter">
<property name="Name" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetName"/>
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
</interface>
</node>
......@@ -3,7 +3,50 @@
#include <libvirt/libvirt.h>
static virNWFilterPtr
virtDBusNWFilterGetVirNWFilter(virtDBusConnect *connect,
const gchar *objectPath,
GError **error)
{
virNWFilterPtr nwfilter;
if (virtDBusConnectOpen(connect, error) < 0)
return NULL;
nwfilter = virtDBusUtilVirNWFilterFromBusPath(connect->connection,
objectPath,
connect->nwfilterPath);
if (!nwfilter) {
virtDBusUtilSetLastVirtError(error);
return NULL;
}
return nwfilter;
}
static void
virtDBusNWFilterGetName(const gchar *objectPath,
gpointer userData,
GVariant **value,
GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virNWFilter) nwfilter = NULL;
const gchar *name;
nwfilter = virtDBusNWFilterGetVirNWFilter(connect, objectPath, error);
if (!nwfilter)
return;
name = virNWFilterGetName(nwfilter);
if (!name)
return virtDBusUtilSetLastVirtError(error);
*value = g_variant_new("s", name);
}
static virtDBusGDBusPropertyTable virtDBusNWFilterPropertyTable[] = {
{ "Name", virtDBusNWFilterGetName, NULL },
{ 0 }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment