0 | |
revno: 3100
|
1 | |
committer: Matthieu Baerts <matttbe@gmail.com>
|
2 | |
branch nick: cairo-dock-plug-ins
|
3 | |
timestamp: Sun 2014-06-15 12:22:40 +0200
|
4 | |
message: PowerManager: UPower 0.99+: 'changed' signal has been replaced by 'notify' signal
|
5 | |
|
6 | |
revno: 3084
|
7 | |
committer: Matthieu Baerts <matttbe@gmail.com>
|
8 | |
branch nick: cairo-dock-plug-ins
|
9 | |
timestamp: Fri 2014-05-23 01:26:57 +0200
|
10 | |
message: PowerManager: removed suspend/hibernate features
|
11 | |
These features no longer work on recent systems and they are no longer
|
12 | |
supported with recent versions of UPower (0.99+).
|
13 | |
We should support SystemD but suspend/hibernate features are already managed
|
14 | |
by Logout applet (and the system when pressing the Shutdown button) and this
|
15 | |
applet can be hidden most of the time (or not used when there are no battery):
|
16 | |
I think users use Logout applet instead. (and now they should use it :-) )
|
17 | |
|
18 | |
revno: 3083
|
19 | |
committer: Matthieu Baerts <matttbe@gmail.com>
|
20 | |
branch nick: cairo-dock-plug-ins
|
21 | |
timestamp: Tue 2014-05-20 21:08:19 +0200
|
22 | |
message: Logout: UPower 0.99+ no longer supports logout features: suspend/hibernate
|
23 | |
If UPower >=0.90 is used, we can't compile Logout applet with UPower because
|
24 | |
some functions are no longer available
|
25 | |
|
26 | |
=== modified file 'CMakeLists.txt'
|
27 | |
Index: cairo-dock-plug-ins/CMakeLists.txt
|
28 | |
===================================================================
|
29 | |
--- cairo-dock-plug-ins.orig/CMakeLists.txt
|
30 | |
+++ cairo-dock-plug-ins/CMakeLists.txt
|
31 | |
@@ -152,6 +152,14 @@ pkg_check_modules (GLIB glib-2.0)
|
32 | |
set (shared_filesdatadir "${pluginsdatadir}/shared-files")
|
33 | |
add_subdirectory (shared-files)
|
34 | |
|
35 | |
+
|
36 | |
+
|
37 | |
+################################################################################
|
38 | |
+# STATIC LIBS AND DEPENDENCES USED BY MORE THAN ONE PLUG-IN #
|
39 | |
+################################################################################
|
40 | |
+
|
41 | |
+
|
42 | |
+
|
43 | |
############# STATIC LIBRARIES ################
|
44 | |
message (STATUS "> Static Libraries:")
|
45 | |
|
46 | |
@@ -337,6 +345,30 @@ elseif (INDICATOR_APPLET_FOUND)
|
47 | |
endif()
|
48 | |
endif()
|
49 | |
|
50 | |
+############# UPOWER #####################
|
51 | |
+message (STATUS "> UPower:")
|
52 | |
+enable_if_not_defined (enable-upower-support)
|
53 | |
+if (enable-upower-support)
|
54 | |
+ pkg_check_modules (UPOWER upower-glib) # useful for Powermanager too.
|
55 | |
+endif()
|
56 | |
+if (UPOWER_FOUND)
|
57 | |
+ set (with_upower_support yes)
|
58 | |
+ STRING (REGEX REPLACE "\\..*" "" UPOWER_MAJOR "${UPOWER_VERSION}") # 2.28.3 => 2
|
59 | |
+ STRING (REGEX REPLACE "[0-9]*\\.([^ ]+)" "\\1" UPOWER_MINOR "${UPOWER_VERSION}") # 2.28.3 => 2.28
|
60 | |
+ STRING (REGEX REPLACE "\\.[0-9]*" "" UPOWER_MINOR "${UPOWER_MINOR}") # 2.28 => 28
|
61 | |
+ if (${UPOWER_MAJOR} GREATER 0 OR ${UPOWER_MINOR} GREATER 89)
|
62 | |
+ message (STATUS " Your version of UPower no longer supports suspend/hibernate features")
|
63 | |
+ set (with_upower_support "yes (0.99+)")
|
64 | |
+ else()
|
65 | |
+ set (UPOWER_SUPPORTS_SUSPEND_HIBERNATE 1)
|
66 | |
+ endif()
|
67 | |
+else()
|
68 | |
+ set (with_upower_support no)
|
69 | |
+ message (STATUS "Could not find upower-glib; Logout and PowerManager plugin won't be built with UPower support.")
|
70 | |
+ message (WARNING "This module is required to compile LogOut and PowerManager applet with UPower support: upower-glib")
|
71 | |
+ set (MODULES_MISSING "${MODULES_MISSING} upower-glib")
|
72 | |
+endif()
|
73 | |
+
|
74 | |
############# DISTRIBUTION #################
|
75 | |
message (STATUS "> Distribution:")
|
76 | |
# We try to detect if the user is on Ubuntu to know which bus we have to use...
|
77 | |
@@ -387,6 +419,14 @@ if (EXISTS ${DEBIAN_VERSION})
|
78 | |
message (STATUS " DISTRO_ID: ${DISTRO_ID}, DISTRO_RELEASE: ${DISTRO_RELEASE}")
|
79 | |
endif()
|
80 | |
|
81 | |
+
|
82 | |
+
|
83 | |
+################################################################################
|
84 | |
+# PLUG-INS #
|
85 | |
+################################################################################
|
86 | |
+
|
87 | |
+
|
88 | |
+
|
89 | |
############# SHARED LIBRARIES ###########
|
90 | |
message (STATUS "> Shared Libraries:")
|
91 | |
|
92 | |
@@ -969,18 +1009,6 @@ endif()
|
93 | |
|
94 | |
############# LOGOUT #################
|
95 | |
message (STATUS "> Logout:")
|
96 | |
-enable_if_not_defined (enable-upower-support)
|
97 | |
-if (enable-upower-support)
|
98 | |
- pkg_check_modules (UPOWER upower-glib) # useful for Powermanager too.
|
99 | |
-endif()
|
100 | |
-if (UPOWER_FOUND)
|
101 | |
- set (with_upower_support yes)
|
102 | |
-else()
|
103 | |
- set (with_upower_support no)
|
104 | |
- message (STATUS "Could not find upower-glib; Logout and PowerManager plugin won't be built with UPower support.")
|
105 | |
- message (WARNING "This module is required to compile LogOut and PowerManager applet with UPower support: upower-glib")
|
106 | |
- set (MODULES_MISSING "${MODULES_MISSING} upower-glib")
|
107 | |
-endif()
|
108 | |
set (GETTEXT_LOGOUT ${GETTEXT_PLUGINS})
|
109 | |
set (VERSION_LOGOUT "2.0.3")
|
110 | |
set (PACKAGE_LOGOUT "cd-logout")
|
111 | |
Index: cairo-dock-plug-ins/logout/src/CMakeLists.txt
|
112 | |
===================================================================
|
113 | |
--- cairo-dock-plug-ins.orig/logout/src/CMakeLists.txt
|
114 | |
+++ cairo-dock-plug-ins/logout/src/CMakeLists.txt
|
115 | |
@@ -20,22 +20,30 @@ add_definitions (-DMY_APPLET_VERSION="${
|
116 | |
add_definitions (-DMY_APPLET_GETTEXT_DOMAIN="${GETTEXT_LOGOUT}")
|
117 | |
add_definitions (-DMY_APPLET_DOCK_VERSION="${dock_version}")
|
118 | |
add_definitions (-DMY_APPLET_ICON_FILE="icon.svg")
|
119 | |
-if (${UPOWER_FOUND})
|
120 | |
+
|
121 | |
+
|
122 | |
+if (UPOWER_SUPPORTS_SUSPEND_HIBERNATE)
|
123 | |
add_definitions (-DCD_UPOWER_AVAILABLE="1")
|
124 | |
-endif()
|
125 | |
|
126 | |
+ include_directories (
|
127 | |
+ ${UPOWER_INCLUDE_DIRS}
|
128 | |
+ ${PACKAGE_INCLUDE_DIRS})
|
129 | |
+
|
130 | |
+ link_directories (
|
131 | |
+ ${UPOWER_LIBRARY_DIRS}
|
132 | |
+ ${PACKAGE_LIBRARY_DIRS})
|
133 | |
+
|
134 | |
+ target_link_libraries (${PACKAGE_LOGOUT}
|
135 | |
+ ${UPOWER_LIBRARIES}
|
136 | |
+ ${PACKAGE_LIBRARIES})
|
137 | |
+else()
|
138 | |
+ include_directories (${PACKAGE_INCLUDE_DIRS})
|
139 | |
|
140 | |
-include_directories (
|
141 | |
- ${UPOWER_INCLUDE_DIRS}
|
142 | |
- ${PACKAGE_INCLUDE_DIRS})
|
143 | |
-
|
144 | |
-link_directories (
|
145 | |
- ${UPOWER_LIBRARY_DIRS}
|
146 | |
- ${PACKAGE_LIBRARY_DIRS})
|
147 | |
-
|
148 | |
-target_link_libraries (${PACKAGE_LOGOUT}
|
149 | |
- ${UPOWER_LIBRARIES}
|
150 | |
- ${PACKAGE_LIBRARIES})
|
151 | |
+ link_directories (${PACKAGE_LIBRARY_DIRS})
|
152 | |
+
|
153 | |
+ target_link_libraries (${PACKAGE_LOGOUT}
|
154 | |
+ ${PACKAGE_LIBRARIES})
|
155 | |
+endif()
|
156 | |
|
157 | |
########### install files ###############
|
158 | |
|
159 | |
Index: cairo-dock-plug-ins/powermanager/src/CMakeLists.txt
|
160 | |
===================================================================
|
161 | |
--- cairo-dock-plug-ins.orig/powermanager/src/CMakeLists.txt
|
162 | |
+++ cairo-dock-plug-ins/powermanager/src/CMakeLists.txt
|
163 | |
@@ -25,7 +25,10 @@ add_definitions (-DMY_APPLET_GETTEXT_DOM
|
164 | |
add_definitions (-DMY_APPLET_DOCK_VERSION="${dock_version}")
|
165 | |
add_definitions (-DMY_APPLET_ICON_FILE="icon.png")
|
166 | |
if (${UPOWER_FOUND})
|
167 | |
- add_definitions (-DCD_UPOWER_AVAILABLE="1")
|
168 | |
+ add_definitions (-DCD_UPOWER_AVAILABLE=1)
|
169 | |
+ if (NOT UPOWER_SUPPORTS_SUSPEND_HIBERNATE)
|
170 | |
+ add_definitions (-DCD_UPOWER_0_99=1)
|
171 | |
+ endif()
|
172 | |
endif()
|
173 | |
|
174 | |
include_directories (
|
175 | |
Index: cairo-dock-plug-ins/powermanager/src/powermanager-menu-functions.c
|
176 | |
===================================================================
|
177 | |
--- cairo-dock-plug-ins.orig/powermanager/src/powermanager-menu-functions.c
|
178 | |
+++ cairo-dock-plug-ins/powermanager/src/powermanager-menu-functions.c
|
179 | |
@@ -90,19 +90,5 @@ CD_APPLET_ON_BUILD_MENU_BEGIN
|
180 | |
|
181 | |
if (bAddSeparator)
|
182 | |
CD_APPLET_ADD_SEPARATOR_IN_MENU (CD_APPLET_MY_MENU);
|
183 | |
-
|
184 | |
- // Power actions (Hibernate/Suspend)
|
185 | |
- #ifdef CD_UPOWER_AVAILABLE // if Upower is available, we should be able to suspend; if not, then it's probably just a problem with consolekit, which should be fixed by the user; so show the items to give the user a hint about the problem.
|
186 | |
- pMenuItem = CD_APPLET_ADD_IN_MENU (D_("Hibernate"), cd_power_hibernate, CD_APPLET_MY_MENU);
|
187 | |
- if (! cd_power_can_hibernate ())
|
188 | |
- gtk_widget_set_sensitive (pMenuItem, FALSE);
|
189 | |
- pMenuItem = CD_APPLET_ADD_IN_MENU (D_("Suspend"), cd_power_suspend, CD_APPLET_MY_MENU);
|
190 | |
- if (! cd_power_can_suspend ())
|
191 | |
- gtk_widget_set_sensitive (pMenuItem, FALSE);
|
192 | |
- #else
|
193 | |
- if (cd_power_can_hibernate ())
|
194 | |
- CD_APPLET_ADD_IN_MENU (D_("Hibernate"), cd_power_hibernate, CD_APPLET_MY_MENU);
|
195 | |
- if (cd_power_can_suspend ())
|
196 | |
- CD_APPLET_ADD_IN_MENU (D_("Suspend"), cd_power_suspend, CD_APPLET_MY_MENU);
|
197 | |
- #endif
|
198 | |
+
|
199 | |
CD_APPLET_ON_BUILD_MENU_END
|
200 | |
Index: cairo-dock-plug-ins/powermanager/src/powermanager-struct.h
|
201 | |
===================================================================
|
202 | |
--- cairo-dock-plug-ins.orig/powermanager/src/powermanager-struct.h
|
203 | |
+++ cairo-dock-plug-ins/powermanager/src/powermanager-struct.h
|
204 | |
@@ -22,10 +22,6 @@
|
205 | |
|
206 | |
#include <cairo-dock.h>
|
207 | |
#ifdef CD_UPOWER_AVAILABLE
|
208 | |
-/* to access suspend/resume functionality on Upower 0.9
|
209 | |
- * even if we use first logind, we only use logind via DBus
|
210 | |
- */
|
211 | |
-#define UPOWER_ENABLE_DEPRECATED
|
212 | |
#include <upower.h>
|
213 | |
#endif
|
214 | |
|
215 | |
Index: cairo-dock-plug-ins/powermanager/src/powermanager-upower.c
|
216 | |
===================================================================
|
217 | |
--- cairo-dock-plug-ins.orig/powermanager/src/powermanager-upower.c
|
218 | |
+++ cairo-dock-plug-ins/powermanager/src/powermanager-upower.c
|
219 | |
@@ -48,7 +48,11 @@ static void _cd_upower_connect_async (CD
|
220 | |
UpClient *pUPowerClient = up_client_new ();
|
221 | |
|
222 | |
// get the list of devices.
|
223 | |
- if (pUPowerClient == NULL || ! up_client_enumerate_devices_sync (pUPowerClient, NULL, NULL))
|
224 | |
+ if (pUPowerClient == NULL
|
225 | |
+ #ifndef CD_UPOWER_0_99 // no longer available with UPower 0.99+
|
226 | |
+ || ! up_client_enumerate_devices_sync (pUPowerClient, NULL, NULL)
|
227 | |
+ #endif
|
228 | |
+ )
|
229 | |
{
|
230 | |
cd_warning ("couldn't get devices from UPower daemon");
|
231 | |
if (pUPowerClient)
|
232 | |
@@ -182,7 +186,11 @@ static void _on_device_removed (UpClient
|
233 | |
CD_APPLET_LEAVE ();
|
234 | |
}
|
235 | |
|
236 | |
+#ifdef CD_UPOWER_0_99 // one more param
|
237 | |
+static void _on_device_changed (G_GNUC_UNUSED UpDevice *pDevice, G_GNUC_UNUSED GParamSpec *pSpec, G_GNUC_UNUSED gpointer data)
|
238 | |
+#else
|
239 | |
static void _on_device_changed (G_GNUC_UNUSED UpDevice *pDevice, G_GNUC_UNUSED gpointer data)
|
240 | |
+#endif
|
241 | |
{
|
242 | |
CD_APPLET_ENTER;
|
243 | |
cd_debug ("battery properties changed");
|
244 | |
@@ -251,6 +259,7 @@ static gboolean _cd_upower_update_state
|
245 | |
if (myData.pTask != NULL // only the first time
|
246 | |
|| myData.pBatteryDeviceList == NULL // or if it's a new device
|
247 | |
|| g_list_find (myData.pBatteryDeviceList, pDevice) == NULL)
|
248 | |
+ // or compare the up_device_get_object_path (pDevice) ?
|
249 | |
{
|
250 | |
/* watch for any change. A priori, no need to watch the
|
251 | |
* "onBattery" signal on the client, since we can deduce this
|
252 | |
@@ -259,7 +268,11 @@ static gboolean _cd_upower_update_state
|
253 | |
* find a battery device, it will stay here forever, so we don't
|
254 | |
* need to watch for the destruction/creation of a battery device.
|
255 | |
*/
|
256 | |
- iSignalID = g_signal_connect (pDevice, "changed", G_CALLBACK (_on_device_changed), NULL);
|
257 | |
+ #ifdef CD_UPOWER_0_99 // Now called notify
|
258 | |
+ iSignalID = g_signal_connect (pDevice, "notify", G_CALLBACK (_on_device_changed), NULL);
|
259 | |
+ #else
|
260 | |
+ iSignalID = g_signal_connect (pDevice, "changed", G_CALLBACK (_on_device_changed), NULL);
|
261 | |
+ #endif
|
262 | |
myData.pSignalIDList = g_list_append (myData.pSignalIDList, GINT_TO_POINTER (iSignalID));
|
263 | |
}
|
264 | |
|
265 | |
@@ -364,38 +377,6 @@ void cd_upower_stop (void)
|
266 | |
}
|
267 | |
}
|
268 | |
|
269 | |
-gboolean cd_power_hibernate (void)
|
270 | |
-{
|
271 | |
- if (myData.pUPowerClient != NULL)
|
272 | |
- return up_client_hibernate_sync (myData.pUPowerClient, NULL, NULL);
|
273 | |
- else
|
274 | |
- return FALSE;
|
275 | |
-}
|
276 | |
-
|
277 | |
-gboolean cd_power_suspend (void)
|
278 | |
-{
|
279 | |
- if (myData.pUPowerClient != NULL)
|
280 | |
- return up_client_suspend_sync (myData.pUPowerClient, NULL, NULL);
|
281 | |
- else
|
282 | |
- return FALSE;
|
283 | |
-}
|
284 | |
-
|
285 | |
-gboolean cd_power_can_hibernate (void)
|
286 | |
-{
|
287 | |
- if (myData.pUPowerClient != NULL)
|
288 | |
- return up_client_get_can_hibernate (myData.pUPowerClient);
|
289 | |
- else
|
290 | |
- return FALSE;
|
291 | |
-}
|
292 | |
-
|
293 | |
-gboolean cd_power_can_suspend (void)
|
294 | |
-{
|
295 | |
- if (myData.pUPowerClient != NULL)
|
296 | |
- return up_client_get_can_suspend (myData.pUPowerClient);
|
297 | |
- else
|
298 | |
- return FALSE;
|
299 | |
-}
|
300 | |
-
|
301 | |
#else // code without libupower
|
302 | |
|
303 | |
void cd_powermanager_start (void)
|
304 | |
@@ -408,24 +389,4 @@ void cd_upower_stop (void)
|
305 | |
|
306 | |
}
|
307 | |
|
308 | |
-gboolean cd_power_hibernate (void)
|
309 | |
-{
|
310 | |
- return FALSE;
|
311 | |
-}
|
312 | |
-
|
313 | |
-gboolean cd_power_suspend (void)
|
314 | |
-{
|
315 | |
- return FALSE;
|
316 | |
-}
|
317 | |
-
|
318 | |
-gboolean cd_power_can_hibernate (void)
|
319 | |
-{
|
320 | |
- return FALSE;
|
321 | |
-}
|
322 | |
-
|
323 | |
-gboolean cd_power_can_suspend (void)
|
324 | |
-{
|
325 | |
- return FALSE;
|
326 | |
-}
|
327 | |
-
|
328 | |
#endif
|
329 | |
Index: cairo-dock-plug-ins/powermanager/src/powermanager-upower.h
|
330 | |
===================================================================
|
331 | |
--- cairo-dock-plug-ins.orig/powermanager/src/powermanager-upower.h
|
332 | |
+++ cairo-dock-plug-ins/powermanager/src/powermanager-upower.h
|
333 | |
@@ -27,14 +27,4 @@ void cd_powermanager_start (void);
|
334 | |
|
335 | |
void cd_upower_stop (void);
|
336 | |
|
337 | |
-
|
338 | |
-gboolean cd_power_hibernate (void);
|
339 | |
-
|
340 | |
-gboolean cd_power_suspend (void);
|
341 | |
-
|
342 | |
-gboolean cd_power_can_hibernate (void);
|
343 | |
-
|
344 | |
-gboolean cd_power_can_suspend (void);
|
345 | |
-
|
346 | |
-
|
347 | |
#endif
|