Obsolete golang-120
[oi-userland.git] / components / sysutils / upower / patches / 03-up-backend-common.c.patch
blob2bc40b580681b5e9ff2cfcb08f406737cbff8324
1 Map unsupported ConsoleKit methods to supported ones
3 --- upower-0.99.4/src/bsd/up-backend-common.c.~1~ 2015-07-08 11:30:24.000000000 +0000
4 +++ upower-0.99.4/src/bsd/up-backend-common.c 2018-01-18 12:13:50.439742956 +0000
5 @@ -19,6 +19,8 @@
6 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
7 */
9 +#include <strings.h>
11 #include "up-backend-bsd-private.h"
13 static gboolean
14 @@ -109,16 +111,28 @@
15 up_backend_take_action (UpBackend *backend)
17 const char *method;
18 + GVariant* method_arg;
19 GDBusProxy *seat_manager_proxy = up_backend_get_seat_manager_proxy (backend);
21 method = up_backend_get_critical_action (backend);
22 + method_arg = g_variant_new ("(b)", FALSE);
24 +#if defined (__sun) && defined (__SVR4)
25 +/* Map methods to supported ck_* methods */
26 + if (strcmp(method, "PowerOff") == 0) {
27 + method = "Stop";
28 + method_arg = NULL;
29 + } else if (strcmp(method, "Hibernate") == 0) {
30 + method_arg = NULL;
31 + }
32 +#endif
33 g_assert (method != NULL);
35 /* Take action */
36 g_debug ("About to call ConsoleKit2 method %s", method);
37 g_dbus_proxy_call (seat_manager_proxy,
38 method,
39 - g_variant_new ("(b)", FALSE),
40 + method_arg,
41 G_DBUS_CALL_FLAGS_NONE,
42 G_MAXINT,
43 NULL,