[libvirt-glib 04/37] Add some GVirConfigClock setters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 libvirt-gconfig/libvirt-gconfig-clock.c  |   32 ++++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-clock.h  |    5 ++++
 libvirt-gconfig/libvirt-gconfig-domain.c |    1 +
 libvirt-gconfig/libvirt-gconfig-domain.h |    1 -
 libvirt-gconfig/libvirt-gconfig.sym      |    2 +
 5 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-clock.c b/libvirt-gconfig/libvirt-gconfig-clock.c
index d2650ad..120d3a6 100644
--- a/libvirt-gconfig/libvirt-gconfig-clock.c
+++ b/libvirt-gconfig/libvirt-gconfig-clock.c
@@ -80,3 +80,35 @@ 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;
+
+    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;
+
+    node = gvir_config_object_new_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);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-clock.h b/libvirt-gconfig/libvirt-gconfig-clock.h
index fc8850a..26f4b53 100644
--- a/libvirt-gconfig/libvirt-gconfig-clock.h
+++ b/libvirt-gconfig/libvirt-gconfig-clock.h
@@ -63,6 +63,11 @@ GVirConfigClock *gvir_config_clock_new(void);
 GVirConfigClock *gvir_config_clock_new_from_xml(const gchar *xml,
                                                 GError **error);
 
+void gvir_config_clock_set_timezone(GVirConfigClock *klock,
+                                    const char *tz);
+void gvir_config_clock_set_variable_offset(GVirConfigClock *klock,
+                                           gint seconds);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_CLOCK_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index c847c14..f80720a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -236,3 +236,4 @@ void gvir_config_domain_set_features(GVirConfigDomain *domain,
     }
     g_object_notify(G_OBJECT(domain), "features");
 }
+
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index d9f0c09..6cc8f31 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -70,7 +70,6 @@ GStrv gvir_config_domain_get_features(GVirConfigDomain *domain);
 void gvir_config_domain_set_features(GVirConfigDomain *domain,
                                      const GStrv features);
 
-
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_DOMAIN_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index c76faab..19e926c 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -7,6 +7,8 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_clock_get_type;
 	gvir_config_clock_new;
 	gvir_config_clock_new_from_xml;
+	gvir_config_clock_set_timezone;
+	gvir_config_clock_set_variable_offset;
 
 	gvir_config_domain_get_type;
 	gvir_config_domain_new;
-- 
1.7.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]