[gnome-settings-daemon: 3/3] Merge branch 'docking-stations'



commit 10a7652acae666d2a3fa546e100024842fee63da
Merge: 5f76438 76043da
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jun 5 06:52:23 2012 -0500

    Merge branch 'docking-stations'

 plugins/power/gsd-power-manager.c |   56 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)
---
diff --cc plugins/power/gsd-power-manager.c
index f9daeb5,5263c61..7c0d75e
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@@ -2261,21 -2265,75 +2266,63 @@@ is_on (GnomeRROutput *output
  static gboolean
  non_laptop_outputs_are_all_off (GnomeRRScreen *screen)
  {
 -        GnomeRRConfig *config;
 -        GnomeRROutputInfo **outputs;
 +        GnomeRROutput **outputs;
          int i;
 -        gboolean all_off;
 -
 -        config = gnome_rr_config_new_current (screen, NULL); /* NULL-GError */
 -        if (!config)
 -                return FALSE;
  
 -        outputs = gnome_rr_config_get_outputs (config);
 +        outputs = gnome_rr_screen_list_outputs (screen);
          for (i = 0; outputs[i] != NULL; i++) {
 -                if (is_laptop (screen, outputs[i]))
 +                if (gnome_rr_output_is_laptop (outputs[i]))
                          continue;
  
 -                if (gnome_rr_output_info_is_active (outputs[i])) {
 -                        all_off = FALSE;
 -                        goto out;
 -                }
 +                if (is_on (outputs[i]))
 +                        return FALSE;
          }
  
 -        all_off = TRUE;
 -
 -out:
 -        g_object_unref (config);
 -        return all_off;
 +        return TRUE;
  }
  
+ /* Timeout callback used to check conditions when the laptop's lid is closed but
+  * the machine is not suspended yet.  We try to suspend again, so that the laptop
+  * won't overheat if placed in a backpack.
+  */
+ static gboolean
+ lid_close_safety_timer_cb (GsdPowerManager *manager)
+ {
+         GsdPowerActionType action_type;
+ 
+         manager->priv->lid_close_safety_timer_id = 0;
+ 
+         g_debug ("lid has been closed for a while; trying to suspend again");
+         do_lid_closed_action (manager);
+ 
+         return FALSE;
+ }
+ 
+ /* Sets up a timer to be triggered some seconds after closing the laptop lid
+  * when the laptop is *not* suspended for some reason.  We'll check conditions
+  * again in the timeout handler to see if we can suspend then.
+  */
+ static void
+ setup_lid_close_safety_timer (GsdPowerManager *manager)
+ {
+         if (manager->priv->lid_close_safety_timer_id != 0)
+                 return;
+ 
+         manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT,
+                                                                           (GSourceFunc) lid_close_safety_timer_cb,
+                                                                           manager);
+         g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer");
+ }
+ 
+ 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)
  {



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