Index: natty/src/gs-monitor.c =================================================================== --- natty.orig/src/gs-monitor.c 2011-06-14 11:19:49.919943286 +0800 +++ natty/src/gs-monitor.c 2011-06-14 13:20:25.650555864 +0800 @@ -285,10 +285,6 @@ _gs_monitor_update_from_prefs (GSMonitor *monitor, GSPrefs *prefs) { - gboolean idle_detection_enabled; - gboolean idle_detection_active; - gboolean activate_watch; - gboolean manager_active; gboolean lock_enabled; gboolean user_switch_enabled; @@ -312,20 +308,19 @@ monitor->priv->prefs->idle_activation_enabled); /* idle detection always enabled */ - idle_detection_enabled = TRUE; - - gs_watcher_set_enabled (monitor->priv->watcher, idle_detection_enabled); - - /* in the case where idle detection is reenabled we may need to - activate the watcher too */ + if (gs_watcher_get_enabled (monitor->priv->watcher) != TRUE) { + gs_watcher_set_enabled (monitor->priv->watcher, TRUE); + } - manager_active = gs_manager_get_active (monitor->priv->manager); - idle_detection_active = gs_watcher_get_active (monitor->priv->watcher); - activate_watch = (! manager_active - && ! idle_detection_active - && idle_detection_enabled); - if (activate_watch) { - gs_watcher_set_active (monitor->priv->watcher, TRUE); + /* set watcher inactive when manager is active */ + if (gs_manager_get_active (monitor->priv->manager) == TRUE) { + if (gs_watcher_get_active (monitor->priv->watcher) != FALSE) { + gs_watcher_set_active (monitor->priv->watcher, FALSE); + } + } else { + if (gs_watcher_get_active (monitor->priv->watcher) != monitor->priv->prefs->idle_activation_enabled) { + gs_watcher_set_active (monitor->priv->watcher, monitor->priv->prefs->idle_activation_enabled); + } } if (monitor->priv->prefs->status_message_enabled) { Index: natty/src/gs-watcher-x11.c =================================================================== --- natty.orig/src/gs-watcher-x11.c 2011-06-14 11:19:49.989943395 +0800 +++ natty/src/gs-watcher-x11.c 2011-06-14 11:19:49.999943405 +0800 @@ -250,6 +250,10 @@ { watcher->priv->idle = FALSE; watcher->priv->idle_notice = FALSE; + if (watcher->priv->idle_id > 0) { + g_source_remove (watcher->priv->idle_id); + watcher->priv->idle_id = 0; + } } static gboolean @@ -358,6 +362,7 @@ /* queue an activation */ if (watcher->priv->idle_id > 0) { g_source_remove (watcher->priv->idle_id); + watcher->priv->idle_id = 0; } watcher->priv->idle_id = g_timeout_add (watcher->priv->delta_notice_timeout, (GSourceFunc)on_idle_timeout, @@ -366,6 +371,7 @@ /* cancel notice too */ if (watcher->priv->idle_id > 0) { g_source_remove (watcher->priv->idle_id); + watcher->priv->idle_id = 0; } res = _gs_watcher_set_session_idle (watcher, FALSE); res = _gs_watcher_set_session_idle_notice (watcher, FALSE);