Hey, On Mon, Jul 18, 2016 at 04:36:39PM +0300, Visarion Alexandru wrote: > Learn to set the address that spice is listening on. > --- > .../libvirt-gconfig-domain-graphics-spice.c | 18 ++++++++++++++++++ > .../libvirt-gconfig-domain-graphics-spice.h | 3 +++ > libvirt-gconfig/libvirt-gconfig.sym | 1 + > 3 files changed, 22 insertions(+) > > diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c > index 079ea27..a773084 100644 > --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c > +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c > @@ -165,3 +165,21 @@ void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *gra > gvir_config_object_replace_child_with_attribute_enum > (GVIR_CONFIG_OBJECT(graphics), "gl", "enable", G_TYPE_BOOLEAN, gl); > } > + > +void gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice *graphics, > + const char *address) > +{ > + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics)); > + > + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), "listen", address, NULL); <spice listen="xxx"/> > + > + gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics), > + "listen", > + "address", > + address); > + > + gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics), > + "listen", > + "type", > + "address"); and <spice><listen type="address" address="xxx"/></spice> are 2 ways of expressing the same thing, with the <listen type="address"> one being fairly new, and <spice listen="xxx"/> is slowly being deprecated. When <spice listen="xxx"/> is used, a <listen> node is automatically created iirc. To handle the <listen> nodes, I think it would make more sense to have dedicated classes to handle it, and a gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics, GVirConfigDomainListen *listen) method. So for now, in gvir_config_domain_graphics_spice_set_listen_address I would only set the "listen" attribute. Then I wonder if the function should take a GInetAddress rather than a const char *? The alignment of the code is also odd, we try to align the split argumetns to function calls with the parens on the first line, does this show up this way in your editor? For example gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics), "listen", "type", "address"); Christophe
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list