diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-23 17:54:43 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-26 14:55:15 +0200 |
commit | f62e7f11a7d9f89abb7b3b971417337a239e5ba6 (patch) | |
tree | 285c552da3bc7270926603ee890ca1d9c0080cd9 | |
parent | feea39fa43f65bc556216f2bcc0fdf1cc6098aba (diff) | |
download | upower-f62e7f11a7d9f89abb7b3b971417337a239e5ba6.tar.gz |
linux: Move poll disable to another function
-rw-r--r-- | src/linux/up-device-supply.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index 5ee0975..32001dc 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -1076,6 +1076,17 @@ out: return (supply->priv->poll_timer_id != 0); } +static void +up_device_supply_disable_poll (UpDevice *device) +{ + UpDeviceSupply *supply = UP_DEVICE_SUPPLY (device); + + if (supply->priv->poll_timer_id > 0) { + g_source_remove (supply->priv->poll_timer_id); + supply->priv->poll_timer_id = 0; + } +} + /** * up_device_supply_refresh: * @@ -1096,10 +1107,7 @@ up_device_supply_refresh (UpDevice *device) ret = up_device_supply_refresh_line_power (supply); break; default: - if (supply->priv->poll_timer_id > 0) { - g_source_remove (supply->priv->poll_timer_id); - supply->priv->poll_timer_id = 0; - } + up_device_supply_disable_poll (device); if (supply->priv->is_power_supply) ret = up_device_supply_refresh_battery (supply, &state); |