Commit 02e78c5d authored by Christian Kellner's avatar Christian Kellner
Browse files

JSON support for GbbSystemInfo

parent f865370d
......@@ -295,6 +295,61 @@ gbb_system_info_acquire ()
return info;
}
void
gbb_system_info_to_json (const GbbSystemInfo *info, JsonBuilder *builder)
{
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "hardware");
{
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "vendor");
json_builder_add_string_value(builder, info->sys_vendor);
json_builder_set_member_name(builder, "version");
json_builder_add_string_value(builder, info->product_version);
json_builder_set_member_name(builder, "name");
json_builder_add_string_value(builder, info->product_name);
json_builder_set_member_name(builder, "bios");
{
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "version");
json_builder_add_string_value(builder, info->bios_version);
json_builder_set_member_name(builder, "date");
json_builder_add_string_value(builder, info->bios_date);
json_builder_set_member_name(builder, "vendor");
json_builder_add_string_value(builder, info->bios_vendor);
json_builder_end_object(builder);
}
json_builder_end_object(builder);
}
json_builder_set_member_name(builder, "software");
{
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "os");
{
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "type");
json_builder_add_string_value(builder, info->os_type);
json_builder_set_member_name(builder, "kernel");
json_builder_add_string_value(builder, info->os_kernel);
json_builder_end_object(builder);
}
json_builder_set_member_name(builder, "gnome");
{
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "version");
json_builder_add_string_value(builder, info->gnome_version);
json_builder_set_member_name(builder, "distributor");
json_builder_add_string_value(builder, info->gnome_distributor);
json_builder_set_member_name(builder, "date");
json_builder_add_string_value(builder, info->gnome_date);
json_builder_end_object(builder);
}
json_builder_end_object(builder);
}
json_builder_end_object(builder);
}
/* GNOME system info */
/* Everything below has been mostly borrowed from
* gnome-control-center/panels/info/cc-info-panel.c
......
......@@ -2,10 +2,14 @@
#define __SYSTEM_INFO_H__
#include <glib-object.h>
#include <json-glib/json-glib.h>
#define GBB_TYPE_SYSTEM_INFO gbb_system_info_get_type()
G_DECLARE_FINAL_TYPE(GbbSystemInfo, gbb_system_info, GBB, SYSTEM_INFO, GObject)
GbbSystemInfo *gbb_system_info_acquire (void);
GbbSystemInfo *gbb_system_info_acquire (void);
void gbb_system_info_to_json (const GbbSystemInfo *info,
JsonBuilder *builder);
#endif /* __SYSTEM_INFO_H__ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment