[Libosinfo] [libosinfo PATCH 1/3] osinfo-query: Add osinfo_os_list_func to OsinfoLabel
Fabiano Fidêncio
fidencio at redhat.com
Mon Apr 15 07:58:20 UTC 2019
Let's add a new osinfo_os_list_func to OsinfoLabel. This function
represents any osinfo_os_get.*_list() and can be used to get Os specific
attributes list.
One example of usage for this is osinfo_os_get_variant_list() and then
be able to also display the os variants when querying for an Os.
https://gitlab.com/libosinfo/libosinfo/issues/24
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
tools/osinfo-query.c | 64 +++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 31 deletions(-)
diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
index 00f838b..045f3c1 100644
--- a/tools/osinfo-query.c
+++ b/tools/osinfo-query.c
@@ -32,12 +32,14 @@
#include <osinfo/osinfo.h>
+typedef OsinfoList * (*osinfo_os_list_func)(OsinfoOs *os);
struct OsinfoLabel {
const gchar *prop;
const gchar *label;
gboolean enabled;
gsize width;
+ osinfo_os_list_func listOsFunc;
};
typedef OsinfoList * (*osinfo_list_func)(OsinfoDb *db);
@@ -53,72 +55,72 @@ struct OsinfoType {
static struct OsinfoLabel os_labels[] = {
{ OSINFO_PRODUCT_PROP_SHORT_ID,
- N_("Short ID"), TRUE, 20 },
+ N_("Short ID"), TRUE, 20, NULL },
{ OSINFO_PRODUCT_PROP_NAME,
- N_("Name"), TRUE, 50 },
+ N_("Name"), TRUE, 50, NULL },
{ OSINFO_PRODUCT_PROP_VERSION,
- N_("Version"), TRUE, 8 },
+ N_("Version"), TRUE, 8, NULL },
{ OSINFO_OS_PROP_FAMILY,
- N_("Family"), FALSE, 12 },
+ N_("Family"), FALSE, 12, NULL },
{ OSINFO_OS_PROP_DISTRO,
- N_("Distro"), FALSE, 12 },
+ N_("Distro"), FALSE, 12, NULL },
{ OSINFO_PRODUCT_PROP_VENDOR,
- N_("Vendor"), FALSE, 25 },
+ N_("Vendor"), FALSE, 25, NULL },
{ OSINFO_PRODUCT_PROP_RELEASE_DATE,
- N_("Release date"), FALSE, 12 },
+ N_("Release date"), FALSE, 12, NULL },
{ OSINFO_PRODUCT_PROP_EOL_DATE,
- N_("End of life"), FALSE, 12 },
+ N_("End of life"), FALSE, 12, NULL },
{ OSINFO_PRODUCT_PROP_CODENAME,
- N_("Code name"), FALSE, 10 },
+ N_("Code name"), FALSE, 10, NULL },
{ OSINFO_ENTITY_PROP_ID,
- N_("ID"), TRUE, 40 },
- { NULL, NULL, 0, 0},
+ N_("ID"), TRUE, 40, NULL },
+ { NULL, NULL, 0, 0, NULL}
};
static struct OsinfoLabel platform_labels[] = {
{ OSINFO_PRODUCT_PROP_SHORT_ID,
- N_("Short ID"), TRUE, 20 },
+ N_("Short ID"), TRUE, 20, NULL },
{ OSINFO_PRODUCT_PROP_NAME,
- N_("Name"), TRUE, 50 },
+ N_("Name"), TRUE, 50, NULL },
{ OSINFO_PRODUCT_PROP_VERSION,
- N_("Version"), TRUE, 8 },
+ N_("Version"), TRUE, 8, NULL },
{ OSINFO_PRODUCT_PROP_VENDOR,
- N_("Vendor"), TRUE, 25 },
+ N_("Vendor"), TRUE, 25, NULL },
{ OSINFO_PRODUCT_PROP_RELEASE_DATE,
- N_("Release date"), FALSE, 12 },
+ N_("Release date"), FALSE, 12, NULL },
{ OSINFO_PRODUCT_PROP_EOL_DATE,
- N_("End of life"), FALSE, 12 },
+ N_("End of life"), FALSE, 12, NULL },
{ OSINFO_PRODUCT_PROP_CODENAME,
- N_("Code name"), FALSE, 10 },
+ N_("Code name"), FALSE, 10, NULL },
{ OSINFO_ENTITY_PROP_ID,
- N_("ID"), TRUE, 40 },
- { NULL, NULL, 0, 0 },
+ N_("ID"), TRUE, 40, NULL },
+ { NULL, NULL, 0, 0, NULL },
};
static struct OsinfoLabel device_labels[] = {
{ OSINFO_DEVICE_PROP_VENDOR,
- N_("Vendor"), TRUE, 20 },
+ N_("Vendor"), TRUE, 20, NULL },
{ OSINFO_DEVICE_PROP_VENDOR_ID,
- N_("Vendor ID"), TRUE, 12 },
+ N_("Vendor ID"), TRUE, 12, NULL },
{ OSINFO_DEVICE_PROP_PRODUCT,
- N_("Product"), TRUE, 20 },
+ N_("Product"), TRUE, 20 ,NULL },
{ OSINFO_DEVICE_PROP_PRODUCT_ID,
- N_("Product ID"), TRUE, 12 },
+ N_("Product ID"), TRUE, 12, NULL },
{ OSINFO_PRODUCT_PROP_NAME,
- N_("Name"), TRUE, 14 },
+ N_("Name"), TRUE, 14, NULL },
{ OSINFO_DEVICE_PROP_CLASS,
- N_("Class"), TRUE, 15 },
+ N_("Class"), TRUE, 15, NULL },
{ OSINFO_DEVICE_PROP_BUS_TYPE,
- N_("Bus"), TRUE, 8 },
+ N_("Bus"), TRUE, 8, NULL },
{ OSINFO_ENTITY_PROP_ID,
- N_("ID"), TRUE, 40 },
- { NULL, NULL, 0, 0 },
+ N_("ID"), TRUE, 40, NULL },
+ { NULL, NULL, 0, 0, NULL },
};
static struct OsinfoLabel deployment_labels[] = {
{ OSINFO_ENTITY_PROP_ID,
- N_("ID"), TRUE, 40 },
- { NULL, NULL, 0, 0 },
+ N_("ID"), TRUE, 40, NULL },
+ { NULL, NULL, 0, 0, NULL },
};
--
2.20.1
More information about the Libosinfo
mailing list