Merge lp:~khurshid-alam/unity-settings-daemon/fix-low-battery-notifications into lp:unity-settings-daemon

Proposed by Khurshid Alam
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 4194
Merged at revision: 4194
Proposed branch: lp:~khurshid-alam/unity-settings-daemon/fix-low-battery-notifications
Merge into: lp:unity-settings-daemon
Diff against target: 74 lines (+2/-27)
1 file modified
plugins/power/gsd-power-manager.c (+2/-27)
To merge this branch: bzr merge lp:~khurshid-alam/unity-settings-daemon/fix-low-battery-notifications
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+369223@code.launchpad.net

Commit message

power: Remove 'on AC' check from warning-levels
UPower already does this for us, to avoid warning levels being set
when the batteries didn't notice the AC yet.

To post a comment you must log in.
Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

This is part of upower .99 port of g-s-d, but most of the commits are not required for unity. So I cherry picked only the most commit since double check is happening here.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, looks fine. One comment, it would help if you included reference to upstream commits when it's a backport, e.g in this case seems to be
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/commit/88e384e3

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/power/gsd-power-manager.c'
--- plugins/power/gsd-power-manager.c 2016-06-15 15:40:17 +0000
+++ plugins/power/gsd-power-manager.c 2019-06-24 06:33:38 +0000
@@ -1171,14 +1171,6 @@
1171 "time-to-empty", &time_to_empty,1171 "time-to-empty", &time_to_empty,
1172 NULL);1172 NULL);
11731173
1174 /* check to see if the batteries have not noticed we are on AC */
1175 if (kind == UP_DEVICE_KIND_BATTERY) {
1176 if (!up_client_get_on_battery (manager->priv->up_client)) {
1177 g_warning ("ignoring low message as we are not on battery power");
1178 goto out;
1179 }
1180 }
1181
1182 if (kind == UP_DEVICE_KIND_BATTERY) {1174 if (kind == UP_DEVICE_KIND_BATTERY) {
11831175
1184 /* if the user has no other batteries, drop the "Laptop" wording */1176 /* if the user has no other batteries, drop the "Laptop" wording */
@@ -1287,7 +1279,6 @@
1287 /* TRANSLATORS: this is the sound description */1279 /* TRANSLATORS: this is the sound description */
1288 CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL);1280 CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL);
12891281
1290out:
1291 if (icon != NULL)1282 if (icon != NULL)
1292 g_object_unref (icon);1283 g_object_unref (icon);
1293 g_free (message);1284 g_free (message);
@@ -1312,14 +1303,6 @@
1312 "time-to-empty", &time_to_empty,1303 "time-to-empty", &time_to_empty,
1313 NULL);1304 NULL);
13141305
1315 /* check to see if the batteries have not noticed we are on AC */
1316 if (kind == UP_DEVICE_KIND_BATTERY) {
1317 if (!up_client_get_on_battery (manager->priv->up_client)) {
1318 g_warning ("ignoring critically low message as we are not on battery power");
1319 goto out;
1320 }
1321 }
1322
1323 if (kind == UP_DEVICE_KIND_BATTERY) {1306 if (kind == UP_DEVICE_KIND_BATTERY) {
13241307
1325 /* if the user has no other batteries, drop the "Laptop" wording */1308 /* if the user has no other batteries, drop the "Laptop" wording */
@@ -1468,7 +1451,7 @@
1468 CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL);1451 CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL);
1469 break;1452 break;
1470 }1453 }
1471out:1454
1472 if (icon != NULL)1455 if (icon != NULL)
1473 g_object_unref (icon);1456 g_object_unref (icon);
1474 g_free (message);1457 g_free (message);
@@ -1489,14 +1472,6 @@
1489 "kind", &kind,1472 "kind", &kind,
1490 NULL);1473 NULL);
14911474
1492 /* check to see if the batteries have not noticed we are on AC */
1493 if (kind == UP_DEVICE_KIND_BATTERY) {
1494 if (!up_client_get_on_battery (manager->priv->up_client)) {
1495 g_warning ("ignoring critically low message as we are not on battery power");
1496 goto out;
1497 }
1498 }
1499
1500 if (kind == UP_DEVICE_KIND_BATTERY) {1475 if (kind == UP_DEVICE_KIND_BATTERY) {
15011476
1502 /* TRANSLATORS: laptop battery is really, really, low */1477 /* TRANSLATORS: laptop battery is really, really, low */
@@ -1596,7 +1571,7 @@
1596 CA_PROP_EVENT_ID, "battery-caution",1571 CA_PROP_EVENT_ID, "battery-caution",
1597 /* TRANSLATORS: this is the sound description */1572 /* TRANSLATORS: this is the sound description */
1598 CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL);1573 CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL);
1599out:1574
1600 if (icon != NULL)1575 if (icon != NULL)
1601 g_object_unref (icon);1576 g_object_unref (icon);
1602 g_free (message);1577 g_free (message);

Subscribers

People subscribed via source and target branches