On Thu, May 10, 2018 at 07:26:02PM +0200, Katerina Koukiou wrote: > Signed-off-by: Katerina Koukiou <kkouk...@redhat.com> > --- > data/org.libvirt.Domain.xml | 9 +++++++ > src/events.c | 60 > +++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 69 insertions(+) > > diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml > index db5da09..a9a6f5c 100644 > --- a/data/org.libvirt.Domain.xml > +++ b/data/org.libvirt.Domain.xml > @@ -630,6 +630,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="TrayChange"> > <annotation name="org.gtk.GDBus.DocString" > value="See > https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventTrayChangeCallback"/> > diff --git a/src/events.c b/src/events.c > index b47a4a1..f927b26 100644 > --- a/src/events.c > +++ b/src/events.c > @@ -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", local->node); > + g_variant_builder_add(&builder, "s", 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", remote->node); > + g_variant_builder_add(&builder, "s", remote->service);
For local and remote both node and service can be NULL, so we need handle that. Since we have this pattern in multiple cases, I would recommend adding macro: #define VIRT_EMTPY_STR(s) ((s) ? (s) : "") similar to the EMTPYSTR from libvirt and use it here. As a followup patch we can use that macro in all other cases. Pavel
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list