--
v2: use g_return_if_fail to test function args for sanity
---
libvirt-gconfig/Makefile.am|2 +
libvirt-gconfig/libvirt-gconfig-device-video.c | 133
libvirt-gconfig/libvirt-gconfig-device-video.h | 82 +++
libvirt-gconfig/libvirt-gconfig.h |1 +
libvirt-gconfig/libvirt-gconfig.sym|8 ++
libvirt-gconfig/tests/test-domain-create.c |9 ++
6 files changed, 235 insertions(+), 0 deletions(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-device-video.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-device-video.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 1be6233..05cdbd0 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -17,6 +17,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-device-graphics.h \
libvirt-gconfig-device-graphics-spice.h \
libvirt-gconfig-device-input.h \
+ libvirt-gconfig-device-video.h \
libvirt-gconfig-domain.h \
libvirt-gconfig-domain-snapshot.h \
libvirt-gconfig-helpers.h \
@@ -42,6 +43,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-device-graphics.c \
libvirt-gconfig-device-graphics-spice.c \
libvirt-gconfig-device-input.c \
+ libvirt-gconfig-device-video.c \
libvirt-gconfig-domain.c \
libvirt-gconfig-domain-snapshot.c \
libvirt-gconfig-enum-types.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-device-video.c
b/libvirt-gconfig/libvirt-gconfig-device-video.c
new file mode 100644
index 000..cbaf2f4
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device-video.c
@@ -0,0 +1,133 @@
+/*
+ * libvirt-gobject-config-device-video.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
+ */
+
+#include
+
+#include
+
+#include
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
+#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ##
__VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_DEVICE_VIDEO_GET_PRIVATE(obj) \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DEVICE_VIDEO,
GVirConfigDeviceVideoPrivate))
+
+struct _GVirConfigDeviceVideoPrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDeviceVideo, gvir_config_device_video,
GVIR_TYPE_CONFIG_DEVICE);
+
+
+static void gvir_config_device_video_class_init(GVirConfigDeviceVideoClass
*klass)
+{
+g_type_class_add_private(klass, sizeof(GVirConfigDeviceVideoPrivate));
+}
+
+
+static void gvir_config_device_video_init(GVirConfigDeviceVideo *device_video)
+{
+GVirConfigDeviceVideoPrivate *priv;
+
+DEBUG("Init GVirConfigDeviceVideo=%p", device_video);
+
+priv = device_video->priv =
GVIR_CONFIG_DEVICE_VIDEO_GET_PRIVATE(device_video);
+
+memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigDeviceVideo *gvir_config_device_video_new(void)
+{
+GVirConfigObject *object;
+
+object = gvir_config_object_new(GVIR_TYPE_CONFIG_DEVICE_VIDEO,
+"video", NULL);
+return GVIR_CONFIG_DEVICE_VIDEO(object);
+}
+
+GVirConfigDeviceVideo *gvir_config_device_video_new_from_xml(const gchar *xml,
+ GError **error)
+{
+GVirConfigObject *object;
+
+object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DEVICE_VIDEO,
+ "video", NULL, xml, error);
+return GVIR_CONFIG_DEVICE_VIDEO(object);
+}
+
+void gvir_config_device_video_set_model(GVirConfigDeviceVideo *video,
+GVirConfigDeviceVideoModel model)
+{
+xmlNodePtr node;
+const char *model_str;
+
+g_return_if_fail(GVIR_IS_CONFIG_DEVICE_VIDEO(video));
+node = gvir_config_object_replace_child(GVIR_CONFI