[gnome-settings-daemon/wip/hadess/power-empty-notifications: 1/3] power: Fix empty power notifications
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/hadess/power-empty-notifications: 1/3] power: Fix empty power notifications
- Date: Wed, 21 Jul 2021 18:04:52 +0000 (UTC)
commit af9202e8440eb675729627ca119b2e044a2a9584
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 95cec9c3..b8703ade 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -608,6 +608,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 = _("Device battery low");
+
+ /* TRANSLATORS: tell user more details */
+ if (battery_level == UP_DEVICE_LEVEL_NONE)
+ message = g_strdup_printf (_("Device is low in power (%.0f%%)"), percentage);
+ else
+ message = g_strdup_printf (_("Device is low in power"));
}
/* close any existing notification of this class */
@@ -795,6 +804,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 = _("Device battery low");
+
+ /* TRANSLATORS: the device is just going to stop working */
+ if (battery_level == UP_DEVICE_LEVEL_NONE)
+ message = g_strdup_printf (_("Device is very low in power (%.0f%%). "
+ "The device will soon shutdown if not charged."),
+ percentage);
+ else
+ message = g_strdup_printf (_("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]