Commit 3f38047e authored by Katerina Koukiou's avatar Katerina Koukiou

events: Register VIR_DOMAIN_EVENT_ID_GRAPHICS

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Pavel Hrdina's avatarPavel Hrdina <phrdina@redhat.com>
parent f38d2f35
......@@ -650,6 +650,15 @@
<arg name="device" type="s"/>
<arg name="reason" type="u"/>
</signal>
<signal name="Graphics">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventGraphicsCallback"/>
<arg name="phase" type="i"/>
<arg name="local" type="(iss)"/>
<arg name="remote" type="(iss)"/>
<arg name="authScheme" type="s"/>
<arg name="identities" type="a(ss)"/>
</signal>
<signal name="JobCompleted">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventJobCompletedCallback"/>
......
......@@ -184,6 +184,62 @@ virtDBusEventsDomainDeviceRemoved(virConnectPtr connection G_GNUC_UNUSED,
return 0;
}
static gint
virtDBusEventsDomainGraphics(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
gint phase,
const virDomainEventGraphicsAddress *local,
const virDomainEventGraphicsAddress *remote,
const gchar *authScheme,
const virDomainEventGraphicsSubject *subject,
gpointer opaque)
{
virtDBusConnect *connect = opaque;
g_autofree gchar *path = NULL;
GVariantBuilder builder;
GVariant *gret;
path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
g_variant_builder_init(&builder, G_VARIANT_TYPE("(i(iss)(iss)sa(ss))"));
g_variant_builder_add(&builder, "i", phase);
g_variant_builder_open(&builder, G_VARIANT_TYPE("(iss)"));
g_variant_builder_add(&builder, "i", local->family);
g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(local->node));
g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(local->service));
g_variant_builder_close(&builder);
g_variant_builder_open(&builder, G_VARIANT_TYPE("(iss)"));
g_variant_builder_add(&builder, "i", remote->family);
g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(remote->node));
g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(remote->service));
g_variant_builder_close(&builder);
g_variant_builder_add(&builder, "s", authScheme);
g_variant_builder_open(&builder, G_VARIANT_TYPE("a(ss)"));
for (gint i = 0; i < subject->nidentity; i++) {
g_variant_builder_open(&builder, G_VARIANT_TYPE("(ss)"));
g_variant_builder_add(&builder, "s", subject->identities[i].type);
g_variant_builder_add(&builder, "s", subject->identities[i].name);
g_variant_builder_close(&builder);
}
g_variant_builder_close(&builder);
gret = g_variant_builder_end(&builder);
g_dbus_connection_emit_signal(connect->bus,
NULL,
path,
VIRT_DBUS_DOMAIN_INTERFACE,
"Graphics",
gret,
NULL);
return 0;
}
static gint
virtDBusEventsDomainJobCompleted(virConnectPtr connection G_GNUC_UNUSED,
virDomainPtr domain,
......@@ -652,6 +708,10 @@ virtDBusEventsRegister(virtDBusConnect *connect)
VIR_DOMAIN_EVENT_ID_DISK_CHANGE,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDiskChange));
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_GRAPHICS,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainGraphics));
virtDBusEventsRegisterDomainEvent(connect,
VIR_DOMAIN_EVENT_ID_JOB_COMPLETED,
VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainJobCompleted));
......
......@@ -4,6 +4,8 @@
#include <libvirt/libvirt.h>
#define VIRT_DBUS_EMPTY_STR(s) ((s) ? (s) : "")
#define VIRT_DBUS_ERROR virtDBusErrorQuark()
#define virtDBusUtilAutoLock g_autoptr(GMutexLocker) G_GNUC_UNUSED
......
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