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

[libvirt] [libvirt-glib] API to get/set domain title



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

---
 libvirt-gconfig/libvirt-gconfig-domain.c |   33 ++++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h |    2 ++
 libvirt-gconfig/libvirt-gconfig.sym      |    2 ++
 3 files changed, 37 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 7477400..d5a676a 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_TITLE,
     PROP_DESCRIPTION,
     PROP_MEMORY,
     PROP_VCPU,
@@ -56,6 +57,9 @@ static void gvir_config_domain_get_property(GObject *object,
     case PROP_NAME:
         g_value_set_string(value, gvir_config_domain_get_name(domain));
         break;
+    case PROP_TITLE:
+        g_value_set_string(value, gvir_config_domain_get_title(domain));
+        break;
     case PROP_DESCRIPTION:
         g_value_set_string(value, gvir_config_domain_get_description(domain));
         break;
@@ -85,6 +89,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_TITLE:
+        gvir_config_domain_set_title(domain, g_value_get_string(value));
+        break;
     case PROP_DESCRIPTION:
         gvir_config_domain_set_description(domain, g_value_get_string(value));
         break;
@@ -121,6 +128,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_TITLE,
+                                    g_param_spec_string("title",
+                                                        "Title",
+                                                        "A short description - title - of the domain",
+                                                        NULL,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_STATIC_STRINGS));
+    g_object_class_install_property(object_class,
                                     PROP_DESCRIPTION,
                                     g_param_spec_string("description",
                                                         "Description",
@@ -216,6 +231,12 @@ const char *gvir_config_domain_get_name(GVirConfigDomain *domain)
                                                "name");
 }
 
+const char *gvir_config_domain_get_title(GVirConfigDomain *domain)
+{
+    return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
+                                               "title");
+}
+
 /**
  * gvir_config_domain_set_name:
  * @domain: a #GVirConfigDomain
@@ -228,6 +249,18 @@ void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
     g_object_notify(G_OBJECT(domain), "name");
 }
 
+/**
+ * gvir_config_domain_set_title:
+ * @domain: a #GVirConfigDomain
+ * @title: (allow-none):
+ */
+void gvir_config_domain_set_title(GVirConfigDomain *domain, const char *title)
+{
+    gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
+                                        "title", title);
+    g_object_notify(G_OBJECT(domain), "title");
+}
+
 const char *gvir_config_domain_get_description(GVirConfigDomain *domain)
 {
     return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 5deb58e..af8b86a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -120,6 +120,8 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain,
                                GVirConfigDomainOs *os);
 void gvir_config_domain_set_seclabel(GVirConfigDomain *domain,
                                      GVirConfigDomainSeclabel *seclabel);
+const char *gvir_config_domain_get_title(GVirConfigDomain *domain);
+void gvir_config_domain_set_title(GVirConfigDomain *domain, const char *title);
 void gvir_config_domain_set_devices(GVirConfigDomain *domain,
                                     GList *devices);
 void gvir_config_domain_add_device(GVirConfigDomain *domain,
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 10057a8..761a96b 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -377,6 +377,8 @@ LIBVIRT_GCONFIG_0.0.8 {
 LIBVIRT_GCONFIG_0.0.9 {
   global:
 	gvir_config_domain_get_os;
+	gvir_config_domain_get_title;
+	gvir_config_domain_set_title;
 	gvir_config_domain_get_virt_type;
 
 	gvir_config_domain_os_get_arch;
-- 
1.7.10.2


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