[gnome-power-manager] Do not assume the lid is open at boot. Fixes #622026



commit df44925b580ff0aa4a4f0619f3d50987c939506d
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 22 09:13:29 2010 +0100

    Do not assume the lid is open at boot. Fixes #622026
    
    Inspired from a patch by David Tombs, many thanks.

 src/gpm-button.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/src/gpm-button.c b/src/gpm-button.c
index 3341b4c..4ea6dea 100644
--- a/src/gpm-button.c
+++ b/src/gpm-button.c
@@ -255,14 +255,8 @@ gpm_button_class_init (GpmButtonClass *klass)
 gboolean
 gpm_button_is_lid_closed (GpmButton *button)
 {
-	gboolean lid_is_closed;
-
 	g_return_val_if_fail (GPM_IS_BUTTON (button), FALSE);
-
-	g_object_get (button->priv->client,
-		      "lid-is-closed", &lid_is_closed,
-		      NULL);
-	return lid_is_closed;
+	return 	up_client_get_lid_is_closed (button->priv->client);
 }
 
 /**
@@ -288,9 +282,7 @@ gpm_button_client_changed_cb (UpClient *client, GpmButton *button)
 	gboolean lid_is_closed;
 
 	/* get new state */
-	g_object_get (client,
-		      "lid-is-closed", &lid_is_closed,
-		      NULL);
+	lid_is_closed = up_client_get_lid_is_closed (button->priv->client);
 
 	/* same state */
 	if (button->priv->lid_is_closed == lid_is_closed)
@@ -322,8 +314,8 @@ gpm_button_init (GpmButton *button)
 	button->priv->last_button = NULL;
 	button->priv->timer = g_timer_new ();
 
-	button->priv->lid_is_closed = FALSE;
 	button->priv->client = up_client_new ();
+	button->priv->lid_is_closed = up_client_get_lid_is_closed (button->priv->client);
 	g_signal_connect (button->priv->client, "changed",
 			  G_CALLBACK (gpm_button_client_changed_cb), button);
 



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