On Thu, Jan 12, 2012 at 08:21:48PM +0100, Christophe Fergeau wrote:
On Thu, Jan 12, 2012 at 07:07:22PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>
> ---
> libvirt-gconfig/libvirt-gconfig-domain-channel.c | 23 ++++++++++++++++++++++
> libvirt-gconfig/libvirt-gconfig-domain-channel.h | 11 ++++++++++
> libvirt-gconfig/libvirt-gconfig-domain-console.c | 12 +++++++++++
> libvirt-gconfig/libvirt-gconfig-domain-console.h | 12 +++++++++++
> libvirt-gconfig/libvirt-gconfig-object-private.h | 5 ++++
> libvirt-gconfig/libvirt-gconfig-object.c | 15 ++++++++++++++
> libvirt-gconfig/libvirt-gconfig.sym | 5 ++++
> 7 files changed, 83 insertions(+), 0 deletions(-)
>
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-channel.c
b/libvirt-gconfig/libvirt-gconfig-domain-channel.c
> index 02f8fe7..a4f9527 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-channel.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-channel.c
> @@ -23,6 +23,7 @@
> #include <config.h>
>
> #include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
>
> #define GVIR_CONFIG_DOMAIN_CHANNEL_GET_PRIVATE(obj) \
> (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_CHANNEL,
GVirConfigDomainChannelPrivate))
> @@ -68,3 +69,25 @@ GVirConfigDomainChannel
*gvir_config_domain_channel_new_from_xml(const gchar *xm
> return NULL;
> return GVIR_CONFIG_DOMAIN_CHANNEL(object);
> }
> +
> +
> +void gvir_config_domain_channel_set_target_type(GVirConfigDomainChannel *channel,
> + GVirConfigDomainChannelTargetType
type)
> +{
> + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_CHANNEL(channel));
> +
> + gvir_config_object_add_child_with_attribute_enum(GVIR_CONFIG_OBJECT(channel),
> + "target",
"type",
> +
GVIR_CONFIG_TYPE_DOMAIN_CHANNEL_TARGET_TYPE,
> + type);
> +}
> +
> +
> +void gvir_config_domain_channel_set_target_name(GVirConfigDomainChannel *channel,
> + const gchar *name)
> +{
> + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_CHANNEL(channel));
> +
> + gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(channel),
> + "target",
"name", name);
> +}
_set_target_type and _set_target_name create a different <target> node when
they are called, this is probably not what we want.
And I take that back, _add_child is actually returning the existing node
when the child already exists. ACK to the patch.
Christophe