[gnome-session] Don't disable ConsoleKit with new upower
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] Don't disable ConsoleKit with new upower
- Date: Tue, 15 Apr 2014 12:51:49 +0000 (UTC)
commit ad66350c85280c2131409a058aba3e4fc306536d
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Mar 26 12:04:14 2014 -0400
Don't disable ConsoleKit with new upower
ConsoleKit is still useful, even if we can't suspend/hibernate using
upower anymore. Don't disable the whole thing.
https://bugzilla.gnome.org/show_bug.cgi?id=727099
gnome-session/Makefile.am | 2 --
gnome-session/gsm-consolekit.c | 20 ++++++++++++++++++++
gnome-session/gsm-system.c | 5 +----
3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index 0360228..d20a115 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -59,9 +59,7 @@ gnome_session_SOURCES = \
gsm-xsmp-server.c \
gsm-xsmp-server.h
-if HAVE_OLD_UPOWER
gnome_session_SOURCES += gsm-consolekit.c gsm-consolekit.h
-endif
gnome_session_CPPFLAGS = \
$(AM_CPPFLAGS) \
diff --git a/gnome-session/gsm-consolekit.c b/gnome-session/gsm-consolekit.c
index 9d54ee6..54a6d83 100644
--- a/gnome-session/gsm-consolekit.c
+++ b/gnome-session/gsm-consolekit.c
@@ -29,8 +29,10 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#ifdef HAVE_OLD_UPOWER
#define UPOWER_ENABLE_DEPRECATED 1
#include <upower.h>
+#endif
#include "gsm-system.h"
#include "gsm-consolekit.h"
@@ -54,7 +56,9 @@ struct _GsmConsolekitPrivate
DBusGProxy *bus_proxy;
DBusGProxy *ck_proxy;
DBusGProxy *session_proxy;
+#ifdef HAVE_OLD_UPOWER
UpClient *up_client;
+#endif
gboolean is_active;
gboolean restarting;
@@ -304,8 +308,10 @@ gsm_consolekit_ensure_ck_connection (GsmConsolekit *manager,
G_CALLBACK (on_active_changed), manager, NULL);
}
+#ifdef HAVE_OLD_UPOWER
g_clear_object (&manager->priv->up_client);
manager->priv->up_client = up_client_new ();
+#endif
is_connected = TRUE;
@@ -379,7 +385,9 @@ gsm_consolekit_free_dbus (GsmConsolekit *manager)
g_clear_object (&manager->priv->ck_proxy);
g_clear_object (&manager->priv->session_proxy);
g_clear_object (&manager->priv->session_id);
+#ifdef HAVE_OLD_UPOWER
g_clear_object (&manager->priv->up_client);
+#endif
if (manager->priv->dbus_connection != NULL) {
DBusConnection *connection;
@@ -948,7 +956,11 @@ gsm_consolekit_can_suspend (GsmSystem *system)
{
GsmConsolekit *consolekit = GSM_CONSOLEKIT (system);
+#ifdef HAVE_OLD_UPOWER
return up_client_get_can_suspend (consolekit->priv->up_client);
+#else
+ return FALSE;
+#endif
}
static gboolean
@@ -956,12 +968,17 @@ gsm_consolekit_can_hibernate (GsmSystem *system)
{
GsmConsolekit *consolekit = GSM_CONSOLEKIT (system);
+#ifdef HAVE_OLD_UPOWER
return up_client_get_can_hibernate (consolekit->priv->up_client);
+#else
+ return FALSE;
+#endif
}
static void
gsm_consolekit_suspend (GsmSystem *system)
{
+#ifdef HAVE_OLD_UPOWER
GsmConsolekit *consolekit = GSM_CONSOLEKIT (system);
GError *error = NULL;
gboolean ret;
@@ -971,11 +988,13 @@ gsm_consolekit_suspend (GsmSystem *system)
g_warning ("Unexpected suspend failure: %s", error->message);
g_error_free (error);
}
+#endif
}
static void
gsm_consolekit_hibernate (GsmSystem *system)
{
+#ifdef HAVE_OLD_UPOWER
GsmConsolekit *consolekit = GSM_CONSOLEKIT (system);
GError *error = NULL;
gboolean ret;
@@ -985,6 +1004,7 @@ gsm_consolekit_hibernate (GsmSystem *system)
g_warning ("Unexpected hibernate failure: %s", error->message);
g_error_free (error);
}
+#endif
}
static void
diff --git a/gnome-session/gsm-system.c b/gnome-session/gsm-system.c
index 43c7c29..6a4bc3d 100644
--- a/gnome-session/gsm-system.c
+++ b/gnome-session/gsm-system.c
@@ -22,9 +22,7 @@
#include <glib/gi18n.h>
#include "gsm-system.h"
-#ifdef HAVE_OLD_UPOWER
#include "gsm-consolekit.h"
-#endif
#include "gsm-systemd.h"
enum {
@@ -254,14 +252,13 @@ gsm_get_system (void)
g_debug ("Using systemd for session tracking");
}
}
-#ifdef HAVE_OLD_UPOWER
+
if (system == NULL) {
system = GSM_SYSTEM (gsm_consolekit_new ());
if (system != NULL) {
g_debug ("Using ConsoleKit for session tracking");
}
}
-#endif
if (system == NULL) {
system = g_object_new (gsm_system_null_get_type (), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]