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

[libvirt] [libvirt-glib 1/3] API to get/set 'description' node in domain config



From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>

---
 libvirt-gconfig/libvirt-gconfig-domain.c |   28 ++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h |    2 ++
 libvirt-gconfig/libvirt-gconfig.sym      |    2 ++
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index fba1ee2..c4027a3 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -39,6 +39,7 @@ G_DEFINE_TYPE(GVirConfigDomain, gvir_config_domain, GVIR_CONFIG_TYPE_OBJECT);
 enum {
     PROP_0,
     PROP_NAME,
+    PROP_DESCRIPTION,
     PROP_MEMORY,
     PROP_VCPU,
     PROP_FEATURES
@@ -55,6 +56,9 @@ static void gvir_config_domain_get_property(GObject *object,
     case PROP_NAME:
         g_value_take_string(value, gvir_config_domain_get_name(domain));
         break;
+    case PROP_DESCRIPTION:
+        g_value_take_string(value, gvir_config_domain_get_description(domain));
+        break;
     case PROP_MEMORY:
         g_value_set_uint64(value, gvir_config_domain_get_memory(domain));
         break;
@@ -81,6 +85,9 @@ static void gvir_config_domain_set_property(GObject *object,
     case PROP_NAME:
         gvir_config_domain_set_name(domain, g_value_get_string(value));
         break;
+    case PROP_DESCRIPTION:
+        gvir_config_domain_set_description(domain, g_value_get_string(value));
+        break;
     case PROP_MEMORY:
         gvir_config_domain_set_memory(domain, g_value_get_uint64(value));
         break;
@@ -114,6 +121,14 @@ static void gvir_config_domain_class_init(GVirConfigDomainClass *klass)
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_STATIC_STRINGS));
     g_object_class_install_property(object_class,
+                                    PROP_DESCRIPTION,
+                                    g_param_spec_string("description",
+                                                        "Description",
+                                                        "Description (could be anything).",
+                                                        NULL,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_STATIC_STRINGS));
+    g_object_class_install_property(object_class,
                                     PROP_MEMORY,
                                     g_param_spec_uint64("memory",
                                                         "Memory",
@@ -196,6 +211,19 @@ void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
     g_object_notify(G_OBJECT(domain), "name");
 }
 
+char *gvir_config_domain_get_description(GVirConfigDomain *domain)
+{
+    return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
+                                               "description");
+}
+
+void gvir_config_domain_set_description(GVirConfigDomain *domain, const char *description)
+{
+    gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
+                                        "description", description);
+    g_object_notify(G_OBJECT(domain), "description");
+}
+
 /**
  * gvir_config_domain_get_memory:
  * @domain: A domain configuration object.
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index e68f1ac..6cdaec9 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -102,6 +102,8 @@ GVirConfigDomain *gvir_config_domain_new(void);
 void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomainVirtType type);
 char *gvir_config_domain_get_name(GVirConfigDomain *domain);
 void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name);
+char *gvir_config_domain_get_description(GVirConfigDomain *domain);
+void gvir_config_domain_set_description(GVirConfigDomain *domain, const char *description);
 guint64 gvir_config_domain_get_memory(GVirConfigDomain *domain);
 void gvir_config_domain_set_memory(GVirConfigDomain *domain, guint64 memory);
 guint64 gvir_config_domain_get_vcpus(GVirConfigDomain *domain);
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 9bfe1d9..383acca 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -23,6 +23,8 @@ LIBVIRT_GCONFIG_0.0.4 {
 	gvir_config_domain_set_memory;
 	gvir_config_domain_get_name;
 	gvir_config_domain_set_name;
+	gvir_config_domain_get_description;
+	gvir_config_domain_set_description;
 	gvir_config_domain_set_os;
 	gvir_config_domain_set_seclabel;
 	gvir_config_domain_get_vcpus;
-- 
1.7.7.5


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