Add an 'Summary' property to each device

This was already exported in the libfwupd API, but it had no way of being set
from devices or passed from daemon to client.
This commit is contained in:
Richard Hughes 2017-09-09 21:35:15 +01:00
parent 48ad97fd61
commit 6c6e8d3ab8
3 changed files with 12 additions and 0 deletions

View File

@ -788,6 +788,11 @@ fwupd_device_to_variant_builder (FwupdDevice *device, GVariantBuilder *builder)
FWUPD_RESULT_KEY_DEVICE_DESCRIPTION,
g_variant_new_string (priv->description));
}
if (priv->summary != NULL) {
g_variant_builder_add (builder, "{sv}",
FWUPD_RESULT_KEY_DEVICE_SUMMARY,
g_variant_new_string (priv->summary));
}
if (priv->checksums->len > 0) {
g_autoptr(GString) str = g_string_new ("");
for (guint i = 0; i < priv->checksums->len; i++) {
@ -893,6 +898,10 @@ fwupd_device_from_key_value (FwupdDevice *device, const gchar *key, GVariant *va
fwupd_device_set_vendor_id (device, g_variant_get_string (value, NULL));
return;
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_DEVICE_SUMMARY) == 0) {
fwupd_device_set_summary (device, g_variant_get_string (value, NULL));
return;
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_DEVICE_DESCRIPTION) == 0) {
fwupd_device_set_description (device, g_variant_get_string (value, NULL));
return;
@ -1015,6 +1024,7 @@ fwupd_device_to_string (FwupdDevice *device)
const gchar *guid = g_ptr_array_index (priv->guids, i);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, guid);
}
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DEVICE_SUMMARY, priv->summary);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DEVICE_DESCRIPTION, priv->description);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DEVICE_PLUGIN, priv->provider);
fwupd_pad_kv_dfl (str, FWUPD_RESULT_KEY_DEVICE_FLAGS, priv->flags);

View File

@ -24,6 +24,7 @@
/* FIXME: change the keys to the new names when we bump major version */
#define FWUPD_RESULT_KEY_DEVICE_CREATED "Created" /* t */
#define FWUPD_RESULT_KEY_DEVICE_SUMMARY "Summary" /* s */
#define FWUPD_RESULT_KEY_DEVICE_DESCRIPTION "Description" /* s */
#define FWUPD_RESULT_KEY_DEVICE_FLAGS "Flags" /* t */
#define FWUPD_RESULT_KEY_DEVICE_CHECKSUM "FirmwareHash" /* s */

View File

@ -49,6 +49,7 @@ FuDevice *fu_device_new (void);
#define fu_device_set_id(d,v) fwupd_device_set_id(fwupd_result_get_device(FWUPD_RESULT(d)),v)
#define fu_device_set_modified(d,v) fwupd_device_set_modified(fwupd_result_get_device(FWUPD_RESULT(d)),v)
#define fu_device_set_plugin(d,v) fwupd_device_set_provider(fwupd_result_get_device(FWUPD_RESULT(d)),v)
#define fu_device_set_summary(d,v) fwupd_device_set_summary(fwupd_result_get_device(FWUPD_RESULT(d)),v)
#define fu_device_set_unique_id(d,v) fwupd_result_set_unique_id(FWUPD_RESULT(d),v)
#define fu_device_set_update_description(d,v) fwupd_release_set_description(fwupd_result_get_release(FWUPD_RESULT(d)),v)
#define fu_device_set_update_error(d,v) fwupd_result_set_update_error(FWUPD_RESULT(d),v)