summaryrefslogtreecommitdiffstats
path: root/x11/gnome-session/files/patch-gnome-session_gsm-consolekit.c
blob: c270fb6e13fe939f94ce1e079ff2631575219fb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
From 858ef953928933d516a90b30873eea5d8f1d452b Mon Sep 17 00:00:00 2001
From: Ryan Lortie <desrt@desrt.ca>
Date: Wed, 26 Mar 2014 12:04:14 -0400
Subject: [PATCH] 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


diff -u -r gnome-session/Makefile.am gnome-session/Makefile.am
--- gnome-session/Makefile.am   2014-03-26 12:12:00.000000000 -0400
+++ gnome-session/Makefile.am   2014-03-26 12:12:14.000000000 -0400
@@ -59,9 +59,7 @@
    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 -u -r gnome-session/Makefile.in gnome-session/Makefile.in
--- gnome-session/Makefile.in   2014-03-26 12:12:00.000000000 -0400
+++ gnome-session/Makefile.in   2014-03-26 12:12:38.000000000 -0400
@@ -83,7 +83,7 @@
 libexec_PROGRAMS = gnome-session-failed$(EXEEXT)
 noinst_PROGRAMS = test-client-dbus$(EXEEXT) test-inhibit$(EXEEXT) \
    test-process-helper$(EXEEXT)
-@HAVE_OLD_UPOWER_TRUE@am__append_1 = gsm-consolekit.c gsm-consolekit.h
+am__append_1 = gsm-consolekit.c gsm-consolekit.h
 subdir = gnome-session
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
    $(top_srcdir)/depcomp README
@@ -125,8 +125,8 @@
    gsm-shell-extensions.h gsm-shell.c gsm-shell.h \
    gsm-xsmp-server.c gsm-xsmp-server.h gsm-consolekit.c \
    gsm-consolekit.h
-@HAVE_OLD_UPOWER_TRUE@am__objects_1 =  \
-@HAVE_OLD_UPOWER_TRUE@ gnome_session-gsm-consolekit.$(OBJEXT)
+am__objects_1 =  \
+   gnome_session-gsm-consolekit.$(OBJEXT)
 am_gnome_session_OBJECTS = gnome_session-gsm-app.$(OBJEXT) \
    gnome_session-gsm-autostart-app.$(OBJEXT) \
    gnome_session-gsm-client.$(OBJEXT) \
diff -u -r gnome-session/gsm-consolekit.c gnome-session/gsm-consolekit.c
--- gnome-session/gsm-consolekit.c  2014-03-26 12:12:00.000000000 -0400
+++ gnome-session/gsm-consolekit.c  2014-03-26 12:12:14.000000000 -0400
@@ -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 @@
         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 @@
                                              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;
 
@@ -382,7 +388,9 @@
         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;
@@ -951,7 +959,11 @@
 {
         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
@@ -959,12 +971,17 @@
 {
         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;
@@ -974,11 +991,13 @@
                 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;
@@ -988,6 +1007,7 @@
                 g_warning ("Unexpected hibernate failure: %s", error->message);
                 g_error_free (error);
         }
+#endif
 }
 
 static void
diff -u -r gnome-session/gsm-system.c gnome-session/gsm-system.c
--- gnome-session/gsm-system.c  2014-03-26 12:12:00.000000000 -0400
+++ gnome-session/gsm-system.c  2014-03-26 12:14:29.000000000 -0400
@@ -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 @@
                         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);