[gnome-settings-daemon: 2/3] power: End the lid-close safety timer when the lid gets open



commit 76043da88ee7fd6332b4280503409be51a00833e
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jun 5 06:52:05 2012 -0500

    power: End the lid-close safety timer when the lid gets open
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 plugins/power/gsd-power-manager.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 707550b..5263c61 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -216,6 +216,7 @@ static gchar    *engine_get_summary (GsdPowerManager *manager);
 static void      do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type);
 static void      do_lid_closed_action (GsdPowerManager *manager);
 static void      lock_screensaver (GsdPowerManager *manager);
+static void      kill_lid_close_safety_timer (GsdPowerManager *manager);
 
 G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT)
 
@@ -2248,6 +2249,7 @@ do_lid_open_action (GsdPowerManager *manager)
                 }
         }
 
+        kill_lid_close_safety_timer (manager);
 }
 
 static gboolean
@@ -2324,6 +2326,15 @@ setup_lid_close_safety_timer (GsdPowerManager *manager)
 }
 
 static void
+kill_lid_close_safety_timer (GsdPowerManager *manager)
+{
+        if (manager->priv->lid_close_safety_timer_id != 0) {
+                g_source_remove (manager->priv->lid_close_safety_timer_id);
+                manager->priv->lid_close_safety_timer_id = 0;
+        }
+}
+
+static void
 do_lid_closed_action (GsdPowerManager *manager)
 {
         gboolean ret;
@@ -3879,10 +3890,7 @@ gsd_power_manager_stop (GsdPowerManager *manager)
                 manager->priv->timeout_sleep_id = 0;
         }
 
-        if (manager->priv->lid_close_safety_timer_id != 0) {
-                g_source_remove (manager->priv->lid_close_safety_timer_id);
-                manager->priv->lid_close_safety_timer_id = 0;
-        }
+        kill_lid_close_safety_timer (manager);
 
         g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager);
 



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