gnome-power-manager r3106 - in trunk: . src



Author: rhughes
Date: Mon Dec  1 12:32:02 2008
New Revision: 3106
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3106&view=rev

Log:
2008-12-01  Richard Hughes  <richard hughsie com>

* src/gpm-dpms.c: (add_poll_timer):
* src/gpm-engine-old.c: (control_resume_cb),
(gpm_engine_recalculate_state_icon):
* src/gpm-engine.c: (gpm_engine_recalculate_state_icon):
* src/gpm-idle.c: (gpm_idle_add_gpm_idle_poll_system_timer),
(system_timer), (add_system_timer):
* src/gpm-info.c: (gpm_info_init):
* src/gpm-light-sensor.c: (gpm_light_sensor_init):
* src/gpm-main.c: (main):
* src/gpm-manager.c: (gpm_engine_perhaps_recall_cb):
* src/gpm-statistics-core.c: (gpm_statistics_init):
Use g_timeout_add_seconds instead of g_timeout_add.
Patch from Jan <jan-gnome kantert net>, many thanks.


Modified:
   trunk/ChangeLog
   trunk/src/gpm-dpms.c
   trunk/src/gpm-engine-old.c
   trunk/src/gpm-engine.c
   trunk/src/gpm-idle.c
   trunk/src/gpm-info.c
   trunk/src/gpm-light-sensor.c
   trunk/src/gpm-main.c
   trunk/src/gpm-manager.c
   trunk/src/gpm-statistics-core.c

Modified: trunk/src/gpm-dpms.c
==============================================================================
--- trunk/src/gpm-dpms.c	(original)
+++ trunk/src/gpm-dpms.c	Mon Dec  1 12:32:02 2008
@@ -53,7 +53,7 @@
 #define GPM_DPMS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_DPMS, GpmDpmsPrivate))
 
 /* until we get a nice event-emitting DPMS extension, we have to poll... */
-#define GPM_DPMS_POLL_TIME	10*1000
+#define GPM_DPMS_POLL_TIME	10
 
 struct GpmDpmsPrivate
 {
@@ -778,7 +778,7 @@
 add_poll_timer (GpmDpms *dpms,
 		glong	 timeout)
 {
-	dpms->priv->timer_id = g_timeout_add (timeout, (GSourceFunc)poll_dpms_mode, dpms);
+	dpms->priv->timer_id = g_timeout_add_seconds (timeout, (GSourceFunc)poll_dpms_mode, dpms);
 }
 
 static void

Modified: trunk/src/gpm-engine-old.c
==============================================================================
--- trunk/src/gpm-engine-old.c	(original)
+++ trunk/src/gpm-engine-old.c	Mon Dec  1 12:32:02 2008
@@ -48,7 +48,7 @@
 static void     gpm_engine_finalize   (GObject	  *object);
 
 #define GPM_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_ENGINE, GpmEnginePrivate))
-#define GPM_ENGINE_RESUME_DELAY		2*1000
+#define GPM_ENGINE_RESUME_DELAY		2
 #define GPM_ENGINE_WARN_ACCURACY	20
 
 
@@ -132,7 +132,7 @@
 control_resume_cb (GpmControl *control, GpmControlAction action, GpmEngine *engine)
 {
 	/* we have to delay this at resume to counteract races */
-	g_timeout_add (GPM_ENGINE_RESUME_DELAY, (GSourceFunc) gpm_engine_delayed_refresh, engine);
+	g_timeout_add_seconds (GPM_ENGINE_RESUME_DELAY, (GSourceFunc) gpm_engine_delayed_refresh, engine);
 }
 
 /**
@@ -440,7 +440,7 @@
 		egg_debug ("** EMIT: icon-changed: none");
 
 		/* we let the icon stick around for a couple of seconds */
-		g_timeout_add (1000*2, (GSourceFunc) gpm_engine_icon_clear_delay, engine);
+		g_timeout_add_seconds (2, (GSourceFunc) gpm_engine_icon_clear_delay, engine);
 
 		g_free (engine->priv->previous_icon);
 		engine->priv->previous_icon = NULL;

Modified: trunk/src/gpm-engine.c
==============================================================================
--- trunk/src/gpm-engine.c	(original)
+++ trunk/src/gpm-engine.c	Mon Dec  1 12:32:02 2008
@@ -387,7 +387,7 @@
 		egg_debug ("** EMIT: icon-changed: none");
 
 		/* we let the icon stick around for a couple of seconds */
-		g_timeout_add (1000*2, (GSourceFunc) gpm_engine_icon_clear_delay, engine);
+		g_timeout_add_seconds (2, (GSourceFunc) gpm_engine_icon_clear_delay, engine);
 
 		g_free (engine->priv->previous_icon);
 		engine->priv->previous_icon = NULL;

Modified: trunk/src/gpm-idle.c
==============================================================================
--- trunk/src/gpm-idle.c	(original)
+++ trunk/src/gpm-idle.c	Mon Dec  1 12:32:02 2008
@@ -143,7 +143,7 @@
 gpm_idle_add_gpm_idle_poll_system_timer (GpmIdle *idle,
 		       glong	timeout)
 {
-	idle->priv->system_idle_timer_id = g_timeout_add (timeout, (GSourceFunc)gpm_idle_poll_system_timer, idle);
+	idle->priv->system_idle_timer_id = g_timeout_add_seconds (timeout, (GSourceFunc)gpm_idle_poll_system_timer, idle);
 }
 
 /**
@@ -171,7 +171,7 @@
 	egg_debug ("System idle timeout");
 
 	gpm_idle_remove_gpm_idle_poll_system_timer (idle);
-	gpm_idle_add_gpm_idle_poll_system_timer (idle, POLL_FREQUENCY * 1000);
+	gpm_idle_add_gpm_idle_poll_system_timer (idle, POLL_FREQUENCY);
 
 	idle->priv->system_timer_id = 0;
 	return FALSE;
@@ -210,12 +210,12 @@
 static void
 add_system_timer (GpmIdle *idle)
 {
-	guint64 msecs;
+	guint64 secs;
 
-	msecs = idle->priv->system_timeout * 1000;
+	secs = idle->priv->system_timeout;
 
 	if (idle->priv->system_timeout > 0) {
-		idle->priv->system_timer_id = g_timeout_add (msecs,
+		idle->priv->system_timer_id = g_timeout_add_seconds (secs,
 							     (GSourceFunc)system_timer, idle);
 	} else {
 		egg_debug ("System idle disabled");

Modified: trunk/src/gpm-info.c
==============================================================================
--- trunk/src/gpm-info.c	(original)
+++ trunk/src/gpm-info.c	Mon Dec  1 12:32:02 2008
@@ -677,7 +677,7 @@
 		info->priv->voltage_data = gpm_array_new ();
 
 		/* set up the timer callback so we can log data */
-		g_timeout_add (GPM_INFO_DATA_POLL * 1000, gpm_info_log_do_poll, info);
+		g_timeout_add_seconds (GPM_INFO_DATA_POLL, gpm_info_log_do_poll, info);
 
 	} else {
 		info->priv->percentage_data = NULL;

Modified: trunk/src/gpm-light-sensor.c
==============================================================================
--- trunk/src/gpm-light-sensor.c	(original)
+++ trunk/src/gpm-light-sensor.c	Mon Dec  1 12:32:02 2008
@@ -364,7 +364,7 @@
 
 		/* get poll timeout */
 		timeout = gconf_client_get_int (sensor->priv->conf, GPM_CONF_AMBIENT_POLL, NULL);
-		g_timeout_add (timeout * 1000, gpm_light_sensor_poll_cb, sensor);
+		g_timeout_add_seconds (timeout, gpm_light_sensor_poll_cb, sensor);
 	}
 }
 

Modified: trunk/src/gpm-main.c
==============================================================================
--- trunk/src/gpm-main.c	(original)
+++ trunk/src/gpm-main.c	Mon Dec  1 12:32:02 2008
@@ -220,7 +220,7 @@
 	/* Only timeout and close the mainloop if we have specified it
 	 * on the command line */
 	if (timed_exit) {
-		g_timeout_add (1000 * 20, (GSourceFunc) timed_exit_cb, loop);
+		g_timeout_add_seconds (20, (GSourceFunc) timed_exit_cb, loop);
 	}
 
 	if (immediate_exit == FALSE) {

Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c	(original)
+++ trunk/src/gpm-manager.c	Mon Dec  1 12:32:02 2008
@@ -93,7 +93,7 @@
 static void     gpm_manager_finalize	(GObject	 *object);
 
 #define GPM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_MANAGER, GpmManagerPrivate))
-#define GPM_MANAGER_RECALL_DELAY		1000*10
+#define GPM_MANAGER_RECALL_DELAY		10
 
 #define GPM_SESSION_MANAGER_SERVICE	"org.gnome.SessionManager"
 #define GPM_SESSION_MANAGER_INTERFACE	"org.gnome.SessionManager"
@@ -1448,7 +1448,7 @@
 	g_object_set_data (G_OBJECT (manager), "recall-oem-vendor", (gpointer) g_strdup (oem_vendor));
 	g_object_set_data (G_OBJECT (manager), "recall-oem-website", (gpointer) g_strdup (website));
 	/* delay by a few seconds so the panel can load */
-	g_timeout_add (GPM_MANAGER_RECALL_DELAY, (GSourceFunc) gpm_manager_perhaps_recall, manager);
+	g_timeout_add_seconds (GPM_MANAGER_RECALL_DELAY, (GSourceFunc) gpm_manager_perhaps_recall, manager);
 }
 
 /**
@@ -1859,7 +1859,7 @@
 		g_free (action);
 
 		/* wait 10 seconds for user-panic */
-		g_timeout_add (1000*10, (GSourceFunc) manager_critical_action_do, manager);
+		g_timeout_add_seconds (10, (GSourceFunc) manager_critical_action_do, manager);
 
 #ifndef HAVE_DK_POWER
 	} else if (unit->kind == GPM_CELL_UNIT_KIND_UPS) {

Modified: trunk/src/gpm-statistics-core.c
==============================================================================
--- trunk/src/gpm-statistics-core.c	(original)
+++ trunk/src/gpm-statistics-core.c	Mon Dec  1 12:32:02 2008
@@ -66,7 +66,7 @@
 #define ACTION_PROFILE_CHARGE_ACCURACY_TEXT	_("Charge time accuracy profile")
 #define ACTION_PROFILE_DISCHARGE_ACCURACY_TEXT	_("Discharge time accuracy profile")
 
-#define GPM_STATISTICS_POLL_INTERVAL	15000 /* ms */
+#define GPM_STATISTICS_POLL_INTERVAL	15 /* s */
 
 struct GpmStatisticsPrivate
 {
@@ -864,7 +864,7 @@
 	gpm_statistics_refresh_axis_labels (statistics);
 
 	gtk_widget_show (main_window);
-	g_timeout_add (GPM_STATISTICS_POLL_INTERVAL,
+	g_timeout_add_seconds (GPM_STATISTICS_POLL_INTERVAL,
 		       gpm_statistics_graph_refresh, statistics);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]