On the offchance that my idea is right I am about to test the following patch to gnome-setting-deamon. If anyone has a clue about that code please take a look and tell me if it is correct or hopeless.
+ if (!is_present)
+ return WARNING_NONE;
+
/* this is probably an error condition */
if (time_to_empty == 0) { g_debug ("time zero, falling back to percentage for %s",
On the offchance that my idea is right I am about to test the following patch to gnome-setting- deamon. If anyone has a clue about that code please take a look and tell me if it is correct or hopeless.
$ diff -ud ./plugins/ power/gsd- power-manager. c.old ./plugins/ power/gsd- power-manager. c power/gsd- power-manager. c.old 2011-12-09 23:26:57.786558053 +0100 power/gsd- power-manager. c 2011-12-09 23:30:02.812727359 +0100 get_warning_ percentage (GsdPowerManager *manager, UpDevice *device)
--- ./plugins/
+++ ./plugins/
@@ -375,9 +375,16 @@
engine_
{
gdouble percentage;
+ gboolean is_present;
/* get device properties */
- g_object_get (device, "percentage", &percentage, NULL);
+ g_object_get (device,
+ "percentage", &percentage,
+ "is-present", &is_present,
+ NULL);
+
+ if (!is_present)
+ return WARNING_NONE;
if (percentage <= manager- >priv-> action_ percentage)
return WARNING_ACTION;
UpDeviceKind kind;
@@ -393,13 +400,18 @@
{
gint64 time_to_empty;
+ gboolean is_present;
/* get device properties */
g_object_ get (device,
"kind" , &kind,
"time- to-empty" , &time_to_empty,
NULL) ;
+ "is-present", &is_present,
+ if (!is_present)
g_debug ("time zero, falling back to percentage for %s",
+ return WARNING_NONE;
+
/* this is probably an error condition */
if (time_to_empty == 0) {