gnome-power-manager r3122 - in trunk: . libdevkit-power src



Author: rhughes
Date: Wed Dec  3 09:27:04 2008
New Revision: 3122
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3122&view=rev

Log:
2008-12-03  Richard Hughes  <richard hughsie com>

* libdevkit-power/dkp-client.c: (dkp_client_suspend),
(dkp_client_hibernate):
* libdevkit-power/dkp-client.h:
Add suspend and hibernate helpers.

* src/egg-console-kit.c: (egg_console_kit_restart),
(egg_console_kit_stop):
* src/egg-console-kit.h:
Add stop and restart helpers.

* src/gpm-control.c: (gpm_control_allowed_suspend),
(gpm_control_allowed_hibernate), (gpm_control_convert_hal_error),
(gpm_control_shutdown), (gpm_control_get_lock_policy),
(gpm_control_suspend), (gpm_control_hibernate),
(gpm_control_finalize), (gpm_control_init):
Convert from HAL to DeviceKit and ConsoleKit.

* src/gpm-load.c:
Remove un-needed defines.

* src/gpm-manager.c: (gpm_manager_sync_policy_sleep),
(gpm_manager_action_suspend), (gpm_manager_action_hibernate),
(gpm_manager_suspend), (gpm_manager_hibernate),
(screensaver_auth_request_cb):
Don't include the HAL code if we compiled without HAL.


Modified:
   trunk/ChangeLog
   trunk/libdevkit-power/dkp-client.c
   trunk/libdevkit-power/dkp-client.h
   trunk/src/egg-console-kit.c
   trunk/src/egg-console-kit.h
   trunk/src/gpm-control.c
   trunk/src/gpm-load.c
   trunk/src/gpm-manager.c

Modified: trunk/libdevkit-power/dkp-client.c
==============================================================================
--- trunk/libdevkit-power/dkp-client.c	(original)
+++ trunk/libdevkit-power/dkp-client.c	Wed Dec  3 09:27:04 2008
@@ -44,13 +44,13 @@
 	GHashTable		*hash;
 	GPtrArray		*array;
 
-	gboolean have_properties;
+	gboolean		 have_properties;
 
-	char *daemon_version;
-	gboolean can_suspend;
-	gboolean can_hibernate;
-	gboolean on_battery;
-	gboolean on_low_battery;
+	gchar			*daemon_version;
+	gboolean		 can_suspend;
+	gboolean		 can_hibernate;
+	gboolean		 on_battery;
+	gboolean		 on_low_battery;
 };
 
 enum {
@@ -101,7 +101,7 @@
 /**
  * dkp_client_enumerate_devices_private:
  **/
-GPtrArray *
+static GPtrArray *
 dkp_client_enumerate_devices_private (DkpClient *client, GError **error)
 {
 	gboolean ret;
@@ -124,6 +124,52 @@
 }
 
 /**
+ * dkp_client_suspend:
+ **/
+gboolean
+dkp_client_suspend (DkpClient *client, GError **error)
+{
+	gboolean ret;
+	GError *error_local = NULL;
+
+	g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv->proxy != NULL, FALSE);
+
+	ret = dbus_g_proxy_call (client->priv->proxy, "Suspend", &error_local,
+				 G_TYPE_INVALID, G_TYPE_INVALID);
+	if (!ret) {
+		egg_warning ("Couldn't suspend: %s", error_local->message);
+		if (error != NULL)
+			*error = g_error_new (1, 0, "%s", error_local->message);
+		g_error_free (error_local);
+	}
+	return ret;
+}
+
+/**
+ * dkp_client_hibernate:
+ **/
+gboolean
+dkp_client_hibernate (DkpClient *client, GError **error)
+{
+	gboolean ret;
+	GError *error_local = NULL;
+
+	g_return_val_if_fail (DKP_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv->proxy != NULL, FALSE);
+
+	ret = dbus_g_proxy_call (client->priv->proxy, "Hibernate", &error_local,
+				 G_TYPE_INVALID, G_TYPE_INVALID);
+	if (!ret) {
+		egg_warning ("Couldn't hibernate: %s", error_local->message);
+		if (error != NULL)
+			*error = g_error_new (1, 0, "%s", error_local->message);
+		g_error_free (error_local);
+	}
+	return ret;
+}
+
+/**
  * dkp_client_ensure_properties:
  **/
 static void

Modified: trunk/libdevkit-power/dkp-client.h
==============================================================================
--- trunk/libdevkit-power/dkp-client.h	(original)
+++ trunk/libdevkit-power/dkp-client.h	Wed Dec  3 09:27:04 2008
@@ -60,6 +60,10 @@
 GType		 dkp_client_get_type			(void) G_GNUC_CONST;
 DkpClient	*dkp_client_new				(void);
 GPtrArray	*dkp_client_enumerate_devices		(DkpClient		*client);
+gboolean	 dkp_client_suspend			(DkpClient		*client,
+							 GError			**error);
+gboolean	 dkp_client_hibernate			(DkpClient		*client,
+							 GError			**error);
 const gchar	*dkp_client_get_daemon_version		(DkpClient		*client);
 gboolean	 dkp_client_can_hibernate		(DkpClient		*client);
 gboolean	 dkp_client_can_suspend			(DkpClient		*client);

Modified: trunk/src/egg-console-kit.c
==============================================================================
--- trunk/src/egg-console-kit.c	(original)
+++ trunk/src/egg-console-kit.c	Wed Dec  3 09:27:04 2008
@@ -63,6 +63,52 @@
 G_DEFINE_TYPE (EggConsoleKit, egg_console_kit, G_TYPE_OBJECT)
 
 /**
+ * egg_console_kit_restart:
+ **/
+gboolean
+egg_console_kit_restart (EggConsoleKit *console, GError **error)
+{
+	gboolean ret;
+	GError *error_local = NULL;
+
+	g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE);
+	g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE);
+
+	ret = dbus_g_proxy_call (console->priv->proxy_manager, "Restart", &error_local,
+				 G_TYPE_INVALID, G_TYPE_INVALID);
+	if (!ret) {
+		egg_warning ("Couldn't restart: %s", error_local->message);
+		if (error != NULL)
+			*error = g_error_new (1, 0, "%s", error_local->message);
+		g_error_free (error_local);
+	}
+	return ret;
+}
+
+/**
+ * egg_console_kit_stop:
+ **/
+gboolean
+egg_console_kit_stop (EggConsoleKit *console, GError **error)
+{
+	gboolean ret;
+	GError *error_local = NULL;
+
+	g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE);
+	g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE);
+
+	ret = dbus_g_proxy_call (console->priv->proxy_manager, "Stop", &error_local,
+				 G_TYPE_INVALID, G_TYPE_INVALID);
+	if (!ret) {
+		egg_warning ("Couldn't stop: %s", error_local->message);
+		if (error != NULL)
+			*error = g_error_new (1, 0, "%s", error_local->message);
+		g_error_free (error_local);
+	}
+	return ret;
+}
+
+/**
  * egg_console_kit_is_local:
  *
  * Return value: Returns whether the session is local

Modified: trunk/src/egg-console-kit.h
==============================================================================
--- trunk/src/egg-console-kit.h	(original)
+++ trunk/src/egg-console-kit.h	Wed Dec  3 09:27:04 2008
@@ -54,6 +54,10 @@
 EggConsoleKit	*egg_console_kit_new			(void);
 gboolean	 egg_console_kit_is_local		(EggConsoleKit	*console);
 gboolean	 egg_console_kit_is_active		(EggConsoleKit	*console);
+gboolean	 egg_console_kit_stop			(EggConsoleKit	*console,
+							 GError		**error);
+gboolean	 egg_console_kit_restart		(EggConsoleKit	*console,
+							 GError		**error);
 
 G_END_DECLS
 

Modified: trunk/src/gpm-control.c
==============================================================================
--- trunk/src/gpm-control.c	(original)
+++ trunk/src/gpm-control.c	Wed Dec  3 09:27:04 2008
@@ -42,16 +42,22 @@
 #include <gnome-keyring.h>
 #include <gconf/gconf-client.h>
 
-#include <hal-device-power.h>
+#ifdef HAVE_DK_POWER
+ #include <dkp-client.h>
+#else
+ #include <hal-device-power.h>
+#endif
 
 #ifdef HAVE_POLKIT
 #include <polkit/polkit.h>
 #include <polkit-dbus/polkit-dbus.h>
 #endif
 
+#include "egg-debug.h"
+#include "egg-console-kit.h"
+
 #include "gpm-screensaver.h"
 #include "gpm-common.h"
-#include "egg-debug.h"
 #include "gpm-control.h"
 #include "gpm-networkmanager.h"
 
@@ -60,7 +66,11 @@
 struct GpmControlPrivate
 {
 	GConfClient		*conf;
+#ifdef HAVE_DK_POWER
+	DkpClient		*client;
+#else
 	HalDevicePower		*hal_device_power;
+#endif
 };
 
 enum {
@@ -151,26 +161,27 @@
  * @control: This class instance
  * @can: If we can suspend
  *
- * Checks the HAL key power_management.can_suspend_to_ram and also
  * checks gconf to see if we are allowed to suspend this computer.
  **/
 gboolean
-gpm_control_allowed_suspend (GpmControl *control,
-			     gboolean   *can,
-			     GError    **error)
+gpm_control_allowed_suspend (GpmControl *control, gboolean *can, GError **error)
 {
 	gboolean conf_ok;
 	gboolean polkit_ok = TRUE;
-	gboolean hal_ok = FALSE;
+	gboolean hardware_ok = FALSE;
 	gboolean fg;
 	g_return_val_if_fail (can, FALSE);
 
 	*can = FALSE;
 	conf_ok = gconf_client_get_bool (control->priv->conf, GPM_CONF_CAN_SUSPEND, NULL);
-	hal_ok = hal_device_power_can_suspend (control->priv->hal_device_power);
+#ifdef HAVE_DK_POWER
+	polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.devicekit.power.suspend");
+#else
+	hardware_ok = hal_device_power_can_suspend (control->priv->hal_device_power);
 	polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.hal.power-management.suspend");
+#endif
 	fg = gpm_control_check_foreground_console (control);
-	if (conf_ok && hal_ok && polkit_ok && fg)
+	if (conf_ok && hardware_ok && polkit_ok && fg)
 		*can = TRUE;
 	return TRUE;
 }
@@ -184,30 +195,32 @@
  * checks gconf to see if we are allowed to hibernate this computer.
  **/
 gboolean
-gpm_control_allowed_hibernate (GpmControl *control,
-			       gboolean   *can,
-			       GError    **error)
+gpm_control_allowed_hibernate (GpmControl *control, gboolean *can, GError **error)
 {
 	gboolean conf_ok;
 	gboolean polkit_ok = TRUE;
-	gboolean hal_ok = FALSE;
+	gboolean hardware_ok = FALSE;
 	gboolean fg;
 	g_return_val_if_fail (can, FALSE);
 
 	*can = FALSE;
 	conf_ok = gconf_client_get_bool (control->priv->conf, GPM_CONF_CAN_HIBERNATE, NULL);
-	hal_ok = hal_device_power_can_hibernate (control->priv->hal_device_power);
 	fg = gpm_control_check_foreground_console (control);
+#ifdef HAVE_DK_POWER
+	polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.devicekit.power.hibernate");
+#else
+	hardware_ok = hal_device_power_can_hibernate (control->priv->hal_device_power);
 	polkit_ok = gpm_control_is_user_privileged (control, "org.freedesktop.hal.power-management.hibernate");
-	if (conf_ok && hal_ok && polkit_ok && fg)
+#endif
+	if (conf_ok && hardware_ok && polkit_ok && fg)
 		*can = TRUE;
 	return TRUE;
 }
 
+#ifndef HAVE_DK_POWER
 /* convert the HAL error to a local error */
 static void
-gpm_control_convert_hal_error (GpmControl *control,
-			       GError    **error)
+gpm_control_convert_hal_error (GpmControl *control, GError **error)
 {
 	gint code;
 	gchar *message;
@@ -234,33 +247,29 @@
 	}
 	g_free (message);
 }
+#endif
 
 /**
  * gpm_control_shutdown:
  * @control: This class instance
  *
- * Shuts down the computer, saving the session if possible.
+ * Shuts down the computer
  **/
 gboolean
 gpm_control_shutdown (GpmControl *control, GError **error)
 {
 	gboolean ret;
-	gboolean save_session;
-
-	save_session = gconf_client_get_bool (control->priv->conf, GPM_CONF_SESSION_REQUEST_SAVE, NULL);
-	/* We can set g-p-m to not save the session to avoid confusing new
-	   users. By default we save the session to preserve data. */
-	if (save_session) {
-#if 0
-		gnome_client_request_save (gnome_master_client (),
-					   GNOME_SAVE_GLOBAL,
-					   FALSE, GNOME_INTERACT_NONE, FALSE,  TRUE);
-#endif
-	}
 
+#ifdef HAVE_DK_POWER
+	EggConsoleKit *console;
+	console = egg_console_kit_new ();
+	ret = egg_console_kit_stop (console, error);
+	g_object_unref (console);
+#else
 	ret = hal_device_power_shutdown (control->priv->hal_device_power, error);
 	if (!ret)
 		gpm_control_convert_hal_error (control, error);
+#endif
 
 	return ret;
 }
@@ -277,8 +286,7 @@
  * Return value: TRUE if we should lock.
  **/
 gboolean
-gpm_control_get_lock_policy (GpmControl  *control,
-			     const gchar *policy)
+gpm_control_get_lock_policy (GpmControl *control, const gchar *policy)
 {
 	gboolean do_lock;
 	gboolean use_ss_setting;
@@ -296,9 +304,11 @@
 	return do_lock;
 }
 
+/**
+ * gpm_control_suspend:
+ **/
 gboolean
-gpm_control_suspend (GpmControl *control,
-		     GError    **error)
+gpm_control_suspend (GpmControl *control, GError **error)
 {
 	gboolean allowed;
 	gboolean ret;
@@ -341,9 +351,13 @@
 	egg_debug ("emitting sleep");
 	g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_SUSPEND);
 
+#ifdef HAVE_DK_POWER
+	ret = dkp_client_suspend (control->priv->client, error);
+#else
 	ret = hal_device_power_suspend (control->priv->hal_device_power, 0, error);
 	if (!ret)
 		gpm_control_convert_hal_error (control, error);
+#endif
 
 	egg_debug ("emitting resume");
 	g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_SUSPEND);
@@ -365,9 +379,11 @@
 	return ret;
 }
 
+/**
+ * gpm_control_hibernate:
+ **/
 gboolean
-gpm_control_hibernate (GpmControl *control,
-		       GError    **error)
+gpm_control_hibernate (GpmControl *control, GError **error)
 {
 	gboolean allowed;
 	gboolean ret;
@@ -411,9 +427,13 @@
 	egg_debug ("emitting sleep");
 	g_signal_emit (control, signals [SLEEP], 0, GPM_CONTROL_ACTION_HIBERNATE);
 
+#ifdef HAVE_DK_POWER
+	ret = dkp_client_hibernate (control->priv->client, error);
+#else
 	ret = hal_device_power_hibernate (control->priv->hal_device_power, error);
 	if (!ret)
 		gpm_control_convert_hal_error (control, error);
+#endif
 
 	egg_debug ("emitting resume");
 	g_signal_emit (control, signals [RESUME], 0, GPM_CONTROL_ACTION_HIBERNATE);
@@ -448,7 +468,11 @@
 	control = GPM_CONTROL (object);
 
 	g_object_unref (control->priv->conf);
+#ifdef HAVE_DK_POWER
+	g_object_unref (control->priv->client);
+#else
 	g_object_unref (control->priv->hal_device_power);
+#endif
 
 	g_return_if_fail (control->priv != NULL);
 	G_OBJECT_CLASS (gpm_control_parent_class)->finalize (object);
@@ -512,7 +536,11 @@
 {
 	control->priv = GPM_CONTROL_GET_PRIVATE (control);
 
+#ifdef HAVE_DK_POWER
+	control->priv->client = dkp_client_new ();
+#else
 	control->priv->hal_device_power = hal_device_power_new ();
+#endif
 	control->priv->conf = gconf_client_get_default ();
 }
 

Modified: trunk/src/gpm-load.c
==============================================================================
--- trunk/src/gpm-load.c	(original)
+++ trunk/src/gpm-load.c	Wed Dec  3 09:27:04 2008
@@ -39,11 +39,6 @@
 
 #include <glib/gi18n.h>
 
-#include <hal-device-power.h>
-#include <hal-device.h>
-#include <hal-device-store.h>
-#include <hal-manager.h>
-
 #include "gpm-common.h"
 #include "gpm-prefs.h"
 #include "gpm-marshal.h"

Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c	(original)
+++ trunk/src/gpm-manager.c	Wed Dec  3 09:27:04 2008
@@ -43,11 +43,11 @@
 
 #ifdef HAVE_DK_POWER
  #include <dkp-device.h>
+#else
+ #include <hal-device-power.h>
+ #include <hal-manager.h>
 #endif
 
-#include <hal-device-power.h>
-#include <hal-manager.h>
-
 #include "egg-debug.h"
 #include "egg-console-kit.h"
 
@@ -104,7 +104,6 @@
 	GpmScreensaver 		*screensaver;
 	GpmTrayIcon		*tray_icon;
 	GpmEngine		*engine;
-	HalDevicePower		*hal_device_power;
 	gboolean		 low_power;
 	GpmBrightnessKbd	*brightness_kbd;
 	GpmFeedback		*feedback_kbd;
@@ -324,8 +323,6 @@
 		power_save = gconf_client_get_bool (manager->priv->conf, GPM_CONF_LOWPOWER_BATT, NULL);
 	}
 
-	hal_device_power_enable_power_save (manager->priv->hal_device_power, power_save);
-
 	/* set the new sleep (inactivity) value */
 	gpm_idle_set_system_timeout (manager->priv->idle, sleep_computer);
 }
@@ -414,19 +411,6 @@
 		return FALSE;
 	}
 
-	/* check if computer able to do action */
-	allowed = hal_device_power_can_suspend (manager->priv->hal_device_power);
-	if (allowed == FALSE) {
-		/* error msg as disabled in HAL */
-		gpm_notify_display (manager->priv->notify,
-				    _("Action forbidden"),
-				    _("Suspend is not available on this computer."),
-				    GPM_NOTIFY_TIMEOUT_SHORT,
-				    GPM_STOCK_APP_ICON,
-				    GPM_NOTIFY_URGENCY_NORMAL);
-		return FALSE;
-	}
-
 	/* check to see if we are inhibited */
 	if (gpm_manager_is_inhibit_valid (manager, FALSE, "suspend") == FALSE)
 		return FALSE;
@@ -461,19 +445,6 @@
 		return FALSE;
 	}
 
-	/* check if computer able to do action */
-	allowed = hal_device_power_can_hibernate (manager->priv->hal_device_power);
-	if (allowed == FALSE) {
-		/* error msg as disabled in HAL */
-		gpm_notify_display (manager->priv->notify,
-				    _("Action forbidden"),
-				    _("Hibernate is not available on this computer."),
-				    GPM_NOTIFY_TIMEOUT_SHORT,
-				    GPM_STOCK_APP_ICON,
-				    GPM_NOTIFY_URGENCY_NORMAL);
-		return FALSE;
-	}
-
 	/* check to see if we are inhibited */
 	if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
 		return FALSE;
@@ -582,13 +553,6 @@
 		return FALSE;
 	}
 
-	/* check if computer able to do action */
-	allowed = hal_device_power_can_suspend (manager->priv->hal_device_power);
-	if (allowed == FALSE) {
-		g_set_error (error, GPM_MANAGER_ERROR, GPM_MANAGER_ERROR_NO_HW, "Suspend is not available on this computer");
-		return FALSE;
-	}
-
 	/* check to see if we are inhibited */
 	if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
 		return FALSE;
@@ -616,13 +580,6 @@
 		return FALSE;
 	}
 
-	/* check if computer able to do action */
-	allowed = hal_device_power_can_hibernate (manager->priv->hal_device_power);
-	if (allowed == FALSE) {
-		g_set_error (error, GPM_MANAGER_ERROR, GPM_MANAGER_ERROR_NO_HW, "Hibernate is not available on this computer");
-		return FALSE;
-	}
-
 	/* check to see if we are inhibited */
 	if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
 		return FALSE;
@@ -1188,27 +1145,6 @@
 }
 
 /**
- * gpm_manager_check_sleep_errors:
- * @manager: This class instance
- *
- * Checks HAL for resume failures
- **/
-static void
-gpm_manager_check_sleep_errors (GpmManager *manager)
-{
-	gboolean suspend_error;
-	gboolean hibernate_error;
-
-	hal_device_power_has_suspend_error (manager->priv->hal_device_power, &suspend_error);
-	hal_device_power_has_hibernate_error (manager->priv->hal_device_power, &hibernate_error);
-
-	if (suspend_error)
-		gpm_notify_sleep_failed (manager->priv->notify, FALSE);
-	if (hibernate_error)
-		gpm_notify_sleep_failed (manager->priv->notify, TRUE);
-}
-
-/**
  * screensaver_auth_request_cb:
  * @manager: This manager class instance
  * @auth: If we are trying to authenticate
@@ -1219,23 +1155,6 @@
 screensaver_auth_request_cb (GpmScreensaver *screensaver, gboolean auth_begin, GpmManager *manager)
 {
 	GError *error = NULL;
-	gboolean ret;
-	/* only clear errors if we have finished the authentication */
-	if (!auth_begin) {
-		ret = hal_device_power_clear_suspend_error (manager->priv->hal_device_power, &error);
-		if (!ret) {
-			egg_debug ("Failed to clear suspend error; %s", error->message);
-			g_error_free (error);
-			error = NULL;
-		}
-		error = NULL;
-		ret = hal_device_power_clear_hibernate_error (manager->priv->hal_device_power, &error);
-		if (!ret) {
-			egg_debug ("Failed to clear hibernate error; %s", error->message);
-			g_error_free (error);
-			error = NULL;
-		}
-	}
 
 	if (auth_begin) {
 		/* TODO: This may be a bid of a bodge, as we will have multiple
@@ -1255,22 +1174,6 @@
 }
 
 /**
- * gpm_manager_at_exit:
- *
- * Called when we are exiting. We should remove the errors if any
- * exist so we don't get them again on next boot.
- **/
-static void
-gpm_manager_at_exit (void)
-{
-	/* we can't use manager as g_atexit has no userdata */
-	HalDevicePower *hal_device_power = hal_device_power_new ();
-	hal_device_power_clear_suspend_error (hal_device_power, NULL);
-	hal_device_power_clear_hibernate_error (hal_device_power, NULL);
-	g_object_unref (hal_device_power);
-}
-
-/**
  * gpm_manager_perhaps_recall:
  */
 static gboolean
@@ -1758,8 +1661,10 @@
 static void
 has_inhibit_changed_cb (GpmInhibit *inhibit, gboolean has_inhibit, GpmManager *manager)
 {
+#ifndef HAVE_DK_POWER
 	HalManager *hal_manager;
-	gboolean is_laptop;
+#endif
+	gboolean is_laptop = FALSE;
 	gboolean show_inhibit_lid;
 	gchar *action = NULL;
 
@@ -1774,9 +1679,11 @@
 	if (show_inhibit_lid == FALSE)
 		return;
 
+#ifndef HAVE_DK_POWER
 	hal_manager = hal_manager_new ();
 	is_laptop = hal_manager_is_laptop (hal_manager);
 	g_object_unref (hal_manager);
+#endif
 
 	/* we don't warn for desktops, as they do not have a lid... */
 	if (is_laptop == FALSE)
@@ -1784,7 +1691,6 @@
 
 	/* get the policy action for battery */
 	action = gconf_client_get_string (manager->priv->conf, GPM_CONF_BUTTON_LID_BATT, NULL);
-
 	if (action == NULL)
 		return;
 
@@ -1869,9 +1775,6 @@
 	manager->priv->screensaver_dpms_throttle_id = 0;
 	manager->priv->screensaver_lid_throttle_id = 0;
 
-	/* do some actions even when killed */
-	g_atexit (gpm_manager_at_exit);
-
 	/* don't apply policy when not active */
 	manager->priv->console = egg_console_kit_new ();
 	g_signal_connect (manager->priv->console, "active-changed",
@@ -1919,8 +1822,6 @@
 	g_signal_connect (manager->priv->button, "button-pressed",
 			  G_CALLBACK (button_pressed_cb), manager);
 
-	manager->priv->hal_device_power = hal_device_power_new ();
-
 	/* try and start an interactive service */
 	manager->priv->screensaver = gpm_screensaver_new ();
 	g_signal_connect (manager->priv->screensaver, "auth-request",
@@ -1983,9 +1884,6 @@
 
 	gpm_manager_sync_policy_sleep (manager);
 
-	/* on startup, check if there are suspend errors left */
-	gpm_manager_check_sleep_errors (manager);
-
 	manager->priv->engine = gpm_engine_new ();
 	g_signal_connect (manager->priv->engine, "perhaps-recall",
 			  G_CALLBACK (gpm_engine_perhaps_recall_cb), manager);
@@ -2035,7 +1933,6 @@
 	g_return_if_fail (manager->priv != NULL);
 
 	g_object_unref (manager->priv->conf);
-	g_object_unref (manager->priv->hal_device_power);
 	g_object_unref (manager->priv->dpms);
 	g_object_unref (manager->priv->idle);
 	g_object_unref (manager->priv->engine);



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