Add fwupd_trust_flag_to_string()

This commit is contained in:
Richard Hughes 2016-03-17 09:43:04 +00:00
parent da887df142
commit c1e3ded9a3
2 changed files with 36 additions and 0 deletions

View File

@ -118,3 +118,37 @@ fwupd_device_flag_from_string (const gchar *device_flag)
return FU_DEVICE_FLAG_LOCKED; return FU_DEVICE_FLAG_LOCKED;
return FU_DEVICE_FLAG_LAST; return FU_DEVICE_FLAG_LAST;
} }
/**
* fwupd_trust_flag_to_string:
*
* Since: 0.7.0
**/
const gchar *
fwupd_trust_flag_to_string (FwupdTrustFlags trust_flag)
{
if (trust_flag == FWUPD_TRUST_FLAG_NONE)
return "none";
if (trust_flag == FWUPD_TRUST_FLAG_PAYLOAD)
return "payload";
if (trust_flag == FWUPD_TRUST_FLAG_METADATA)
return "metadata";
return NULL;
}
/**
* fwupd_trust_flag_from_string:
*
* Since: 0.7.0
**/
FwupdTrustFlags
fwupd_trust_flag_from_string (const gchar *trust_flag)
{
if (g_strcmp0 (trust_flag, "none") == 0)
return FWUPD_TRUST_FLAG_NONE;
if (g_strcmp0 (trust_flag, "payload") == 0)
return FWUPD_TRUST_FLAG_PAYLOAD;
if (g_strcmp0 (trust_flag, "metadata") == 0)
return FWUPD_TRUST_FLAG_METADATA;
return FWUPD_TRUST_FLAG_LAST;
}

View File

@ -83,5 +83,7 @@ const gchar *fwupd_status_to_string (FwupdStatus status);
FwupdStatus fwupd_status_from_string (const gchar *status); FwupdStatus fwupd_status_from_string (const gchar *status);
const gchar *fwupd_device_flag_to_string (FwupdDeviceFlags device_flag); const gchar *fwupd_device_flag_to_string (FwupdDeviceFlags device_flag);
FwupdDeviceFlags fwupd_device_flag_from_string (const gchar *device_flag); FwupdDeviceFlags fwupd_device_flag_from_string (const gchar *device_flag);
const gchar *fwupd_trust_flag_to_string (FwupdTrustFlags trust_flag);
FwupdTrustFlags fwupd_trust_flag_from_string (const gchar *trust_flag);
#endif /* __FWUPD_ENUMS_H */ #endif /* __FWUPD_ENUMS_H */