Re: [libvirt] [gconfig v2 2/4] Introduce libvirt-gconfig-domain-graphics-listen-address

2016-08-03 Thread Christophe Fergeau
On Mon, Aug 01, 2016 at 11:52:38PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> This is needed to be able to change the address a graphics
> device is listening on.
> ---
>  libvirt-gconfig/Makefile.am|  2 +
>  ...ibvirt-gconfig-domain-graphics-listen-address.c | 79 
> ++
>  ...ibvirt-gconfig-domain-graphics-listen-address.h | 67 ++
>  libvirt-gconfig/libvirt-gconfig.h  |  1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  3 +
>  5 files changed, 152 insertions(+)
>  create mode 100644 
> libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
>  create mode 100644 
> libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 27c6df1..6be860b 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -46,6 +46,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-filesys.h \
>   libvirt-gconfig-domain-graphics.h \
>   libvirt-gconfig-domain-graphics-listen.h\
> + libvirt-gconfig-domain-graphics-listen-address.h\
>   libvirt-gconfig-domain-graphics-desktop.h \
>   libvirt-gconfig-domain-graphics-rdp.h \
>   libvirt-gconfig-domain-graphics-sdl.h \
> @@ -140,6 +141,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-filesys.c \
>   libvirt-gconfig-domain-graphics.c \
>   libvirt-gconfig-domain-graphics-listen.c\
> + libvirt-gconfig-domain-graphics-listen-address.c\
>   libvirt-gconfig-domain-graphics-desktop.c \
>   libvirt-gconfig-domain-graphics-rdp.c \
>   libvirt-gconfig-domain-graphics-sdl.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> new file mode 100644
> index 000..460ca23
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> @@ -0,0 +1,79 @@
> +/*
> + * libvirt-gconfig-domain-graphics-listen-address.c: libvirt domain graphics 
> listen address configuration
> + *
> + * Copyright (C) 2016 Red Hat, Inc.

Same comment about the copyright, this should contain your name.

> + *
> + * 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, see
> + * .
> + *
> + * Author: Visarion Alexandru 
> + */
> +
> +#include 
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(obj)  
>\
> +(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
> GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
> GVirConfigDomainGraphicsListenAddressPrivate))
> +
> +struct _GVirConfigDomainGraphicsListenAddressPrivate
> +{
> +gboolean unused;
> +};
> +
> +G_DEFINE_TYPE(GVirConfigDomainGraphicsListenAddress, 
> gvir_config_domain_graphics_listen_address, 
> GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN);
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_address_class_init(GVirConfigDomainGraphicsListenAddressClass
>  *klass)
> +{
> +g_type_class_add_private(klass, 
> sizeof(GVirConfigDomainGraphicsListenAddressPrivate));
> +}
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_address_init(GVirConfigDomainGraphicsListenAddress
>  *address)
> +{
> +address->priv = 
> GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(address);
> +}
> +
> +
> +GVirConfigDomainGraphicsListenAddress 
> *gvir_config_domain_graphics_listen_address_new(const char *address)
> +{
> +GVirConfigObject *object;
> +
> +object = 
> gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
> "listen", NULL);
> +gvir_config_object_set_attribute(object,
> + "type", "address",
> + NULL);
> +gvir_config_object_set_attribute(object,
> + "address", address,
> + NULL);
> +
> +return 

[libvirt] [gconfig v2 2/4] Introduce libvirt-gconfig-domain-graphics-listen-address

2016-08-01 Thread Visarion Alexandru
From: Visarion Alexandru 

This is needed to be able to change the address a graphics
device is listening on.
---
 libvirt-gconfig/Makefile.am|  2 +
 ...ibvirt-gconfig-domain-graphics-listen-address.c | 79 ++
 ...ibvirt-gconfig-domain-graphics-listen-address.h | 67 ++
 libvirt-gconfig/libvirt-gconfig.h  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym|  3 +
 5 files changed, 152 insertions(+)
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 27c6df1..6be860b 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -46,6 +46,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-filesys.h \
libvirt-gconfig-domain-graphics.h \
libvirt-gconfig-domain-graphics-listen.h\
+   libvirt-gconfig-domain-graphics-listen-address.h\
libvirt-gconfig-domain-graphics-desktop.h \
libvirt-gconfig-domain-graphics-rdp.h \
libvirt-gconfig-domain-graphics-sdl.h \
@@ -140,6 +141,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-filesys.c \
libvirt-gconfig-domain-graphics.c \
libvirt-gconfig-domain-graphics-listen.c\
+   libvirt-gconfig-domain-graphics-listen-address.c\
libvirt-gconfig-domain-graphics-desktop.c \
libvirt-gconfig-domain-graphics-rdp.c \
libvirt-gconfig-domain-graphics-sdl.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
new file mode 100644
index 000..460ca23
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
@@ -0,0 +1,79 @@
+/*
+ * libvirt-gconfig-domain-graphics-listen-address.c: libvirt domain graphics 
listen address configuration
+ *
+ * Copyright (C) 2016 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, see
+ * .
+ *
+ * Author: Visarion Alexandru 
+ */
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(obj)
 \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
GVirConfigDomainGraphicsListenAddressPrivate))
+
+struct _GVirConfigDomainGraphicsListenAddressPrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainGraphicsListenAddress, 
gvir_config_domain_graphics_listen_address, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN);
+
+
+static void 
gvir_config_domain_graphics_listen_address_class_init(GVirConfigDomainGraphicsListenAddressClass
 *klass)
+{
+g_type_class_add_private(klass, 
sizeof(GVirConfigDomainGraphicsListenAddressPrivate));
+}
+
+
+static void 
gvir_config_domain_graphics_listen_address_init(GVirConfigDomainGraphicsListenAddress
 *address)
+{
+address->priv = 
GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(address);
+}
+
+
+GVirConfigDomainGraphicsListenAddress 
*gvir_config_domain_graphics_listen_address_new(const char *address)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
"listen", NULL);
+gvir_config_object_set_attribute(object,
+ "type", "address",
+ NULL);
+gvir_config_object_set_attribute(object,
+ "address", address,
+ NULL);
+
+return GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS(object);
+}
+
+
+GVirConfigDomainGraphicsListenAddress 
*gvir_config_domain_graphics_listen_address_new_from_xml(const gchar *xml,
+   
GError **error)
+{
+GVirConfigObject *object;
+
+object =