extension-tool: Show "version-name" field if set

Now that both the website and the Extension app support the custom
"version-name" field, we should expose it in the CLI tool as well.

As a more developer-oriented tool, keep showing the automatic
version along-side the new field when both are set.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3034>
This commit is contained in:
Florian Müllner 2023-11-30 14:18:36 +01:00
parent 6db55eaea6
commit ca47e7f8e3

View File

@ -229,8 +229,9 @@ void
print_extension_info (GVariantDict *info,
DisplayFormat format)
{
const char *uuid, *name, *desc, *path, *url, *author;
const char *uuid, *name, *desc, *path, *url, *author, *version_name;
double state, version;
gboolean has_version, has_version_name;
g_variant_dict_lookup (info, "uuid", "&s", &uuid);
g_print ("%s\n", uuid);
@ -253,7 +254,14 @@ print_extension_info (GVariantDict *info,
if (g_variant_dict_lookup (info, "original-author", "&s", &author))
g_print (" %s: %s\n", _("Original author"), author);
if (g_variant_dict_lookup (info, "version", "d", &version))
has_version = g_variant_dict_lookup (info, "version", "d", &version);
has_version_name = g_variant_dict_lookup (info, "version-name", "&s", &version_name);
if (has_version_name && has_version)
g_print (" %s: %s (%.0f)\n", _("Version"), version_name, version);
else if (has_version_name)
g_print (" %s: %s\n", _("Version"), version_name);
else if (has_version)
g_print (" %s: %.0f\n", _("Version"), version);
g_variant_dict_lookup (info, "state", "d", &state);