[Xfce4-commits] <xfce4-power-manager:devkit-power> Use EggIdletime.

Ali Abdallah noreply at xfce.org
Sun Nov 29 17:12:03 CET 2009


Updating branch refs/heads/devkit-power
         to 2153e95ad6388d0c6c7b2f2d5b2f84c42befadb9 (commit)
       from e350197a6ce92baa487ca8a3d40a90d873ed0edc (commit)

commit 2153e95ad6388d0c6c7b2f2d5b2f84c42befadb9
Author: Ali Abdallah <ali at ali-xfce.org>
Date:   Fri Nov 27 11:08:07 2009 +0100

    Use EggIdletime.

 src/Makefile.am      |    4 ++--
 src/egg-idletime.c   |    2 +-
 src/xfpm-backlight.c |   20 ++++++++++----------
 src/xfpm-manager.c   |   24 ++++++++++--------------
 4 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index d999efd..8c4305f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,8 +19,8 @@ xfce4_power_manager_SOURCES =                   \
 	xfpm-disks.h				\
 	xfpm-console-kit.c			\
 	xfpm-console-kit.h			\
-	xfpm-idle.c				\
-	xfpm-idle.h				\
+	egg-idletime.c				\
+	egg-idletime.h				\
 	xfpm-backlight.c			\
 	xfpm-backlight.h			\
 	xfpm-dpms.c				\
diff --git a/src/egg-idletime.c b/src/egg-idletime.c
index ea5e6af..3cb8c7e 100644
--- a/src/egg-idletime.c
+++ b/src/egg-idletime.c
@@ -398,7 +398,7 @@ egg_idletime_init (EggIdletime *idletime)
 
 	/* gtk_init should do XSyncInitialize for us */
 	counters = XSyncListSystemCounters (idletime->priv->dpy, &ncounters);
-	for (i=0; i < ncounters && !idletime->priv->idle_counter; i++) {
+	for (i=0; i < (guint)ncounters && !idletime->priv->idle_counter; i++) {
 		if (strcmp(counters[i].name, "IDLETIME") == 0)
 			idletime->priv->idle_counter = counters[i].counter;
 	}
diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c
index d09f34c..da7aafe 100644
--- a/src/xfpm-backlight.c
+++ b/src/xfpm-backlight.c
@@ -30,7 +30,7 @@
 #include <libxfce4util/libxfce4util.h>
 
 #include "xfpm-backlight.h"
-#include "xfpm-idle.h"
+#include "egg-idletime.h"
 #include "xfpm-notify.h"
 #include "xfpm-xfconf.h"
 #include "xfpm-dkp.h"
@@ -52,7 +52,7 @@ struct XfpmBacklightPrivate
 {
     XfpmBrightness *brightness;
     XfpmDkp        *dkp;
-    XfpmIdle       *idle;
+    EggIdletime    *idle;
     XfpmXfconf     *conf;
     XfpmButton     *button;
     XfpmNotify     *notify;
@@ -281,7 +281,7 @@ out:
 
 
 static void
-xfpm_backlight_alarm_timeout_cb (XfpmIdle *idle, guint id, XfpmBacklight *backlight)
+xfpm_backlight_alarm_timeout_cb (EggIdletime *idle, guint id, XfpmBacklight *backlight)
 {
     backlight->priv->block = FALSE;
     
@@ -292,7 +292,7 @@ xfpm_backlight_alarm_timeout_cb (XfpmIdle *idle, guint id, XfpmBacklight *backli
 }
 
 static void
-xfpm_backlight_reset_cb (XfpmIdle *idle, XfpmBacklight *backlight)
+xfpm_backlight_reset_cb (EggIdletime *idle, XfpmBacklight *backlight)
 {
     if ( backlight->priv->dimmed)
     {
@@ -360,11 +360,11 @@ xfpm_backlight_brightness_on_ac_settings_changed (XfpmBacklight *backlight)
     
     if ( timeout_on_ac == ALARM_DISABLED )
     {
-	xfpm_idle_free_alarm (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC );
+	egg_idletime_alarm_remove (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC );
     }
     else
     {
-	xfpm_idle_set_alarm (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC, timeout_on_ac * 1000);
+	egg_idletime_alarm_set (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC, timeout_on_ac * 1000);
     }
 }
 
@@ -381,11 +381,11 @@ xfpm_backlight_brightness_on_battery_settings_changed (XfpmBacklight *backlight)
     
     if ( timeout_on_battery == ALARM_DISABLED )
     {
-	xfpm_idle_free_alarm (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY );
+	egg_idletime_alarm_remove (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY );
     }
     else
     {
-	xfpm_idle_set_alarm (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY, timeout_on_battery * 1000);
+	egg_idletime_alarm_set (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY, timeout_on_battery * 1000);
     } 
 }
 
@@ -440,7 +440,7 @@ xfpm_backlight_init (XfpmBacklight *backlight)
     }
     else
     {
-	backlight->priv->idle   = xfpm_idle_new ();
+	backlight->priv->idle   = egg_idletime_new ();
 	backlight->priv->conf   = xfpm_xfconf_new ();
 	backlight->priv->button = xfpm_button_new ();
 	backlight->priv->dkp    = xfpm_dkp_get ();
@@ -450,7 +450,7 @@ xfpm_backlight_init (XfpmBacklight *backlight)
 	if ( xfpm_brightness_get_control (backlight->priv->brightness) == XFPM_BRIGHTNESS_CONTROL_HAL )
 	    backlight->priv->brightness_in_hw = xfpm_brightness_in_hw (backlight->priv->brightness);
 #endif
-	g_signal_connect (backlight->priv->idle, "alarm-timeout",
+	g_signal_connect (backlight->priv->idle, "alarm-expired",
                           G_CALLBACK (xfpm_backlight_alarm_timeout_cb), backlight);
         
         g_signal_connect (backlight->priv->idle, "reset",
diff --git a/src/xfpm-manager.c b/src/xfpm-manager.c
index d505ebd..84ffda2 100644
--- a/src/xfpm-manager.c
+++ b/src/xfpm-manager.c
@@ -47,7 +47,7 @@
 #include "xfpm-button.h"
 #include "xfpm-backlight.h"
 #include "xfpm-inhibit.h"
-#include "xfpm-idle.h"
+#include "egg-idletime.h"
 #include "xfpm-config.h"
 #include "xfpm-debug.h"
 #include "xfpm-xfconf.h"
@@ -84,7 +84,7 @@ struct XfpmManagerPrivate
     XfpmDBusMonitor *monitor;
     XfpmDisks       *disks;
     XfpmInhibit     *inhibit;
-    XfpmIdle        *idle;
+    EggIdletime     *idle;
 #ifdef HAVE_DPMS
     XfpmDpms        *dpms;
 #endif
@@ -350,7 +350,7 @@ xfpm_manager_inhibit_changed_cb (XfpmInhibit *inhibit, gboolean inhibited, XfpmM
 }
 
 static void
-xfpm_manager_alarm_timeout_cb (XfpmIdle *idle, guint id, XfpmManager *manager)
+xfpm_manager_alarm_timeout_cb (EggIdletime *idle, guint id, XfpmManager *manager)
 {
     XFPM_DEBUG ("Alarm inactivity timeout id %d", id);
     
@@ -406,11 +406,11 @@ xfpm_manager_set_idle_alarm_on_ac (XfpmManager *manager)
     
     if ( on_ac == 14 )
     {
-	xfpm_idle_free_alarm (manager->priv->idle, TIMEOUT_INACTIVITY_ON_AC );
+	egg_idletime_alarm_remove (manager->priv->idle, TIMEOUT_INACTIVITY_ON_AC );
     }
     else
     {
-	xfpm_idle_set_alarm (manager->priv->idle, TIMEOUT_INACTIVITY_ON_AC, on_ac * 1000 * 60);
+	egg_idletime_alarm_set (manager->priv->idle, TIMEOUT_INACTIVITY_ON_AC, on_ac * 1000 * 60);
     }
 }
 
@@ -432,22 +432,18 @@ xfpm_manager_set_idle_alarm_on_battery (XfpmManager *manager)
     
     if ( on_battery == 14 )
     {
-	xfpm_idle_free_alarm (manager->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY );
+	egg_idletime_alarm_remove (manager->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY );
     }
     else
     {
-	xfpm_idle_set_alarm (manager->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY, on_battery * 1000 * 60);
+	egg_idletime_alarm_set (manager->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY, on_battery * 1000 * 60);
     }
 }
 
 static void
 xfpm_manager_on_battery_changed_cb (XfpmDkp *dkp, gboolean on_battery, XfpmManager *manager)
 {
-    if ( on_battery )
-	xfpm_idle_reset_alarm (manager->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY);
-    else
-	xfpm_idle_reset_alarm (manager->priv->idle, TIMEOUT_INACTIVITY_ON_AC);
-	
+    egg_idletime_alarm_reset_all (manager->priv->idle);
 }
 
 static void
@@ -521,9 +517,9 @@ void xfpm_manager_start (XfpmManager *manager)
     manager->priv->monitor = xfpm_dbus_monitor_new ();
     manager->priv->disks = xfpm_disks_new ();
     manager->priv->inhibit = xfpm_inhibit_new ();
-    manager->priv->idle = xfpm_idle_new ();
+    manager->priv->idle = egg_idletime_new ();
     
-    g_signal_connect (manager->priv->idle, "alarm-timeout",
+    g_signal_connect (manager->priv->idle, "alarm-expired",
 		      G_CALLBACK (xfpm_manager_alarm_timeout_cb), manager);
     
     g_signal_connect (manager->priv->conf, "notify::" ON_AC_INACTIVITY_TIMEOUT,



More information about the Xfce4-commits mailing list