[libvirt] [PATCH libvirt-glib 5/5] Add objects for dealing with SDL and VNC graphics config

Daniel P. Berrange berrange at redhat.com
Thu Dec 1 10:28:14 UTC 2011


On Wed, Nov 30, 2011 at 06:48:08PM +0100, Christophe Fergeau wrote:
> On Wed, Nov 30, 2011 at 04:52:07PM +0000, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > Add GVirConfigDomainGraphicsSdl and GVirConfigDomainGraphicsVnc
> > ---
> >  libvirt-gconfig/Makefile.am                        |    4 +
> >  .../libvirt-gconfig-domain-graphics-sdl.c          |  100 +++++++++++++++++++
> >  .../libvirt-gconfig-domain-graphics-sdl.h          |   71 ++++++++++++++
> >  .../libvirt-gconfig-domain-graphics-vnc.c          |  101 ++++++++++++++++++++
> >  .../libvirt-gconfig-domain-graphics-vnc.h          |   73 ++++++++++++++
> >  libvirt-gconfig/libvirt-gconfig.h                  |    2 +
> >  libvirt-gconfig/libvirt-gconfig.sym                |   12 +++
> >  7 files changed, 363 insertions(+), 0 deletions(-)
> >  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
> >  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h
> >  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> >  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h

> > +void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics,
> > +                                                    const gchar *path)
> > +{
> > +    g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics));
> > +
> > +    gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics),
> > +                                     "xauthority", path,
> 
> The attribute name is apparently xauth (looking at the doc at
> http://libvirt.org/formatdomain.html#elementsGraphics )

Opps, yes I should have known that.


> > +void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics,
> > +                                                  gboolean autoport)
> > +{
> > +    g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics));
> > +
> > +    gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics),
> > +                                     "autoport", autoport ? "yes" : "no",
> > +                                     NULL);
> 
> set_attribute_with_type handles boolean and will turn them into "yes"/"no"

Neat !

> > +}
> > +
> > +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics,
> > +                                         unsigned int port)
> 
> We won't be able to set it to -1 to use the legacy syntax, but it doesn't
> really matter since we have set_autoport

Actually IMHO it does matter - the corresponding get_port will have to return
a signed int, so the setter should accept one too. In addition, for spice we
need to be able to set '-1' explicitly for the TLS port.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list