1 /*
2 * libvirt-gconfig-domain-sound.c: libvirt domain sound configuration
3 *
4 * Copyright (C) 2011 Red Hat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 * Author: Christophe Fergeau <cfergeau@redhat.com>
21 */
22
23 #include <config.h>
24
25 #include "libvirt-gconfig/libvirt-gconfig.h"
26 #include "libvirt-gconfig/libvirt-gconfig-private.h"
27
28 #define GVIR_CONFIG_DOMAIN_SOUND_GET_PRIVATE(obj) \
29 (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_SOUND, GVirConfigDomainSoundPrivate))
30
31 struct _GVirConfigDomainSoundPrivate
32 {
33 gboolean unused;
34 };
35
36 G_DEFINE_TYPE_WITH_PRIVATE(GVirConfigDomainSound, gvir_config_domain_sound, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
37
38
gvir_config_domain_sound_class_init(GVirConfigDomainSoundClass * klass G_GNUC_UNUSED)39 static void gvir_config_domain_sound_class_init(GVirConfigDomainSoundClass *klass G_GNUC_UNUSED)
40 {
41 }
42
43
gvir_config_domain_sound_init(GVirConfigDomainSound * sound)44 static void gvir_config_domain_sound_init(GVirConfigDomainSound *sound)
45 {
46 sound->priv = GVIR_CONFIG_DOMAIN_SOUND_GET_PRIVATE(sound);
47 }
48
49
gvir_config_domain_sound_new(void)50 GVirConfigDomainSound *gvir_config_domain_sound_new(void)
51 {
52 GVirConfigObject *object;
53
54 object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_SOUND,
55 "sound", NULL);
56 return GVIR_CONFIG_DOMAIN_SOUND(object);
57 }
58
gvir_config_domain_sound_new_from_xml(const gchar * xml,GError ** error)59 GVirConfigDomainSound *gvir_config_domain_sound_new_from_xml(const gchar *xml,
60 GError **error)
61 {
62 GVirConfigObject *object;
63
64 object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_SOUND,
65 "sound", NULL, xml, error);
66 return GVIR_CONFIG_DOMAIN_SOUND(object);
67 }
68
gvir_config_domain_sound_set_model(GVirConfigDomainSound * sound,GVirConfigDomainSoundModel model)69 void gvir_config_domain_sound_set_model(GVirConfigDomainSound *sound,
70 GVirConfigDomainSoundModel model)
71 {
72 g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SOUND(sound));
73 gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(sound), "model",
74 GVIR_CONFIG_TYPE_DOMAIN_SOUND_MODEL,
75 model,
76 NULL);
77 }
78