---
libvirt-gconfig/Makefile.am | 2 +
libvirt-gconfig/libvirt-gconfig-domain-sound.c | 86 ++++++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-sound.h | 77 +++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig.h | 1 +
libvirt-gconfig/libvirt-gconfig.sym | 14 +++-
libvirt-gconfig/tests/test-domain-create.c | 8 ++
6 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-sound.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-sound.h
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 660d090..6342431 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -34,6 +34,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-os.h \
libvirt-gconfig-domain-seclabel.h \
libvirt-gconfig-domain-snapshot.h \
+ libvirt-gconfig-domain-sound.h \
libvirt-gconfig-domain-timer.h \
libvirt-gconfig-domain-video.h \
libvirt-gconfig-helpers.h \
@@ -79,6 +80,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-os.c \
libvirt-gconfig-domain-seclabel.c \
libvirt-gconfig-domain-snapshot.c \
+ libvirt-gconfig-domain-sound.c \
libvirt-gconfig-domain-timer.c \
libvirt-gconfig-domain-video.c \
libvirt-gconfig-helpers.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-sound.c
b/libvirt-gconfig/libvirt-gconfig-domain-sound.c
new file mode 100644
index 0000000..1fdbb43
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-sound.c
@@ -0,0 +1,86 @@
+/*
+ * libvirt-gconfig-domain-sound.c: libvirt domain sound configuration
+ *
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * 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(a)gmail.com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
+
+#define GVIR_CONFIG_DOMAIN_SOUND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_SOUND,
GVirConfigDomainSoundPrivate))
+
+struct _GVirConfigDomainSoundPrivate
+{
+ gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainSound, gvir_config_domain_sound,
GVIR_TYPE_CONFIG_DOMAIN_DEVICE);
+
+
+static void gvir_config_domain_sound_class_init(GVirConfigDomainSoundClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(GVirConfigDomainSoundPrivate));
+}
+
+
+static void gvir_config_domain_sound_init(GVirConfigDomainSound *sound)
+{
+ g_debug("Init GVirConfigDomainSound=%p", sound);
+
+ sound->priv = GVIR_CONFIG_DOMAIN_SOUND_GET_PRIVATE(sound);
+}
+
+
+GVirConfigDomainSound *gvir_config_domain_sound_new(void)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new(GVIR_TYPE_CONFIG_DOMAIN_SOUND,
+ "sound", NULL);
+ return GVIR_CONFIG_DOMAIN_SOUND(object);
+}
+
+GVirConfigDomainSound *gvir_config_domain_sound_new_from_xml(const gchar *xml,
+ GError **error)
+{
+ GVirConfigObject *object;
+
+ object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_DOMAIN_SOUND,
+ "sound", NULL, xml, error);
+ return GVIR_CONFIG_DOMAIN_SOUND(object);
+}
+
+void gvir_config_domain_sound_set_model(GVirConfigDomainSound *sound,
+ GVirConfigDomainSoundModel model)
+{
+ GVirConfigObject *node;
+
+ g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_SOUND(sound));
+ node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(sound),
+ "sound");
+ g_return_if_fail(GVIR_IS_CONFIG_OBJECT(node));
+ gvir_config_object_set_attribute_with_type(node, "model",
+ GVIR_TYPE_CONFIG_DOMAIN_SOUND_MODEL,
+ model,
+ NULL);
+ g_object_unref(G_OBJECT(node));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-sound.h
b/libvirt-gconfig/libvirt-gconfig-domain-sound.h
new file mode 100644
index 0000000..706b2b1
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-sound.h
@@ -0,0 +1,77 @@
+/*
+ * libvirt-gconfig-domain-sound.h: libvirt domain sound configuration
+ *
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * 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(a)gmail.com>
+ */
+
+#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_SOUND_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_SOUND_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_SOUND (gvir_config_domain_sound_get_type ())
+#define GVIR_CONFIG_DOMAIN_SOUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GVIR_TYPE_CONFIG_DOMAIN_SOUND, GVirConfigDomainSound))
+#define GVIR_CONFIG_DOMAIN_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GVIR_TYPE_CONFIG_DOMAIN_SOUND, GVirConfigDomainSoundClass))
+#define GVIR_IS_CONFIG_DOMAIN_SOUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GVIR_TYPE_CONFIG_DOMAIN_SOUND))
+#define GVIR_IS_CONFIG_DOMAIN_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GVIR_TYPE_CONFIG_DOMAIN_SOUND))
+#define GVIR_CONFIG_DOMAIN_SOUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GVIR_TYPE_CONFIG_DOMAIN_SOUND, GVirConfigDomainSoundClass))
+
+typedef struct _GVirConfigDomainSound GVirConfigDomainSound;
+typedef struct _GVirConfigDomainSoundPrivate GVirConfigDomainSoundPrivate;
+typedef struct _GVirConfigDomainSoundClass GVirConfigDomainSoundClass;
+
+struct _GVirConfigDomainSound
+{
+ GVirConfigDomainDevice parent;
+
+ GVirConfigDomainSoundPrivate *priv;
+
+ /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainSoundClass
+{
+ GVirConfigDomainDeviceClass parent_class;
+
+ gpointer padding[20];
+};
+
+typedef enum {
+ GVIR_CONFIG_DOMAIN_SOUND_MODEL_SB16,
+ GVIR_CONFIG_DOMAIN_SOUND_MODEL_ES1370,
+ GVIR_CONFIG_DOMAIN_SOUND_MODEL_PCSPK,
+ GVIR_CONFIG_DOMAIN_SOUND_MODEL_AC97,
+ GVIR_CONFIG_DOMAIN_SOUND_MODEL_ICH6
+} GVirConfigDomainSoundModel;
+
+GType gvir_config_domain_sound_get_type(void);
+
+GVirConfigDomainSound *gvir_config_domain_sound_new(void);
+GVirConfigDomainSound *gvir_config_domain_sound_new_from_xml(const gchar *xml,
+ GError **error);
+void gvir_config_domain_sound_set_model(GVirConfigDomainSound *sound,
+ GVirConfigDomainSoundModel model);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_SOUND_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index f37ece0..7176400 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -51,6 +51,7 @@
#include <libvirt-gconfig/libvirt-gconfig-domain-os.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-seclabel.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-sound.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-timer.h>
#include <libvirt-gconfig/libvirt-gconfig-domain-video.h>
#include <libvirt-gconfig/libvirt-gconfig-enum-types.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index fdcfecf..39f39d4 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -157,10 +157,6 @@ LIBVIRT_GCONFIG_0.0.3 {
gvir_config_domain_os_set_arch;
gvir_config_domain_os_type_get_type;
- gvir_config_domain_snapshot_get_type;
- gvir_config_domain_snapshot_new;
- gvir_config_domain_snapshot_new_from_xml;
-
gvir_config_domain_seclabel_get_type;
gvir_config_domain_seclabel_type_get_type;
gvir_config_domain_seclabel_new;
@@ -170,6 +166,16 @@ LIBVIRT_GCONFIG_0.0.3 {
gvir_config_domain_seclabel_set_baselabel;
gvir_config_domain_seclabel_set_label;
+ gvir_config_domain_snapshot_get_type;
+ gvir_config_domain_snapshot_new;
+ gvir_config_domain_snapshot_new_from_xml;
+
+ gvir_config_domain_sound_get_type;
+ gvir_config_domain_sound_model_get_type;
+ gvir_config_domain_sound_new;
+ gvir_config_domain_sound_new_from_xml;
+ gvir_config_domain_sound_set_model;
+
gvir_config_domain_timer_get_type;
gvir_config_domain_timer_new;
gvir_config_domain_timer_new_from_xml;
diff --git a/libvirt-gconfig/tests/test-domain-create.c
b/libvirt-gconfig/tests/test-domain-create.c
index c5f0027..21c7664 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -146,6 +146,14 @@ int main(void)
GVIR_CONFIG_DOMAIN_VIDEO_MODEL_QXL);
devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(video));
+ /* sound node */
+ GVirConfigDomainSound *sound;
+
+ sound = gvir_config_domain_sound_new();
+ gvir_config_domain_sound_set_model(sound,
+ GVIR_CONFIG_DOMAIN_SOUND_MODEL_ES1370);
+ devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(sound));
+
/* console node */
GVirConfigDomainConsole *console;
GVirConfigDomainChardevSourcePty *pty;
--
1.7.7.4