[libvirt] [libvirt-gconfig PATCHv2 07/32] Add some GVirConfigClock setters
Daniel P. Berrange
berrange at redhat.com
Tue Nov 22 12:54:37 UTC 2011
On Mon, Nov 21, 2011 at 07:04:04PM +0100, Christophe Fergeau wrote:
> --
> v2: use g_return_if_fail to test function args for sanity
> ---
> libvirt-gconfig/libvirt-gconfig-clock.c | 38 +++++++++++++++++++++++++++++++
> libvirt-gconfig/libvirt-gconfig-clock.h | 5 ++++
> libvirt-gconfig/libvirt-gconfig.sym | 2 +
> 3 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/libvirt-gconfig/libvirt-gconfig-clock.c b/libvirt-gconfig/libvirt-gconfig-clock.c
> index 1f28efb..25f6159 100644
> --- a/libvirt-gconfig/libvirt-gconfig-clock.c
> +++ b/libvirt-gconfig/libvirt-gconfig-clock.c
> @@ -27,6 +27,7 @@
> #include <libxml/tree.h>
>
> #include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
>
> extern gboolean debugFlag;
>
> @@ -79,3 +80,40 @@ GVirConfigClock *gvir_config_clock_new_from_xml(const gchar *xml,
> "clock", NULL, xml, error);
> return GVIR_CONFIG_CLOCK(object);
> }
> +
> +void gvir_config_clock_set_timezone(GVirConfigClock *klock,
> + const char *tz)
> +{
> + xmlNodePtr node;
> + xmlChar *encoded_tz;
> +
> + g_return_if_fail(GVIR_IS_CONFIG_CLOCK(klock));
> + g_return_if_fail(tz != NULL);
> +
> + node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(klock));
> + if (node == NULL)
> + return;
> +
> + xmlNewProp(node, (xmlChar*)"offset", (xmlChar*)"timezone");
> + encoded_tz = xmlEncodeEntitiesReentrant(node->doc, (xmlChar*)tz);
> + xmlNewProp(node, (xmlChar*)"timezone", encoded_tz);
> + xmlFree(encoded_tz);
> +}
> +
> +void gvir_config_clock_set_variable_offset(GVirConfigClock *klock,
> + gint seconds)
> +{
> + xmlNodePtr node;
> + char *offset_str;
> +
> + g_return_if_fail(GVIR_IS_CONFIG_CLOCK(klock));
> +
> + node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(klock), "clock");
> + if (node == NULL)
> + return;
> +
> + xmlNewProp(node, (xmlChar*)"offset", (xmlChar*)"variable");
> + offset_str = g_strdup_printf("%d", seconds);
> + xmlNewProp(node, (xmlChar*)"timezone", (xmlChar*)offset_str);
> + g_free(offset_str);
Copy+paste buglet - s/timezone/adjustment/
ACK with that fix commit.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list