[gnome-settings-daemon/wip/aggregate-menu: 4/8] power: Ensure that the composite device only represent battery devices
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/aggregate-menu: 4/8] power: Ensure that the composite device only represent battery devices
- Date: Wed, 12 Jun 2013 20:20:52 +0000 (UTC)
commit e950991ae10cbaaf85af92d1be773f2e4ba05dde
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jun 10 13:37:02 2013 -0400
power: Ensure that the composite device only represent battery devices
The code before was a tad too generic..
https://bugzilla.gnome.org/show_bug.cgi?id=700913
plugins/power/gsd-power-manager.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index df568ec..7c9f974 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -223,7 +223,7 @@ enum {
static void gsd_power_manager_class_init (GsdPowerManagerClass *klass);
static void gsd_power_manager_init (GsdPowerManager *power_manager);
-static void engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device);
+static void engine_update_composite_device (GsdPowerManager *manager);
static GIcon *engine_get_icon (GsdPowerManager *manager);
static gchar *engine_get_summary (GsdPowerManager *manager);
static gdouble engine_get_percentage (GsdPowerManager *manager);
@@ -699,8 +699,7 @@ engine_recalculate_state (GsdPowerManager *manager)
}
static void
-engine_update_composite_device (GsdPowerManager *manager,
- UpDevice *original_device)
+engine_update_composite_device (GsdPowerManager *manager)
{
guint i;
gdouble percentage = 0.0;
@@ -719,12 +718,6 @@ engine_update_composite_device (GsdPowerManager *manager,
UpDevice *device;
UpDeviceState state;
UpDeviceKind kind;
- UpDeviceKind original_kind;
-
- /* get the type of the original device */
- g_object_get (original_device,
- "kind", &original_kind,
- NULL);
/* update the composite device */
array = manager->priv->devices_array;
@@ -737,7 +730,7 @@ engine_update_composite_device (GsdPowerManager *manager,
"energy-full", &energy_full,
"energy-rate", &energy_rate,
NULL);
- if (kind != original_kind)
+ if (kind != UP_DEVICE_KIND_BATTERY)
continue;
/* one of these will be charging or discharging */
@@ -958,7 +951,7 @@ engine_device_add (GsdPowerManager *manager, UpDevice *device)
if (kind == UP_DEVICE_KIND_BATTERY) {
g_debug ("updating because we added a device");
- engine_update_composite_device (manager, device);
+ engine_update_composite_device (manager);
/* get the same values for the composite device */
warning = engine_get_warning (manager, manager->priv->device_composite);
@@ -1714,7 +1707,7 @@ engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *m
/* if battery then use composite device to cope with multiple batteries */
if (kind == UP_DEVICE_KIND_BATTERY) {
g_debug ("updating because %s changed", up_device_get_object_path (device));
- engine_update_composite_device (manager, device);
+ engine_update_composite_device (manager);
device = manager->priv->device_composite;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]