aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-10-02 18:29:24 +0100
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-10-02 18:29:24 +0100
commitf87057a08104fc7dcc0e232a5bf4e51561810ced (patch)
tree6b2d5cd49eae207c0618c85f73d5eaf48d87b76c /src/indicator-power.c
parentc5504054448664f0f03de1c2433dd7f3777c8742 (diff)
downloadayatana-indicator-power-f87057a08104fc7dcc0e232a5bf4e51561810ced.tar.gz
ayatana-indicator-power-f87057a08104fc7dcc0e232a5bf4e51561810ced.tar.bz2
ayatana-indicator-power-f87057a08104fc7dcc0e232a5bf4e51561810ced.zip
Add a workaround to fix the case when we get a empty bay as a real battery
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 275e871..28cc023 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -427,10 +427,15 @@ menu_add_device (GtkMenu *menu,
&state,
&time);
- if (kind == UP_DEVICE_KIND_LINE_POWER)
+ g_debug ("%s: got data from object %s", G_STRFUNC, object_path);
+
+ /* Try to fix the case when we get a empty battery bay as a real battery */
+ if (state == UP_DEVICE_STATE_UNKNOWN &&
+ percentage == 0)
return;
- g_debug ("%s: got data from object %s", G_STRFUNC, object_path);
+ if (kind == UP_DEVICE_KIND_LINE_POWER)
+ return;
/* Process the data */
device_gicons = get_device_icon (kind, state, device_icon);
@@ -582,6 +587,11 @@ get_primary_device (GVariant *devices)
g_debug ("%s: got data from object %s", G_STRFUNC, object_path);
+ /* Try to fix the case when we get a empty battery bay as a real battery */
+ if (state == UP_DEVICE_STATE_UNKNOWN &&
+ percentage == 0)
+ continue;
+
/* not battery */
if (kind != UP_DEVICE_KIND_BATTERY)
continue;