--- gnome-session-2.32.1/configure.ac.~1~ 2015-01-13 11:45:25.426788854 +0300 +++ gnome-session-2.32.1/configure.ac 2015-01-13 11:45:34.214461074 +0300 @@ -70,7 +70,6 @@ gio-2.0 >= $GLIB_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED - upower-glib >= $UPOWER_REQUIRED ) PKG_CHECK_MODULES(SESSION_PROPERTIES, diff -uprN gnome-session-2.27.5/gnome-session/Makefile.am gnome-session-2.27.5-new/gnome-session/Makefile.am --- gnome-session-2.27.5/gnome-session/Makefile.am 2009-07-29 09:51:22.000000000 +0800 +++ gnome-session-2.27.5-new/gnome-session/Makefile.am 2009-07-31 13:47:56.974952168 +0800 @@ -75,6 +76,8 @@ gnome_session_SOURCES = \ gsm-logout-dialog.c \ gsm-inhibit-dialog.h \ gsm-inhibit-dialog.c \ + gsm-power-manager.h \ + gsm-power-manager.c \ gs-idle-monitor.h \ gs-idle-monitor.c \ gsm-presence.h \ diff -uprN gnome-session-2.27.5/gnome-session/gsm-power-manager.c gnome-session-2.27.5-new/gnome-session/gsm-power-manager.c --- gnome-session-2.27.5/gnome-session/gsm-power-manager.c 1970-01-01 08:00:00.000000000 +0800 +++ gnome-session-2.27.5-new/gnome-session/gsm-power-manager.c 2009-07-31 13:47:56.972276386 +0800 @@ -0,0 +1,573 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * power-manager.h: functions for powering down, restarting, and + * suspending the computer + * Copyright (C) 2006 Ray Strode + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gsm-power-manager.h" + +#include +#include + +#include +#include +#include + +#include + +struct _GsmPowerManagerPrivate +{ + DBusGConnection *dbus_connection; + DBusGProxy *bus_proxy; + DBusGProxy *gpm_proxy; + guint32 is_connected : 1; +}; + +static void gsm_power_manager_finalize (GObject *object); + +static void gsm_power_manager_class_install_signals (GsmPowerManagerClass *manager_class); + +static void gsm_power_manager_class_install_properties (GsmPowerManagerClass *manager_class); + +static void gsm_power_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +static gboolean ensure_gpm_connection (GsmPowerManager *manager, + GError **error); + +enum { + PROP_0 = 0, + PROP_IS_CONNECTED +}; + +enum { + REQUEST_FAILED = 0, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL]; + +G_DEFINE_TYPE (GsmPowerManager, gsm_power_manager, G_TYPE_OBJECT); + +static void +gsm_power_manager_class_init (GsmPowerManagerClass *manager_class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (manager_class); + + object_class->finalize = gsm_power_manager_finalize; + + gsm_power_manager_class_install_properties (manager_class); + gsm_power_manager_class_install_signals (manager_class); + + g_type_class_add_private (manager_class, + sizeof (GsmPowerManagerPrivate)); +} + +static void +gsm_power_manager_class_install_signals (GsmPowerManagerClass *manager_class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (manager_class); + + signals[REQUEST_FAILED] = + g_signal_new ("request-failed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsmPowerManagerClass, request_failed), + NULL, + NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, G_TYPE_POINTER); + + manager_class->request_failed = NULL; +} + +static void +gsm_power_manager_class_install_properties (GsmPowerManagerClass *manager_class) +{ + GObjectClass *object_class; + GParamSpec *param_spec; + + object_class = G_OBJECT_CLASS (manager_class); + object_class->get_property = gsm_power_manager_get_property; + + param_spec = g_param_spec_boolean ("is-connected", + "Is connected", + "Whether the session is connected to " + "the power manager", + FALSE, + G_PARAM_READABLE); + + g_object_class_install_property (object_class, PROP_IS_CONNECTED, + param_spec); +} + +static void +on_name_owner_changed (DBusGProxy *bus_proxy, + const char *name, + const char *prev_owner, + const char *new_owner, + GsmPowerManager *manager) +{ + if (strcmp (name, "org.freedesktop.PowerManagement") != 0) { + return; + } + + if (manager->priv->gpm_proxy != NULL) { + g_object_unref (manager->priv->gpm_proxy); + manager->priv->gpm_proxy = NULL; + } + + ensure_gpm_connection (manager, NULL); +} + +static gboolean +ensure_gpm_connection (GsmPowerManager *manager, + GError **error) +{ + GError *connection_error; + gboolean is_connected; + + connection_error = NULL; + if (manager->priv->dbus_connection == NULL) { + manager->priv->dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, + &connection_error); + + if (manager->priv->dbus_connection == NULL) { + g_propagate_error (error, connection_error); + is_connected = FALSE; + goto out; + } + } + + if (manager->priv->bus_proxy == NULL) { + manager->priv->bus_proxy = + dbus_g_proxy_new_for_name_owner (manager->priv->dbus_connection, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, + &connection_error); + + if (manager->priv->bus_proxy == NULL) { + g_propagate_error (error, connection_error); + is_connected = FALSE; + goto out; + } + + dbus_g_proxy_add_signal (manager->priv->bus_proxy, + "NameOwnerChanged", + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_INVALID); + + dbus_g_proxy_connect_signal (manager->priv->bus_proxy, + "NameOwnerChanged", + G_CALLBACK (on_name_owner_changed), + manager, NULL); + } + + if (manager->priv->gpm_proxy == NULL) { + manager->priv->gpm_proxy = + dbus_g_proxy_new_for_name_owner ( + manager->priv->dbus_connection, + "org.freedesktop.PowerManagement", + "/org/freedesktop/PowerManagement", + "org.freedesktop.PowerManagement", + &connection_error); + + if (manager->priv->gpm_proxy == NULL) { + g_propagate_error (error, connection_error); + is_connected = FALSE; + goto out; + } + } + + is_connected = TRUE; + + out: + if (manager->priv->is_connected != is_connected) { + manager->priv->is_connected = is_connected; + g_object_notify (G_OBJECT (manager), "is-connected"); + } + + if (!is_connected) { + if (manager->priv->dbus_connection == NULL) { + if (manager->priv->bus_proxy != NULL) { + g_object_unref (manager->priv->bus_proxy); + manager->priv->bus_proxy = NULL; + } + + if (manager->priv->gpm_proxy != NULL) { + g_object_unref (manager->priv->gpm_proxy); + manager->priv->gpm_proxy = NULL; + } + } else if (manager->priv->bus_proxy == NULL) { + if (manager->priv->gpm_proxy != NULL) { + g_object_unref (manager->priv->gpm_proxy); + manager->priv->gpm_proxy = NULL; + } + } + } + + return is_connected; +} + +static void +gsm_power_manager_init (GsmPowerManager *manager) +{ + GError *error; + + manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, + GSM_TYPE_POWER_MANAGER, + GsmPowerManagerPrivate); + + manager->priv->dbus_connection = NULL; + manager->priv->bus_proxy = NULL; + manager->priv->gpm_proxy = NULL; + manager->priv->is_connected = FALSE; + + error = NULL; + + if (!ensure_gpm_connection (manager, &error)) { + g_message ("Could not connect to power manager: %s", + error->message); + g_error_free (error); + } +} + +static void +gsm_power_manager_finalize (GObject *object) +{ + GsmPowerManager *manager; + GObjectClass *parent_class; + + manager = GSM_POWER_MANAGER (object); + + parent_class = G_OBJECT_CLASS (gsm_power_manager_parent_class); + + if (parent_class->finalize != NULL) { + parent_class->finalize (object); + } +} + +static void +gsm_power_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GsmPowerManager *manager = GSM_POWER_MANAGER (object); + + switch (prop_id) { + case PROP_IS_CONNECTED: + g_value_set_boolean (value, + manager->priv->is_connected); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, + prop_id, + pspec); + } +} + +GQuark +gsm_power_manager_error_quark (void) +{ + static GQuark error_quark = 0; + + if (error_quark == 0) + error_quark = g_quark_from_static_string ("gsm-power-manager-error"); + + return error_quark; +} + +GsmPowerManager * +gsm_power_manager_new (void) +{ + GsmPowerManager *manager; + + manager = g_object_new (GSM_TYPE_POWER_MANAGER, NULL); + + return manager; +} + +gboolean +gsm_power_manager_can_suspend (GsmPowerManager *manager) +{ + GError *error; + gboolean can_suspend; + + error = NULL; + + if (!ensure_gpm_connection (manager, &error)) { + g_message ("Could not connect to power manager: %s", + error->message); + + g_error_free (error); + + return FALSE; + } + + can_suspend = FALSE; + + if (!dbus_g_proxy_call (manager->priv->gpm_proxy, "CanSuspend", + &error, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &can_suspend, G_TYPE_INVALID)) { + if (error != NULL) { + g_message ("Could not ask power manager if user can suspend: %s", + error->message); + + g_error_free (error); + } + + can_suspend = FALSE; + } + + return can_suspend; +} + +gboolean +gsm_power_manager_can_hibernate (GsmPowerManager *manager) +{ + GError *error; + gboolean can_hibernate; + + error = NULL; + + if (!ensure_gpm_connection (manager, &error)) { + g_message ("Could not connect to power manager: %s", + error->message); + + g_error_free (error); + + return FALSE; + } + + can_hibernate = FALSE; + + if (!dbus_g_proxy_call (manager->priv->gpm_proxy, "CanHibernate", + &error, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &can_hibernate, G_TYPE_INVALID)) { + if (error != NULL) { + g_message ("Could not ask power manager if user can suspend: %s", + error->message); + + g_error_free (error); + } + + can_hibernate = FALSE; + } + + return can_hibernate; +} + +#include + +gboolean +gsm_power_manager_can_reboot (GsmPowerManager *manager) +{ + uid_t uid; + struct passwd *pw; + + uid = getuid (); + if ((pw = getpwuid (uid)) != NULL) { + return (gboolean)chkauthattr ("solaris.system.shutdown", pw->pw_name); + } + + return FALSE; +} + +gboolean +gsm_power_manager_can_shutdown (GsmPowerManager *manager) +{ + return gsm_power_manager_can_reboot (manager); +} + +void +gsm_power_manager_attempt_suspend (GsmPowerManager *manager) +{ + GError *error; + + error = NULL; + + if (!ensure_gpm_connection (manager, &error)) { + g_warning ("Could not connect to power manager: %s", + error->message); + g_error_free (error); + return; + } + + if (!dbus_g_proxy_call (manager->priv->gpm_proxy, "Suspend", + &error, + G_TYPE_INVALID, G_TYPE_INVALID) && + error != NULL) { + GError *call_error; + + g_warning ("Could not ask power manager to suspend: %s", + error->message); + + call_error = g_error_new_literal (GSM_POWER_MANAGER_ERROR, + GSM_POWER_MANAGER_ERROR_SUSPENDING, + error->message); + + g_error_free (error); + + g_signal_emit (G_OBJECT (manager), + signals[REQUEST_FAILED], + 0, call_error); + + g_error_free (call_error); + } +} + +void +gsm_power_manager_attempt_hibernate (GsmPowerManager *manager) +{ + GError *error; + + error = NULL; + if (!ensure_gpm_connection (manager, &error)) { + g_warning ("Could not connect to power manager: %s", + error->message); + + g_error_free (error); + + return; + } + + if (!dbus_g_proxy_call (manager->priv->gpm_proxy, "Hibernate", + &error, + G_TYPE_INVALID, G_TYPE_INVALID) && + error != NULL) { + GError *call_error; + + g_warning ("Could not ask power manager to hibernate: %s", + error->message); + + call_error = g_error_new_literal (GSM_POWER_MANAGER_ERROR, + GSM_POWER_MANAGER_ERROR_HIBERNATING, + error->message); + + g_error_free (error); + + g_signal_emit (G_OBJECT (manager), + signals[REQUEST_FAILED], + 0, call_error); + + g_error_free (call_error); + } +} + +void +gsm_power_manager_attempt_reboot (GsmPowerManager *manager) +{ + GError *error; + + error = NULL; + if (!ensure_gpm_connection (manager, &error)) { + g_warning ("Could not connect to power manager: %s", + error->message); + + g_error_free (error); + + return; + } + + if (!dbus_g_proxy_call (manager->priv->gpm_proxy, "Reboot", &error, + G_TYPE_INVALID, G_TYPE_INVALID) && error != NULL) { + GError *call_error; + + g_warning ("Could not ask power manager to reboot: %s", + error->message); + + call_error = g_error_new_literal (GSM_POWER_MANAGER_ERROR, + GSM_POWER_MANAGER_ERROR_REBOOTING, + error->message); + + g_error_free (error); + + g_signal_emit (G_OBJECT (manager), + signals[REQUEST_FAILED], + 0, call_error); + + g_error_free (call_error); + } +} + +void +gsm_power_manager_attempt_shutdown (GsmPowerManager *manager) +{ + GError *error; + + error = NULL; + if (!ensure_gpm_connection (manager, &error)) { + g_warning ("Could not connect to power manager: %s", + error->message); + + g_error_free (error); + + return; + } + + if (!dbus_g_proxy_call (manager->priv->gpm_proxy, "Shutdown", &error, + G_TYPE_INVALID, G_TYPE_INVALID) && error != NULL) { + GError *call_error; + + g_warning ("Could not ask power manager to shutdown: %s", + error->message); + + call_error = g_error_new_literal (GSM_POWER_MANAGER_ERROR, + GSM_POWER_MANAGER_ERROR_SHUTDOWNING, + error->message); + + g_error_free (error); + + g_signal_emit (G_OBJECT (manager), + signals[REQUEST_FAILED], + 0, call_error); + + g_error_free (call_error); + } +} + +GsmPowerManager * +gsm_get_power_manager (void) +{ + static GsmPowerManager *manager = NULL; + + if (manager == NULL) { + manager = gsm_power_manager_new (); + } + + return g_object_ref (manager); +} diff -uprN gnome-session-2.27.5/gnome-session/gsm-power-manager.h gnome-session-2.27.5-new/gnome-session/gsm-power-manager.h --- gnome-session-2.27.5/gnome-session/gsm-power-manager.h 1970-01-01 08:00:00.000000000 +0800 +++ gnome-session-2.27.5-new/gnome-session/gsm-power-manager.h 2009-07-31 13:47:56.972479714 +0800 @@ -0,0 +1,93 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * power-manager.h: functions for powering down, restarting, and + * suspending the computer + * Copyright (C) 2006 Ray Strode + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef __GSM_POWER_MANAGER_H__ +#define __GSM_POWER_MANAGER_H__ + +#include +#include + +G_BEGIN_DECLS + +#define GSM_TYPE_POWER_MANAGER (gsm_power_manager_get_type ()) +#define GSM_POWER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSM_TYPE_POWER_MANAGER, GsmPowerManager)) +#define GSM_POWER_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSM_TYPE_POWER_MANAGER, GsmPowerManagerClass)) +#define GSM_IS_POWER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSM_TYPE_POWER_MANAGER)) +#define GSM_IS_POWER_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSM_TYPE_POWER_MANAGER)) +#define GSM_POWER_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSM_TYPE_POWER_MANAGER, GsmPowerManagerClass)) +#define GSM_POWER_MANAGER_ERROR (gsm_power_manager_error_quark ()) + +typedef struct _GsmPowerManager GsmPowerManager; +typedef struct _GsmPowerManagerClass GsmPowerManagerClass; +typedef struct _GsmPowerManagerPrivate GsmPowerManagerPrivate; +typedef enum _GsmPowerManagerError GsmPowerManagerError; + +struct _GsmPowerManager +{ + GObject parent; + + GsmPowerManagerPrivate *priv; +}; + +struct _GsmPowerManagerClass +{ + GObjectClass parent_class; + + void (* request_failed) (GsmPowerManager *manager, + GError *error); +}; + +enum _GsmPowerManagerError +{ + GSM_POWER_MANAGER_ERROR_SUSPENDING = 0, + GSM_POWER_MANAGER_ERROR_REBOOTING, + GSM_POWER_MANAGER_ERROR_SHUTDOWNING, + GSM_POWER_MANAGER_ERROR_HIBERNATING +}; + +GType gsm_power_manager_get_type (void) G_GNUC_CONST; + +GQuark gsm_power_manager_error_quark (void); + +GsmPowerManager *gsm_power_manager_new (void) G_GNUC_MALLOC; + +GsmPowerManager *gsm_get_power_manager (void); + +gboolean gsm_power_manager_can_suspend (GsmPowerManager *manager); + +gboolean gsm_power_manager_can_hibernate (GsmPowerManager *manager); + +gboolean gsm_power_manager_can_shutdown (GsmPowerManager *manager); + +gboolean gsm_power_manager_can_reboot (GsmPowerManager *manager); + +void gsm_power_manager_attempt_suspend (GsmPowerManager *manager); + +void gsm_power_manager_attempt_hibernate (GsmPowerManager *manager); + +void gsm_power_manager_attempt_shutdown (GsmPowerManager *manager); + +void gsm_power_manager_attempt_reboot (GsmPowerManager *manager); + +G_END_DECLS + +#endif /* __GSM_POWER_MANAGER_H__ */ --- gnome-session-2.32.1/gnome-session/gsm-logout-dialog.c.~1~ 2015-01-13 11:22:03.486534985 +0300 +++ gnome-session-2.32.1/gnome-session/gsm-logout-dialog.c 2015-01-13 11:28:08.263650224 +0300 @@ -23,12 +23,15 @@ */ #include +#include +#include +#include #include #include +#include -#include - +#include "gsm-power-manager.h" #include "gsm-logout-dialog.h" #include "gsm-consolekit.h" #include "gdm.h" @@ -50,7 +53,6 @@ { GsmDialogLogoutType type; - UpClient *up_client; GsmConsolekit *consolekit; int timeout; @@ -142,8 +144,6 @@ gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE); gtk_window_stick (GTK_WINDOW (logout_dialog)); - logout_dialog->priv->up_client = up_client_new (); - logout_dialog->priv->consolekit = gsm_get_consolekit (); g_signal_connect (logout_dialog, @@ -166,11 +166,6 @@ logout_dialog->priv->timeout_id = 0; } - if (logout_dialog->priv->up_client) { - g_object_unref (logout_dialog->priv->up_client); - logout_dialog->priv->up_client = NULL; - } - if (logout_dialog->priv->consolekit) { g_object_unref (logout_dialog->priv->consolekit); logout_dialog->priv->consolekit = NULL; @@ -182,13 +177,29 @@ static gboolean gsm_logout_supports_system_suspend (GsmLogoutDialog *logout_dialog) { - return up_client_get_can_suspend (logout_dialog->priv->up_client); + GsmPowerManager *power_manager; + gboolean ret; + + power_manager = gsm_get_power_manager (); + + ret= gsm_power_manager_can_suspend (power_manager); + g_object_unref (power_manager); + + return ret; } static gboolean gsm_logout_supports_system_hibernate (GsmLogoutDialog *logout_dialog) { - return up_client_get_can_hibernate (logout_dialog->priv->up_client); + GsmPowerManager *power_manager; + gboolean ret; + + power_manager = gsm_get_power_manager (); + + ret= gsm_power_manager_can_hibernate (power_manager); + g_object_unref (power_manager); + + return ret; } static gboolean --- gnome-session-2.32.1/gnome-session/gsm-manager.c.~2~ 2015-01-13 11:30:01.053710331 +0300 +++ gnome-session-2.32.1/gnome-session/gsm-manager.c 2015-01-13 11:36:49.726205501 +0300 @@ -38,8 +38,6 @@ #include #include -#include - #include /* for logout dialog */ #include @@ -61,6 +59,7 @@ #include "gsm-inhibit-dialog.h" #include "gsm-consolekit.h" #include "gsm-session-save.h" +#include "gsm-power-manager.h" #define GSM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_MANAGER, GsmManagerPrivate)) @@ -133,9 +132,6 @@ DBusGProxy *bus_proxy; DBusGConnection *connection; - - /* Interface with other parts of the system */ - UpClient *up_client; }; enum { @@ -999,47 +995,27 @@ static void manager_attempt_hibernate (GsmManager *manager) { - gboolean can_hibernate; - GError *error; - gboolean ret; - - can_hibernate = up_client_get_can_hibernate (manager->priv->up_client); - if (can_hibernate) { - - /* lock the screen before we suspend */ - manager_perhaps_lock (manager); + GsmPowerManager *power_manager; - error = NULL; - ret = up_client_hibernate_sync (manager->priv->up_client, NULL, &error); - if (!ret) { - g_warning ("Unexpected hibernate failure: %s", - error->message); - g_error_free (error); - } - } + power_manager = gsm_get_power_manager (); + if (gsm_power_manager_can_hibernate (power_manager)) { + gsm_power_manager_attempt_hibernate (power_manager); + } + + g_object_unref (power_manager); } static void manager_attempt_suspend (GsmManager *manager) { - gboolean can_suspend; - GError *error; - gboolean ret; - - can_suspend = up_client_get_can_suspend (manager->priv->up_client); - if (can_suspend) { - - /* lock the screen before we suspend */ - manager_perhaps_lock (manager); + GsmPowerManager *power_manager; + + power_manager = gsm_get_power_manager (); + if (gsm_power_manager_can_suspend (power_manager)) { + gsm_power_manager_attempt_suspend (power_manager); + } - error = NULL; - ret = up_client_suspend_sync (manager->priv->up_client, NULL, &error); - if (!ret) { - g_warning ("Unexpected suspend failure: %s", - error->message); - g_error_free (error); - } - } + g_object_unref (power_manager); } static void @@ -2222,11 +2198,6 @@ manager->priv->gconf_client = NULL; } - if (manager->priv->up_client != NULL) { - g_object_unref (manager->priv->up_client); - manager->priv->up_client = NULL; - } - G_OBJECT_CLASS (gsm_manager_parent_class)->dispose (object); } @@ -2455,8 +2426,6 @@ G_CALLBACK (on_presence_status_changed), manager); - manager->priv->up_client = up_client_new (); - /* GConf setup */ gconf_client_add_dir (manager->priv->gconf_client, KEY_DESKTOP_DIR, @@ -2976,13 +2945,6 @@ GError **error) { GsmConsolekit *consolekit; - gboolean can_suspend; - gboolean can_hibernate; - - g_object_get (manager->priv->up_client, - "can-suspend", &can_suspend, - "can-hibernate", &can_hibernate, - NULL); g_debug ("GsmManager: CanShutdown called"); @@ -2990,9 +2952,7 @@ consolekit = gsm_get_consolekit (); *shutdown_available = gsm_consolekit_can_stop (consolekit) - || gsm_consolekit_can_restart (consolekit) - || can_suspend - || can_hibernate; + || gsm_consolekit_can_restart (consolekit); g_object_unref (consolekit); return TRUE;