summaryrefslogtreecommitdiff
path: root/src/gpm-engine.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-10 01:29:47 +0200
committerraveit65 <[email protected]>2016-07-25 16:13:41 +0200
commit7afdafd4dd9d053ec0fefb0ed02ff7fe96bc91cf (patch)
tree2dbf7b75d5736937ce6fe4817e020c49f3f77049 /src/gpm-engine.c
parentb94b15e1048dffe16bca53a3cb0f607a539bd9c6 (diff)
downloadmate-power-manager-7afdafd4dd9d053ec0fefb0ed02ff7fe96bc91cf.tar.bz2
mate-power-manager-7afdafd4dd9d053ec0fefb0ed02ff7fe96bc91cf.tar.xz
allow non-battery devices to be used for gpm_engine_update_composite_device()
https://git.gnome.org/browse/gnome-power-manager/commit/?id=2828891 https://git.gnome.org/browse/gnome-power-manager/commit/?id=9b4825b
Diffstat (limited to 'src/gpm-engine.c')
-rw-r--r--src/gpm-engine.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index 49f39fd..6f16381 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -611,8 +611,14 @@ gpm_engine_get_composite_device (GpmEngine *engine, UpDevice *original_device)
GPtrArray *array;
UpDevice *device;
UpDeviceKind kind;
+ UpDeviceKind original_kind;
guint i;
+ /* get the type of the original device */
+ g_object_get (original_device,
+ "kind", &original_kind,
+ NULL);
+
/* find out how many batteries in the system */
array = engine->priv->array;
for (i=0;i<array->len;i++) {
@@ -620,7 +626,7 @@ gpm_engine_get_composite_device (GpmEngine *engine, UpDevice *original_device)
g_object_get (device,
"kind", &kind,
NULL);
- if (kind == UP_DEVICE_KIND_BATTERY)
+ if (kind == original_kind)
battery_devices++;
}
@@ -675,12 +681,18 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
UpDevice *device;
UpDeviceState state;
UpDeviceKind kind;
+ UpDeviceKind original_kind;
gboolean debug;
gchar *text;
/* are we printing to console? */
debug = egg_debug_enabled ();
+ /* get the type of the original device */
+ g_object_get (original_device,
+ "kind", &original_kind,
+ NULL);
+
/* update the composite device */
array = engine->priv->array;
for (i=0;i<array->len;i++) {
@@ -692,7 +704,7 @@ gpm_engine_update_composite_device (GpmEngine *engine, UpDevice *original_device
"energy-full", &energy_full,
"energy-rate", &energy_rate,
NULL);
- if (kind != UP_DEVICE_KIND_BATTERY)
+ if (kind != original_kind)
continue;
if (debug) {