summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-07-21 20:00:39 +0200
committerBenjamin Berg <bberg@redhat.com>2021-08-19 15:12:22 +0200
commit877119047da3e03c1ddaf0c7c965ca48451e9fe0 (patch)
tree70e0d08c45c5c7b607ba1dc583dfa30fb7211188
parent82ab37ff510130c6feb48e0cbb103a5e9ef9b37b (diff)
downloadgnome-settings-daemon-877119047da3e03c1ddaf0c7c965ca48451e9fe0.tar.gz
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
-rw-r--r--plugins/power/gsd-power-manager.c23
1 files changed, 23 insertions, 0 deletions
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 */