mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-05 19:48:47 +00:00
trivial: Also show device title for 'install' command in fwupdmgr
Commit 171ec0d
added support for 'update' and 'downgrade' operations
in fwupdmgr. Since users can also install CAB files manually
show the titles for those too.
This commit is contained in:
parent
e10cb70395
commit
f78f66d479
@ -38,6 +38,7 @@ typedef enum {
|
||||
FU_UTIL_OPERATION_UNKNOWN,
|
||||
FU_UTIL_OPERATION_UPDATE,
|
||||
FU_UTIL_OPERATION_DOWNGRADE,
|
||||
FU_UTIL_OPERATION_INSTALL,
|
||||
FU_UTIL_OPERATION_LAST
|
||||
} FuUtilOperation;
|
||||
|
||||
@ -192,6 +193,45 @@ fu_util_client_notify_cb (GObject *object,
|
||||
fwupd_client_get_percentage (priv->client));
|
||||
}
|
||||
|
||||
static void
|
||||
fu_util_update_device_changed_cb (FwupdClient *client,
|
||||
FwupdDevice *device,
|
||||
FuUtilPrivate *priv)
|
||||
{
|
||||
g_autofree gchar *str = NULL;
|
||||
|
||||
/* same as last time, so ignore */
|
||||
if (priv->current_device != NULL &&
|
||||
fwupd_device_compare (priv->current_device, device) == 0)
|
||||
return;
|
||||
|
||||
/* show message in progressbar */
|
||||
if (priv->current_operation == FU_UTIL_OPERATION_UPDATE) {
|
||||
/* TRANSLATORS: %1 is a device name, and %2 and %3 are version numbers */
|
||||
str = g_strdup_printf (_("Updating %s from %s to %s…"),
|
||||
fwupd_device_get_name (device),
|
||||
fwupd_device_get_version (device),
|
||||
fwupd_release_get_version (priv->current_release));
|
||||
fu_progressbar_set_title (priv->progressbar, str);
|
||||
} else if (priv->current_operation == FU_UTIL_OPERATION_DOWNGRADE) {
|
||||
/* TRANSLATORS: %1 is a device name, and %2 and %3 are version numbers */
|
||||
str = g_strdup_printf (_("Downgrading %s from %s to %s…"),
|
||||
fwupd_device_get_name (device),
|
||||
fwupd_device_get_version (device),
|
||||
fwupd_release_get_version (priv->current_release));
|
||||
fu_progressbar_set_title (priv->progressbar, str);
|
||||
} else if (priv->current_operation == FU_UTIL_OPERATION_INSTALL) {
|
||||
/* TRANSLATORS: %1 is a version number, and %2 is a device name */
|
||||
str = g_strdup_printf (_("Installing %s on %s…"),
|
||||
fwupd_release_get_version (priv->current_release),
|
||||
fwupd_device_get_name (device));
|
||||
fu_progressbar_set_title (priv->progressbar, str);
|
||||
} else {
|
||||
g_warning ("no FuUtilOperation set");
|
||||
}
|
||||
g_set_object (&priv->current_device, device);
|
||||
}
|
||||
|
||||
static FwupdDevice *
|
||||
fu_util_prompt_for_device (FuUtilPrivate *priv, GError **error)
|
||||
{
|
||||
@ -544,6 +584,10 @@ fu_util_install (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->current_operation = FU_UTIL_OPERATION_INSTALL;
|
||||
g_signal_connect (priv->client, "device-changed",
|
||||
G_CALLBACK (fu_util_update_device_changed_cb), priv);
|
||||
|
||||
/* install with flags chosen by the user */
|
||||
return fwupd_client_install (priv->client, id, values[0], priv->flags, NULL, error);
|
||||
}
|
||||
@ -1966,39 +2010,6 @@ fu_util_update_device_with_release (FuUtilPrivate *priv,
|
||||
priv->flags, NULL, error);
|
||||
}
|
||||
|
||||
static void
|
||||
fu_util_update_device_changed_cb (FwupdClient *client,
|
||||
FwupdDevice *device,
|
||||
FuUtilPrivate *priv)
|
||||
{
|
||||
g_autofree gchar *str = NULL;
|
||||
|
||||
/* same as last time, so ignore */
|
||||
if (priv->current_device != NULL &&
|
||||
fwupd_device_compare (priv->current_device, device) == 0)
|
||||
return;
|
||||
|
||||
/* show message in progressbar */
|
||||
if (priv->current_operation == FU_UTIL_OPERATION_UPDATE) {
|
||||
/* TRANSLATORS: %1 is a device name, and %2 is a version number */
|
||||
str = g_strdup_printf (_("Updating %s from %s to %s…"),
|
||||
fwupd_device_get_name (device),
|
||||
fwupd_device_get_version (device),
|
||||
fwupd_release_get_version (priv->current_release));
|
||||
fu_progressbar_set_title (priv->progressbar, str);
|
||||
} else if (priv->current_operation == FU_UTIL_OPERATION_DOWNGRADE) {
|
||||
/* TRANSLATORS: %1 is a device name, and %2 is a version number */
|
||||
str = g_strdup_printf (_("Downgrading %s from %s to %s…"),
|
||||
fwupd_device_get_name (device),
|
||||
fwupd_device_get_version (device),
|
||||
fwupd_release_get_version (priv->current_release));
|
||||
fu_progressbar_set_title (priv->progressbar, str);
|
||||
} else {
|
||||
g_warning ("no FuUtilOperation set");
|
||||
}
|
||||
g_set_object (&priv->current_device, device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_util_update (FuUtilPrivate *priv, gchar **values, GError **error)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user