[gnome-software] Add a more detailed error message when AC power is required
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a more detailed error message when AC power is required
- Date: Tue, 20 Dec 2016 11:49:06 +0000 (UTC)
commit 4b1f50c2cee422c2f12c3ca84004082329490106
Author: Richard Hughes <richard hughsie com>
Date: Tue Dec 20 11:35:50 2016 +0000
Add a more detailed error message when AC power is required
src/gs-plugin-types.h | 2 ++
src/gs-shell.c | 32 ++++++++++++++++++++++++++++++++
src/plugins/gs-plugin-fwupd.c | 5 +++++
3 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-types.h b/src/gs-plugin-types.h
index 273345d..6293610 100644
--- a/src/gs-plugin-types.h
+++ b/src/gs-plugin-types.h
@@ -90,6 +90,7 @@ typedef guint64 GsPluginFlags;
* @GS_PLUGIN_ERROR_INVALID_FORMAT: The data format is invalid
* @GS_PLUGIN_ERROR_DELETE_FAILED: The delete action failed
* @GS_PLUGIN_ERROR_RESTART_REQUIRED: A restart is required
+ * @GS_PLUGIN_ERROR_AC_POWER_REQUIRED: AC power is required
*
* The failure error types.
**/
@@ -111,6 +112,7 @@ typedef enum {
GS_PLUGIN_ERROR_INVALID_FORMAT,
GS_PLUGIN_ERROR_DELETE_FAILED,
GS_PLUGIN_ERROR_RESTART_REQUIRED,
+ GS_PLUGIN_ERROR_AC_POWER_REQUIRED,
/*< private >*/
GS_PLUGIN_ERROR_LAST
} GsPluginError;
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 9e8113e..39abb3d 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1033,6 +1033,13 @@ gs_shell_show_event_install (GsShell *shell, GsPluginEvent *event)
}
}
break;
+ case GS_PLUGIN_ERROR_AC_POWER_REQUIRED:
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "Dell XPS 13") */
+ g_string_append_printf (str, _("Unable to install %s: "
+ "AC power is required"),
+ str_app);
+ break;
default:
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
@@ -1126,6 +1133,13 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
"update software"),
str_app);
break;
+ case GS_PLUGIN_ERROR_AC_POWER_REQUIRED:
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "Dell XPS 13") */
+ g_string_append_printf (str, _("Unable to update %s: "
+ "AC power is required"),
+ str_app);
+ break;
default:
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
@@ -1217,6 +1231,13 @@ gs_shell_show_event_upgrade (GsShell *shell, GsPluginEvent *event)
"you do not have permission to upgrade"),
str_app);
break;
+ case GS_PLUGIN_ERROR_AC_POWER_REQUIRED:
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the distro name (e.g. "Fedora 25") */
+ g_string_append_printf (str, _("Unable to upgrade to %s: "
+ "AC power is required"),
+ str_app);
+ break;
default:
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the distro name (e.g. "Fedora 25") */
@@ -1274,6 +1295,13 @@ gs_shell_show_event_remove (GsShell *shell, GsPluginEvent *event)
" permission to remove software"),
str_app);
break;
+ case GS_PLUGIN_ERROR_AC_POWER_REQUIRED:
+ /* TRANSLATORS: failure text for the in-app notification,
+ * where the %s is the application name (e.g. "GIMP") */
+ g_string_append_printf (str, _("Unable to remove %s: "
+ "AC power is required"),
+ str_app);
+ break;
default:
/* TRANSLATORS: failure text for the in-app notification,
* where the %s is the application name (e.g. "GIMP") */
@@ -1424,6 +1452,10 @@ gs_shell_show_event_fallback (GsShell *shell, GsPluginEvent *event)
"restarted to use new plugins."));
}
break;
+ case GS_PLUGIN_ERROR_AC_POWER_REQUIRED:
+ /* TRANSLATORS: need to be connected to the AC power */
+ g_string_append (str, _("AC power is required"));
+ break;
default:
break;
}
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 61bc558..7625a8a 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -80,6 +80,11 @@ gs_plugin_fwupd_error_convert (GError **perror)
case FWUPD_ERROR_SIGNATURE_INVALID:
error->code = GS_PLUGIN_ERROR_NO_SECURITY;
break;
+#if FWUPD_CHECK_VERSION(0,8,0)
+ case FWUPD_ERROR_AC_POWER_REQUIRED:
+ error->code = GS_PLUGIN_ERROR_AC_POWER_REQUIRED;
+ break;
+#endif
default:
error->code = GS_PLUGIN_ERROR_FAILED;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]