diff options
author | Rob Taylor <rob.taylor@codethink.co.uk> | 2007-08-18 17:21:06 +0100 |
---|---|---|
committer | Rob Taylor <rob.taylor@codethink.co.uk> | 2007-08-22 15:17:50 +0100 |
commit | 516af01cdf9a852ae94075acb6b4d4e6a7d4ca08 (patch) | |
tree | cd8275d41e85113b579c0680f3fde1145b616b68 /plugins/glue/idle/ohm-plugin-idle.c | |
parent | 74fa413f385a77194bddfdef23793838fee2f413 (diff) |
fix up changes to idle plugin
Fix build errors in idle plugin.
Listen for idle.state being set to 0 and if so, reset to the current timeout.
Diffstat (limited to 'plugins/glue/idle/ohm-plugin-idle.c')
-rw-r--r-- | plugins/glue/idle/ohm-plugin-idle.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/glue/idle/ohm-plugin-idle.c b/plugins/glue/idle/ohm-plugin-idle.c index 1571671..74aed96 100644 --- a/plugins/glue/idle/ohm-plugin-idle.c +++ b/plugins/glue/idle/ohm-plugin-idle.c @@ -30,6 +30,7 @@ static LibIdletime *idletime = NULL; enum { CONF_XORG_HASXAUTH_CHANGED, CONF_IDLE_TIMEOUT_CHANGED, + CONF_IDLE_STATE_CHANGED, CONF_LAST }; @@ -43,7 +44,7 @@ ohm_alarm_expired_cb (LibIdletime *idletime, guint alarm, gpointer data) /* activity, reset state to 0 */ ohm_plugin_conf_set_key (plugin, "idle.state", 0); } else { - ohm_plugin_conf_get_key (plugin, "idle.state", &tate); + ohm_plugin_conf_get_key (plugin, "idle.state", &state); ohm_plugin_conf_set_key (plugin, "idle.state", state+1); } g_print ("[evt %i]\n", alarm); @@ -70,7 +71,7 @@ plugin_connect_idletime (OhmPlugin *plugin) ohm_plugin_conf_set_key (plugin, "idle.state", 0); - ret = idletime_alarm_set (idletime, 1, momentary); + ret = idletime_alarm_set (idletime, 1, timeout); if (ret == FALSE) { g_error ("cannot set alarm"); } @@ -108,12 +109,18 @@ plugin_initalize (OhmPlugin *plugin) static void plugin_notify (OhmPlugin *plugin, gint id, gint value) { + gint timeout; if (id == CONF_XORG_HASXAUTH_CHANGED) { if (value == 1) { plugin_connect_idletime (plugin); } } else if (id == CONF_IDLE_TIMEOUT_CHANGED ) { idletime_alarm_set (idletime, 1, value); + } else if (id == CONF_IDLE_STATE_CHANGED ) { + if (value == 0) { + ohm_plugin_conf_get_key (plugin, "idle.timeout", &timeout); + idletime_alarm_set (idletime, 1, timeout); + } } } static void @@ -135,7 +142,9 @@ OHM_PLUGIN_DESCRIPTION ( OHM_PLUGIN_REQUIRES ("xorg"); -OHM_PLUGIN_PROVIDES ("idle.state", "idle.timeout"); +OHM_PLUGIN_PROVIDES ("idle.state"); -OHM_PLUGIN_INTERESTED ({"xorg.has_xauthority", CONF_XORG_HASXAUTH_CHANGED}); -OHM_PLUGIN_INTERESTED ({"idle.timeout", CONF_IDLE_TIMEOUT_CHANGED}); +OHM_PLUGIN_INTERESTED ( + {"xorg.has_xauthority", CONF_XORG_HASXAUTH_CHANGED}, + {"idle.timeout", CONF_IDLE_TIMEOUT_CHANGED}, + {"idle.state", CONF_IDLE_STATE_CHANGED}); |