[libosinfo PATCH 1/2] product: Add osinfo_product_get_short_id_list() API

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

 



As multiple short-ids is fully supported, let's add a new API for
getting the whole list instead.

https://gitlab.com/libosinfo/libosinfo/issues/19

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 osinfo/libosinfo.syms   |  2 ++
 osinfo/osinfo_product.c | 14 ++++++++++++++
 osinfo/osinfo_product.h |  1 +
 3 files changed, 17 insertions(+)

diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index db8b595..853acf5 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -577,6 +577,8 @@ LIBOSINFO_1.5.0 {
 	osinfo_install_config_get_installation_url;
 	osinfo_install_config_set_installation_url;
 
+	osinfo_product_get_short_id_list;
+
 	osinfo_tree_get_os;
 	osinfo_tree_get_os_variants;
 	osinfo_tree_set_os;
diff --git a/osinfo/osinfo_product.c b/osinfo/osinfo_product.c
index 740785e..a598312 100644
--- a/osinfo/osinfo_product.c
+++ b/osinfo/osinfo_product.c
@@ -437,3 +437,17 @@ void osinfo_product_foreach_related(OsinfoProduct *product,
     }
     g_object_unref(related_list);
 }
+
+/**
+ * osinfo_product_get_short_id_list:
+ * @prod: an #OsinfoProduct
+ *
+ * Retrieve all the short-ids associated with the product.
+ *
+ * Returns: (transfer container) (element-type utf8): the list of short-ids.
+ */
+GList *osinfo_product_get_short_id_list(OsinfoProduct *prod)
+{
+    return osinfo_entity_get_param_value_list(OSINFO_ENTITY(prod),
+                                              OSINFO_PRODUCT_PROP_SHORT_ID);
+}
diff --git a/osinfo/osinfo_product.h b/osinfo/osinfo_product.h
index 611dc6e..48de3d4 100644
--- a/osinfo/osinfo_product.h
+++ b/osinfo/osinfo_product.h
@@ -98,5 +98,6 @@ GDate *osinfo_product_get_release_date(OsinfoProduct *prod);
 GDate *osinfo_product_get_eol_date(OsinfoProduct *prod);
 const gchar *osinfo_product_get_logo(OsinfoProduct *prod);
 
+GList *osinfo_product_get_short_id_list(OsinfoProduct *prod);
 
 #endif /* __OSINFO_PRODUCT_H__ */
-- 
2.21.0

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




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

  Powered by Linux