[virt-tools-list] [PATCH libosinfo 1/2] Add support for product codenames

Daniel P. Berrange berrange at redhat.com
Wed Feb 22 11:45:35 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

---
 osinfo/osinfo_loader.c  |    1 +
 osinfo/osinfo_product.c |   26 ++++++++++++++++++++++++++
 osinfo/osinfo_product.h |    2 ++
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 6c55e29..cb3f19e 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -372,6 +372,7 @@ static void osinfo_loader_product(OsinfoLoader *loader,
         OSINFO_PRODUCT_PROP_SHORT_ID,
         OSINFO_PRODUCT_PROP_RELEASE_DATE,
         OSINFO_PRODUCT_PROP_EOL_DATE,
+        OSINFO_PRODUCT_PROP_CODENAME,
         NULL,
     };
 
diff --git a/osinfo/osinfo_product.c b/osinfo/osinfo_product.c
index 4978655..a67ad4a 100644
--- a/osinfo/osinfo_product.c
+++ b/osinfo/osinfo_product.c
@@ -73,6 +73,7 @@ enum {
     PROP_SHORT_ID,
     PROP_VENDOR,
     PROP_VERSION,
+    PROP_CODENAME,
 };
 
 static void osinfo_product_link_free(gpointer data, gpointer opaque G_GNUC_UNUSED)
@@ -124,6 +125,11 @@ osinfo_product_get_property (GObject    *object,
                             osinfo_product_get_version (product));
         break;
 
+    case PROP_CODENAME:
+        g_value_set_string (value,
+                            osinfo_product_get_codename (product));
+        break;
+
     default:
         /* We don't have any other property... */
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -201,6 +207,21 @@ osinfo_product_class_init (OsinfoProductClass *klass)
                                  G_PARAM_STATIC_NICK |
                                  G_PARAM_STATIC_BLURB);
     g_object_class_install_property (g_klass, PROP_VERSION, pspec);
+
+    /**
+     * OsinfoProduct::codename:
+     *
+     * The codename of this product.
+     */
+    pspec = g_param_spec_string ("codename",
+                                 "Codename",
+                                 "Codename",
+                                 NULL /* default value */,
+                                 G_PARAM_READABLE |
+                                 G_PARAM_STATIC_NAME |
+                                 G_PARAM_STATIC_NICK |
+                                 G_PARAM_STATIC_BLURB);
+    g_object_class_install_property (g_klass, PROP_NAME, pspec);
 }
 
 static void
@@ -283,6 +304,11 @@ const gchar *osinfo_product_get_name(OsinfoProduct *prod)
     return osinfo_entity_get_param_value(OSINFO_ENTITY(prod), OSINFO_PRODUCT_PROP_NAME);
 }
 
+const gchar *osinfo_product_get_codename(OsinfoProduct *prod)
+{
+    return osinfo_entity_get_param_value(OSINFO_ENTITY(prod), OSINFO_PRODUCT_PROP_CODENAME);
+}
+
 const gchar *osinfo_product_get_release_date_string(OsinfoProduct *prod)
 {
     return osinfo_entity_get_param_value(OSINFO_ENTITY(prod), OSINFO_PRODUCT_PROP_RELEASE_DATE);
diff --git a/osinfo/osinfo_product.h b/osinfo/osinfo_product.h
index 4db6df9..7bd4198 100644
--- a/osinfo/osinfo_product.h
+++ b/osinfo/osinfo_product.h
@@ -50,6 +50,7 @@ typedef struct _OsinfoProductPrivate OsinfoProductPrivate;
 #define OSINFO_PRODUCT_PROP_NAME         "name"
 #define OSINFO_PRODUCT_PROP_RELEASE_DATE "release-date"
 #define OSINFO_PRODUCT_PROP_EOL_DATE     "eol-date"
+#define OSINFO_PRODUCT_PROP_CODENAME     "codename"
 
 /* object */
 struct _OsinfoProduct
@@ -87,6 +88,7 @@ const gchar *osinfo_product_get_vendor(OsinfoProduct *prod);
 const gchar *osinfo_product_get_version(OsinfoProduct *prod);
 const gchar *osinfo_product_get_short_id(OsinfoProduct *prod);
 const gchar *osinfo_product_get_name(OsinfoProduct *prod);
+const gchar *osinfo_product_get_codename(OsinfoProduct *prod);
 
 const gchar *osinfo_product_get_release_date_string(OsinfoProduct *prod);
 const gchar *osinfo_product_get_eol_date_string(OsinfoProduct *prod);
-- 
1.7.7.6




More information about the virt-tools-list mailing list