[libvirt-glib 07/37] Implement gvir_config_clock_set_offset

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

 



---
 libvirt-gconfig/libvirt-gconfig-clock.c |   19 +++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-clock.h |    8 ++++++++
 libvirt-gconfig/libvirt-gconfig.sym     |    2 ++
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-clock.c b/libvirt-gconfig/libvirt-gconfig-clock.c
index 120d3a6..dc7932d 100644
--- a/libvirt-gconfig/libvirt-gconfig-clock.c
+++ b/libvirt-gconfig/libvirt-gconfig-clock.c
@@ -81,6 +81,25 @@ GVirConfigClock *gvir_config_clock_new_from_xml(const gchar *xml,
     return GVIR_CONFIG_CLOCK(object);
 }
 
+void gvir_config_clock_set_offset(GVirConfigClock *klock,
+                                  GVirConfigClockOffset offset)
+{
+    GEnumClass *enum_class;
+    GEnumValue *enum_value;
+    xmlNodePtr node;
+
+    node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(klock));
+    if (node == NULL)
+        return;
+    enum_class = g_type_class_ref(GVIR_TYPE_CONFIG_CLOCK_OFFSET);
+    enum_value = g_enum_get_value(enum_class, offset);
+    if (enum_value != NULL)
+        xmlNewProp(node, (xmlChar*)"offset", (xmlChar*)enum_value->value_nick);
+
+    g_type_class_unref(enum_class);
+
+}
+
 void gvir_config_clock_set_timezone(GVirConfigClock *klock,
                                     const char *tz)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-clock.h b/libvirt-gconfig/libvirt-gconfig-clock.h
index 26f4b53..49cacef 100644
--- a/libvirt-gconfig/libvirt-gconfig-clock.h
+++ b/libvirt-gconfig/libvirt-gconfig-clock.h
@@ -56,6 +56,12 @@ struct _GVirConfigClockClass
     gpointer padding[20];
 };
 
+typedef enum {
+    GVIR_CONFIG_CLOCK_UTC,
+    GVIR_CONFIG_CLOCK_LOCALTIME,
+    GVIR_CONFIG_CLOCK_TIMEZONE,
+    GVIR_CONFIG_CLOCK_VARIABLE
+} GVirConfigClockOffset;
 
 GType gvir_config_clock_get_type(void);
 
@@ -63,6 +69,8 @@ GVirConfigClock *gvir_config_clock_new(void);
 GVirConfigClock *gvir_config_clock_new_from_xml(const gchar *xml,
                                                 GError **error);
 
+void gvir_config_clock_set_offset(GVirConfigClock *klock,
+                                  GVirConfigClockOffset offset);
 void gvir_config_clock_set_timezone(GVirConfigClock *klock,
                                     const char *tz);
 void gvir_config_clock_set_variable_offset(GVirConfigClock *klock,
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 30cabf5..f6f1256 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -5,8 +5,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_capabilities_new_from_xml;
 
 	gvir_config_clock_get_type;
+	gvir_config_clock_offset_get_type;
 	gvir_config_clock_new;
 	gvir_config_clock_new_from_xml;
+	gvir_config_clock_set_offset;
 	gvir_config_clock_set_timezone;
 	gvir_config_clock_set_variable_offset;
 
-- 
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]