[gnome-power-manager] Correct the logic for the fully charged and discharging popups
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-power-manager] Correct the logic for the fully charged and discharging popups
- Date: Fri, 29 May 2009 07:29:11 -0400 (EDT)
commit 956fa17287349a6136026dcb66893dc1102eac6e
Author: Richard Hughes <richard hughsie com>
Date: Fri May 29 10:40:13 2009 +0100
Correct the logic for the fully charged and discharging popups
---
src/gpm-engine.c | 21 ++++++---------------
src/gpm-manager.c | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index 735ba67..3848b25 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -648,7 +648,6 @@ gpm_engine_device_changed_cb (DkpClient *client, DkpDevice *device, GpmEngine *e
DkpDeviceState state_old;
GpmEngineWarning warning_old;
GpmEngineWarning warning;
- gboolean ret;
/* check the warning state has not changed */
warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old"));
@@ -677,20 +676,12 @@ gpm_engine_device_changed_cb (DkpClient *client, DkpDevice *device, GpmEngine *e
state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old"));
if (state_old != state) {
- if (state_old == DKP_DEVICE_STATE_DISCHARGING) {
- /* only emit this if specified in gconf */
- ret = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_DISCHARGING, NULL);
- if (ret) {
- egg_debug ("** EMIT: discharging");
- g_signal_emit (engine, signals [DISCHARGING], 0, device);
- }
- } else if (state_old == DKP_DEVICE_STATE_FULLY_CHARGED) {
- /* only emit this if specified in gconf */
- ret = gconf_client_get_bool (engine->priv->conf, GPM_CONF_NOTIFY_FULLY_CHARGED, NULL);
- if (ret) {
- egg_debug ("** EMIT: discharging");
- g_signal_emit (engine, signals [FULLY_CHARGED], 0, device);
- }
+ if (state == DKP_DEVICE_STATE_DISCHARGING) {
+ egg_debug ("** EMIT: discharging");
+ g_signal_emit (engine, signals [DISCHARGING], 0, device);
+ } else if (state == DKP_DEVICE_STATE_FULLY_CHARGED) {
+ egg_debug ("** EMIT: fully charged");
+ g_signal_emit (engine, signals [FULLY_CHARGED], 0, device);
}
/* save new state */
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index f4ad2c1..69c69e5 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1037,6 +1037,14 @@ static void
gpm_engine_fully_charged_cb (GpmEngine *engine, DkpDevice *device, GpmManager *manager)
{
DkpDeviceType type;
+ gboolean ret;
+
+ /* only action this if specified in gconf */
+ ret = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_FULLY_CHARGED, NULL);
+ if (!ret) {
+ egg_debug ("no notification");
+ return;
+ }
/* get device properties */
g_object_get (device,
@@ -1054,6 +1062,14 @@ static void
gpm_engine_discharging_cb (GpmEngine *engine, DkpDevice *device, GpmManager *manager)
{
DkpDeviceType type;
+ gboolean ret;
+
+ /* only action this if specified in gconf */
+ ret = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_DISCHARGING, NULL);
+ if (!ret) {
+ egg_debug ("no notification");
+ return;
+ }
/* get device properties */
g_object_get (device,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]