From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> 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 diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 2c8c2a5..7c9e8c0 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -18,7 +18,9 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ + libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ + libvirt-gconfig-domain-graphics-vnc.h \ libvirt-gconfig-domain-input.h \ libvirt-gconfig-domain-interface.h \ libvirt-gconfig-domain-interface-network.h \ @@ -48,7 +50,9 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ + libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ + libvirt-gconfig-domain-graphics-vnc.c \ libvirt-gconfig-domain-input.c \ libvirt-gconfig-domain-interface.c \ libvirt-gconfig-domain-interface-network.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c new file mode 100644 index 0000000..1d10173 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c @@ -0,0 +1,100 @@ +/* + * libvirt-gobject-config-domain-graphics-sdl.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxx> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlPrivate)) + +struct _GVirConfigDomainGraphicsSdlPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsSdl, gvir_config_domain_graphics_sdl, GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_sdl_class_init(GVirConfigDomainGraphicsSdlClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsSdlPrivate)); +} + + +static void gvir_config_domain_graphics_sdl_init(GVirConfigDomainGraphicsSdl *graphics_sdl) +{ + g_debug("Init GVirConfigDomainGraphicsSdl=%p", graphics_sdl); + + graphics_sdl->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_PRIVATE(graphics_sdl); +} + + +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "sdl", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object); +} + +GVirConfigDomainGraphicsSdl * +gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, + "graphics", NULL, xml, error); + if (object == NULL) + return NULL; + gvir_config_object_set_attribute(object, "type", "sdl", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object); +} + +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, + NULL); +} + +void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, + const gchar *disp) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(graphics)); + + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), + "display", disp, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h new file mode 100644 index 0000000..de81566 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h @@ -0,0 +1,71 @@ +/* + * libvirt-gconfig-domain-graphics-sdl.h: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxx> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL (gvir_config_domain_graphics_sdl_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdl)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlClass)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_SDL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_SDL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SDL, GVirConfigDomainGraphicsSdlClass)) + +typedef struct _GVirConfigDomainGraphicsSdl GVirConfigDomainGraphicsSdl; +typedef struct _GVirConfigDomainGraphicsSdlPrivate GVirConfigDomainGraphicsSdlPrivate; +typedef struct _GVirConfigDomainGraphicsSdlClass GVirConfigDomainGraphicsSdlClass; + +struct _GVirConfigDomainGraphicsSdl +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsSdlPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsSdlClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_sdl_get_type(void); + +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void); +GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new_from_xml(const gchar *xml, + GError **error); +void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl *graphics, + const gchar *path); +void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, + const gchar *disp); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SDL_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c new file mode 100644 index 0000000..edeccd9 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c @@ -0,0 +1,101 @@ +/* + * libvirt-gobject-config-domain-graphics-vnc.c: libvirt glib integration + * + * Copyright (C) 2011 Red Hat + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxx> + */ + +#include <config.h> + +#include <string.h> + +#include <libxml/tree.h> + +#include "libvirt-gconfig/libvirt-gconfig.h" +#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h" +#include "libvirt-gconfig/libvirt-gconfig-object-private.h" + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncPrivate)) + +struct _GVirConfigDomainGraphicsVncPrivate +{ + gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsVnc, gvir_config_domain_graphics_vnc, GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_vnc_class_init(GVirConfigDomainGraphicsVncClass *klass) +{ + g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsVncPrivate)); +} + + +static void gvir_config_domain_graphics_vnc_init(GVirConfigDomainGraphicsVnc *graphics_vnc) +{ + g_debug("Init GVirConfigDomainGraphicsVnc=%p", graphics_vnc); + + graphics_vnc->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_PRIVATE(graphics_vnc); +} + + +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void) +{ + GVirConfigObject *object; + + object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, + "graphics", NULL); + gvir_config_object_set_attribute(object, "type", "vnc", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object); +} + +GVirConfigDomainGraphicsVnc * +gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml, + GError **error) +{ + GVirConfigObject *object; + + object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, + "graphics", NULL, xml, error); + if (object == NULL) + return NULL; + gvir_config_object_set_attribute(object, "type", "vnc", NULL); + return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object); +} + + +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); +} + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port) +{ + g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics)); + + gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + "port", G_TYPE_UINT, port, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h new file mode 100644 index 0000000..93765d5 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h @@ -0,0 +1,73 @@ +/* + * libvirt-gconfig-domain-graphics-vnc.h: libvirt gobject integration + * + * Copyright (C) 2011 Red Hat + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Christophe Fergeau <cfergeau@xxxxxxxxx> + */ + +#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD) +#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly." +#endif + +#ifndef __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ +#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ + +G_BEGIN_DECLS + +#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC (gvir_config_domain_graphics_vnc_get_type ()) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVnc)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncClass)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC)) +#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC)) +#define GVIR_CONFIG_DOMAIN_GRAPHICS_VNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_VNC, GVirConfigDomainGraphicsVncClass)) + +typedef struct _GVirConfigDomainGraphicsVnc GVirConfigDomainGraphicsVnc; +typedef struct _GVirConfigDomainGraphicsVncPrivate GVirConfigDomainGraphicsVncPrivate; +typedef struct _GVirConfigDomainGraphicsVncClass GVirConfigDomainGraphicsVncClass; + +struct _GVirConfigDomainGraphicsVnc +{ + GVirConfigDomainGraphics parent; + + GVirConfigDomainGraphicsVncPrivate *priv; + + /* Do not add fields to this struct */ +}; + +struct _GVirConfigDomainGraphicsVncClass +{ + GVirConfigDomainGraphicsClass parent_class; + + gpointer padding[20]; +}; + +GType gvir_config_domain_graphics_vnc_get_type(void); + +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void); +GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new_from_xml(const gchar *xml, + GError **error); + +void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *graphics, + gboolean autoport); + +void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics, + unsigned int port); + +G_END_DECLS + +#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ */ diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h index 8525065..80ca6f1 100644 --- a/libvirt-gconfig/libvirt-gconfig.h +++ b/libvirt-gconfig/libvirt-gconfig.h @@ -34,7 +34,9 @@ #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h> #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h> #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h> +#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h> #include <libvirt-gconfig/libvirt-gconfig-domain-input.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h> #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 9b74c35..9236101 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -64,11 +64,23 @@ LIBVIRT_GCONFIG_0.0.1 { gvir_config_domain_graphics_get_type; + gvir_config_domain_graphics_sdl_get_type; + gvir_config_domain_graphics_sdl_new; + gvir_config_domain_graphics_sdl_new_from_xml; + gvir_config_domain_graphics_sdl_set_display; + gvir_config_domain_graphics_sdl_set_xauthority; + gvir_config_domain_graphics_spice_get_type; gvir_config_domain_graphics_spice_new; gvir_config_domain_graphics_spice_new_from_xml; gvir_config_domain_graphics_spice_set_port; + gvir_config_domain_graphics_vnc_get_type; + gvir_config_domain_graphics_vnc_new; + gvir_config_domain_graphics_vnc_new_from_xml; + gvir_config_domain_graphics_vnc_set_autoport; + gvir_config_domain_graphics_vnc_set_port; + gvir_config_domain_input_bus_get_type; gvir_config_domain_input_get_type; gvir_config_domain_input_device_type_get_type; -- 1.7.6.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list