[gnome-settings-daemon/wip/hadess/power-empty-notifications: 31/34] power: Fix empty power notifications
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/hadess/power-empty-notifications: 31/34] power: Fix empty power notifications
- Date: Thu, 19 Aug 2021 13:04:51 +0000 (UTC)
commit 82610b01ceeaa435be60db3eb66b23c27c86776d
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jul 21 20:00:39 2021 +0200
power: Fix empty power notifications
Power notifications for more than a dozen device types were empty as we
only handled a set list of device kinds with no fallback at all.
Closes: #607
plugins/power/gsd-power-manager.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 91538b6c..0bb951ce 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -609,6 +609,15 @@ engine_charge_low (GsdPowerManager *manager, UpDevice *device)
message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"),
percentage);
else
message = g_strdup_printf (_("Attached computer is low in power"));
+ } else {
+ /* TRANSLATORS: a generic device is getting a little low */
+ title = _("Connected device battery low");
+
+ /* TRANSLATORS: tell user more details */
+ if (battery_level == UP_DEVICE_LEVEL_NONE)
+ message = g_strdup_printf (_("A connected device is low in power (%.0f%%)"),
percentage);
+ else
+ message = g_strdup_printf (_("A connected device is low in power"));
}
/* close any existing notification of this class */
@@ -788,6 +797,20 @@ engine_charge_critical (GsdPowerManager *manager, UpDevice *device)
message = g_strdup_printf (_("Attached computer is very low in power. "
"The device will soon shutdown if not charged."));
+ } else {
+
+ /* TRANSLATORS: generic device battery is very low */
+ title = _("Connected device battery low");
+
+ /* TRANSLATORS: the device is just going to stop working */
+ if (battery_level == UP_DEVICE_LEVEL_NONE)
+ message = g_strdup_printf (_("A connected device is very low in power (%.0f%%). "
+ "The device will soon shutdown if not charged."),
+ percentage);
+ else
+ message = g_strdup_printf (_("A connected device is very low in power. "
+ "The device will soon shutdown if not charged."));
+
}
/* close any existing notification of this class */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]