[gnome-power-manager] Remove the hardware button integration, it's moved to gnome-settings-daemon



commit eb6b262ceb4657f63c0cf4f9c44db0cea44d951a
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jul 25 17:05:27 2011 +0100

    Remove the hardware button integration, it's moved to gnome-settings-daemon

 src/Makefile.am     |    2 -
 src/gpm-backlight.c |   30 -------
 src/gpm-button.c    |  219 ---------------------------------------------------
 src/gpm-button.h    |   62 --------------
 src/gpm-manager.c   |   82 -------------------
 5 files changed, 0 insertions(+), 395 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 61f78c4..34870d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,8 +84,6 @@ gnome_power_manager_SOURCES =				\
 	gpm-idle.c					\
 	gpm-control.h					\
 	gpm-control.c					\
-	gpm-button.h					\
-	gpm-button.c					\
 	gpm-main.c					\
 	gpm-manager.h					\
 	gpm-manager.c					\
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 6eefb39..a3fd21d 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -40,7 +40,6 @@
 #include <glib/gi18n.h>
 #include <libupower-glib/upower.h>
 
-#include "gpm-button.h"
 #include "gpm-backlight.h"
 #include "gpm-control.h"
 #include "gpm-common.h"
@@ -53,7 +52,6 @@
 struct GpmBacklightPrivate
 {
 	UpClient		*client;
-	GpmButton		*button;
 	GSettings		*settings;
 	GSettings		*settings_gsd;
 	GpmControl		*control;
@@ -307,24 +305,6 @@ gpm_backlight_client_changed_cb (UpClient *client, GpmBacklight *backlight)
 }
 
 /**
- * gpm_backlight_button_pressed_cb:
- * @power: The power class instance
- * @type: The button type, e.g. "power"
- * @state: The state, where TRUE is depressed or closed
- * @brightness: This class instance
- **/
-static void
-gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBacklight *backlight)
-{
-	g_debug ("Button press event type=%s", type);
-
-	if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) {
-		/* make sure we undim when we lift the lid */
-		gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
-	}
-}
-
-/**
  * gpm_backlight_notify_system_idle_changed:
  **/
 static gboolean
@@ -391,10 +371,6 @@ gpm_backlight_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *ba
 	gboolean is_active;
 	GError *error = NULL;
 
-	/* don't dim or undim the screen when the lid is closed */
-	if (gpm_button_is_lid_closed (backlight->priv->button))
-		return;
-
 	/* don't dim or undim the screen unless we are on the active console */
 	ret = egg_console_kit_is_active (backlight->priv->consolekit, &is_active, &error);
 	if (!ret) {
@@ -442,7 +418,6 @@ gpm_backlight_finalize (GObject *object)
 	g_object_unref (backlight->priv->settings);
 	g_object_unref (backlight->priv->settings_gsd);
 	g_object_unref (backlight->priv->client);
-	g_object_unref (backlight->priv->button);
 	g_object_unref (backlight->priv->idle);
 	g_object_unref (backlight->priv->consolekit);
 
@@ -492,11 +467,6 @@ gpm_backlight_init (GpmBacklight *backlight)
 	 * brightness so we can undim to the 'correct' value */
 	backlight->priv->master_percentage = g_settings_get_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC) * 100.0f;
 
-	/* watch for brightness up and down buttons and also check lid state */
-	backlight->priv->button = gpm_button_new ();
-	g_signal_connect (backlight->priv->button, "button-pressed",
-			  G_CALLBACK (gpm_backlight_button_pressed_cb), backlight);
-
 	/* watch for idle mode changes */
 	backlight->priv->idle = gpm_idle_new ();
 	g_signal_connect (backlight->priv->idle, "idle-changed",
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 7efafbf..3891231 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -41,7 +41,6 @@
 
 #include "egg-console-kit.h"
 
-#include "gpm-button.h"
 #include "gpm-control.h"
 #include "gpm-common.h"
 #include "gpm-idle.h"
@@ -63,7 +62,6 @@ static void     gpm_manager_finalize	(GObject	 *object);
 
 struct GpmManagerPrivate
 {
-	GpmButton		*button;
 	GSettings		*settings;
 	GSettings		*settings_gsd;
 	GpmIdle			*idle;
@@ -312,7 +310,6 @@ gpm_manager_action_suspend (GpmManager *manager, const gchar *reason)
 		gpm_manager_sleep_failure (manager, TRUE, error->message);
 		g_error_free (error);
 	}
-	gpm_button_reset_time (manager->priv->button);
 	return TRUE;
 }
 
@@ -335,7 +332,6 @@ gpm_manager_action_hibernate (GpmManager *manager, const gchar *reason)
 		gpm_manager_sleep_failure (manager, TRUE, error->message);
 		g_error_free (error);
 	}
-	gpm_button_reset_time (manager->priv->button);
 	return TRUE;
 }
 
@@ -527,16 +523,6 @@ gpm_manager_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manage
 		g_debug ("ignoring as not on active console");
 		return;
 	}
-
-	/* Ignore back-to-NORMAL events when the lid is closed, as the DPMS is
-	 * already off, and we don't want to re-enable the screen when the user
-	 * moves the mouse on systems that do not support hardware blanking. */
-	if (gpm_button_is_lid_closed (manager->priv->button) &&
-	    mode == GPM_IDLE_MODE_NORMAL) {
-		g_debug ("lid is closed, so we are ignoring ->NORMAL state changes");
-		return;
-	}
-
 	if (mode == GPM_IDLE_MODE_SLEEP) {
 		g_debug ("Idle state changed: SLEEP");
 		if (gpm_manager_is_inhibit_valid (manager, FALSE, "timeout action") == FALSE)
@@ -545,19 +531,6 @@ gpm_manager_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manage
 	}
 }
 
-/**
- * gpm_manager_lid_button_pressed:
- * @manager: This class instance
- * @state: TRUE for closed
- *
- * Does actions when the lid is closed, depending on if we are on AC or
- * battery power.
- **/
-static void
-gpm_manager_lid_button_pressed (GpmManager *manager, gboolean pressed)
-{
-}
-
 static void
 gpm_manager_update_ac_throttle (GpmManager *manager)
 {
@@ -577,56 +550,6 @@ gpm_manager_update_ac_throttle (GpmManager *manager)
 	}
 }
 
-static void
-gpm_manager_update_lid_throttle (GpmManager *manager, gboolean lid_is_closed)
-{
-	/* Throttle the screensaver when the lid is close since we can't see it anyway
-	   and it may overheat the laptop */
-	if (lid_is_closed == FALSE) {
-		if (manager->priv->screensaver_lid_throttle_id != 0) {
-			gpm_screensaver_remove_throttle (manager->priv->screensaver, manager->priv->screensaver_lid_throttle_id);
-			manager->priv->screensaver_lid_throttle_id = 0;
-		}
-	} else {
-		/* if throttle already exists then remove */
-		if (manager->priv->screensaver_lid_throttle_id != 0)
-			gpm_screensaver_remove_throttle (manager->priv->screensaver, manager->priv->screensaver_lid_throttle_id);
-		manager->priv->screensaver_lid_throttle_id = gpm_screensaver_add_throttle (manager->priv->screensaver, _("Laptop lid is closed"));
-	}
-}
-
-/**
- * gpm_manager_button_pressed_cb:
- * @power: The power class instance
- * @type: The button type, e.g. "power"
- * @state: The state, where TRUE is depressed or closed
- * @manager: This class instance
- **/
-static void
-gpm_manager_button_pressed_cb (GpmButton *button, const gchar *type, GpmManager *manager)
-{
-	g_debug ("Button press event type=%s", type);
-
-	/* ConsoleKit says we are not on active console */
-	if (!gpm_manager_is_active (manager)) {
-		g_debug ("ignoring as not on active console");
-		return;
-	}
-
-	if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) {
-		gpm_manager_lid_button_pressed (manager, FALSE);
-	} else if (g_strcmp0 (type, GPM_BUTTON_LID_CLOSED) == 0) {
-		gpm_manager_lid_button_pressed (manager, TRUE);
-	}
-
-	/* disable or enable the fancy screensaver, as we don't want
-	 * this starting when the lid is shut */
-	if (g_strcmp0 (type, GPM_BUTTON_LID_CLOSED) == 0)
-		gpm_manager_update_lid_throttle (manager, TRUE);
-	else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0)
-		gpm_manager_update_lid_throttle (manager, FALSE);
-}
-
 /**
  * gpm_manager_client_changed_cb:
  **/
@@ -885,10 +808,6 @@ gpm_manager_init (GpmManager *manager)
 		      "on-battery", &manager->priv->on_battery,
 		      NULL);
 
-	manager->priv->button = gpm_button_new ();
-	g_signal_connect (manager->priv->button, "button-pressed",
-			  G_CALLBACK (gpm_manager_button_pressed_cb), manager);
-
 	/* try and start an interactive service */
 	manager->priv->screensaver = gpm_screensaver_new ();
 
@@ -1037,7 +956,6 @@ gpm_manager_finalize (GObject *object)
 	g_object_unref (manager->priv->idle);
 	g_object_unref (manager->priv->screensaver);
 	g_object_unref (manager->priv->control);
-	g_object_unref (manager->priv->button);
 	g_object_unref (manager->priv->backlight);
 	g_object_unref (manager->priv->console);
 	g_object_unref (manager->priv->client);



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