1
# Description: Port to PolicyKit 1.0 API.
2
# Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=585272
3
diff -Nur -x '*.orig' -x '*~' gdm-2.26.1/configure.ac gdm-2.26.1.new/configure.ac
4
--- gdm-2.26.1/configure.ac 2009-07-13 12:01:48.108491945 +0200
5
+++ gdm-2.26.1.new/configure.ac 2009-07-13 12:01:49.544491210 +0200
7
LIBGLADE_REQUIRED_VERSION=1.99.2
8
SCROLLKEEPER_REQUIRED_VERSION=0.1.4
9
GCONF_REQUIRED_VERSION=2.6.1
10
-POLICYKIT_REQUIRED_VERSION=0.8
11
GNOME_PANEL_REQUIRED_VERSION=2.0.0
12
LIBXKLAVIER_REQUIRED_VERSION=3.5
13
#FONTCONFIG_REQUIRED_VERSION=2.6.0
15
AC_SUBST(LIBXKLAVIER_CFLAGS)
16
AC_SUBST(LIBXKLAVIER_LIBS)
18
-PKG_CHECK_MODULES(POLKIT_GNOME,
19
- polkit-gnome >= $POLICYKIT_REQUIRED_VERSION,
23
-AC_ARG_ENABLE([polkit],
24
- AS_HELP_STRING([--enable-polkit],
25
- [Enable PolicyKit support @<:@default=auto@:>@]),
26
- enable_polkit=$enableval, enable_polkit=auto)
28
-if test "x$enable_polkit" != "xno"; then
29
- if test "x$enable_polkit" = "xyes" -a "x$have_polkit" = "xno"; then
30
- AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found])
33
- if test "x$have_polkit" = "xyes" ; then
34
- AC_DEFINE(HAVE_POLKIT_GNOME, [], [Define if we have polkit])
37
-AM_CONDITIONAL(HAVE_POLKIT_GNOME, test x$have_polkit = xyes)
38
-AC_SUBST(HAVE_POLKIT_GNOME)
39
-AC_SUBST(POLKIT_GNOME_CFLAGS)
40
-AC_SUBST(POLKIT_GNOME_LIBS)
42
PKG_CHECK_MODULES(SIMPLE_CHOOSER,
43
dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
44
gtk+-2.0 >= $GTK_REQUIRED_VERSION
45
diff -Nur -x '*.orig' -x '*~' gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c gdm-2.26.1.new/gui/simple-greeter/gdm-greeter-login-window.c
46
--- gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c 2009-02-20 03:45:09.000000000 +0100
47
+++ gdm-2.26.1.new/gui/simple-greeter/gdm-greeter-login-window.c 2009-07-13 12:02:05.829713541 +0200
49
#include <dbus/dbus-glib.h>
50
#include <dbus/dbus-glib-lowlevel.h>
52
-#ifdef HAVE_POLKIT_GNOME
53
-#include <polkit-gnome/polkit-gnome.h>
56
#include "gdm-settings-client.h"
57
#include "gdm-settings-keys.h"
58
#include "gdm-profile.h"
59
@@ -1030,119 +1026,6 @@
63
-#ifdef HAVE_POLKIT_GNOME
65
-system_restart_auth_cb (PolKitAction *action,
66
- gboolean gained_privilege,
68
- GdmGreeterLoginWindow *login_window)
70
- GError *local_error;
71
- DBusGConnection *connection;
74
- g_debug ("GdmGreeterLoginWindow: system restart auth callback gained=%s", gained_privilege ? "yes" : "no");
76
- if (! gained_privilege) {
77
- if (error != NULL) {
78
- g_warning ("GdmGreeterLoginWindow: system restart error: %s", error->message);
84
- connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &local_error);
85
- if (connection == NULL) {
86
- g_warning ("Unable to get system bus connection: %s", local_error->message);
87
- g_error_free (local_error);
91
- res = try_system_restart (connection, &local_error);
93
- g_warning ("Unable to restart system: %s", local_error->message);
94
- g_error_free (local_error);
100
-system_stop_auth_cb (PolKitAction *action,
101
- gboolean gained_privilege,
103
- GdmGreeterLoginWindow *login_window)
105
- GError *local_error;
106
- DBusGConnection *connection;
109
- g_debug ("GdmGreeterLoginWindow: system stop auth callback gained=%s", gained_privilege ? "yes" : "no");
111
- if (! gained_privilege) {
112
- if (error != NULL) {
113
- g_warning ("GdmGreeterLoginWindow: system stop error: %s", error->message);
118
- local_error = NULL;
119
- connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &local_error);
120
- if (connection == NULL) {
121
- g_warning ("Unable to get system bus connection: %s", local_error->message);
122
- g_error_free (local_error);
126
- res = try_system_stop (connection, &local_error);
128
- g_warning ("Unable to stop system: %s", local_error->message);
129
- g_error_free (local_error);
134
-static PolKitAction *
135
-get_action_from_error (GError *error)
137
- PolKitAction *action;
141
- action = polkit_action_new ();
144
- if (g_str_has_prefix (error->message, "Not privileged for action: ")) {
145
- paction = g_strdup (error->message + strlen ("Not privileged for action: "));
146
- p = strchr (paction, ' ');
151
- g_debug ("GdmGreeterLoginWindow: Requesting priv for '%s'", paction);
153
- polkit_action_set_action_id (action, paction);
161
-get_result_from_error (GError *error)
163
- PolKitResult result = POLKIT_RESULT_UNKNOWN;
166
- p = strrchr (error->message, ' ');
169
- polkit_result_from_string_representation (p, &result);
177
do_system_restart (GdmGreeterLoginWindow *login_window)
179
@@ -1159,69 +1042,12 @@
182
res = try_system_restart (connection, &error);
183
-#ifdef HAVE_POLKIT_GNOME
186
g_debug ("GdmGreeterLoginWindow: unable to restart system: %s: %s",
187
dbus_g_error_get_name (error),
190
- if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
191
- PolKitAction *action;
192
- PolKitAction *action2;
193
- PolKitResult result;
198
- result = get_result_from_error (error);
199
- action = get_action_from_error (error);
201
- if (result == POLKIT_RESULT_NO) {
202
- action2 = polkit_action_new ();
203
- polkit_action_set_action_id (action2,
204
- "org.freedesktop.consolekit.system.restart-multiple-users");
205
- dialog = gtk_message_dialog_new (GTK_WINDOW (login_window),
209
- _("Failed to restart computer"));
210
- if (polkit_action_equal (action, action2)) {
211
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
212
- _("You are not allowed to restart the computer "
213
- "because multiple users are logged in"));
215
- gtk_dialog_run (GTK_DIALOG (dialog));
216
- gtk_widget_destroy (dialog);
218
- polkit_action_unref (action);
219
- polkit_action_unref (action2);
221
- g_error_free (error);
229
- g_error_free (error);
231
- res = polkit_gnome_auth_obtain (action,
234
- (PolKitGnomeAuthCB) system_restart_auth_cb,
237
- polkit_action_unref (action);
240
- g_warning ("Unable to request privilege for action: %s", error->message);
241
- g_error_free (error);
245
+ g_error_free (error);
251
@@ -1240,67 +1066,12 @@
254
res = try_system_stop (connection, &error);
255
-#ifdef HAVE_POLKIT_GNOME
258
g_debug ("GdmGreeterLoginWindow: unable to stop system: %s: %s",
259
dbus_g_error_get_name (error),
262
- if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
263
- PolKitAction *action;
264
- PolKitAction *action2;
265
- PolKitResult result;
273
- result = get_result_from_error (error);
274
- action = get_action_from_error (error);
276
- if (result == POLKIT_RESULT_NO) {
277
- action2 = polkit_action_new ();
278
- polkit_action_set_action_id (action2,
279
- "org.freedesktop.consolekit.system.stop-multiple-users");
280
- dialog = gtk_message_dialog_new (GTK_WINDOW (login_window),
284
- _("Failed to stop computer"));
285
- if (polkit_action_equal (action, action2)) {
286
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
287
- _("You are not allowed to stop the computer "
288
- "because multiple users are logged in"));
290
- gtk_dialog_run (GTK_DIALOG (dialog));
291
- gtk_widget_destroy (dialog);
293
- polkit_action_unref (action);
294
- polkit_action_unref (action2);
299
- g_error_free (error);
301
- res = polkit_gnome_auth_obtain (action,
304
- (PolKitGnomeAuthCB) system_stop_auth_cb,
307
- polkit_action_unref (action);
310
- g_warning ("Unable to request privilege for action: %s", error->message);
311
- g_error_free (error);
315
+ g_error_free (error);
321
diff -Nur -x '*.orig' -x '*~' gdm-2.26.1/gui/simple-greeter/Makefile.am gdm-2.26.1.new/gui/simple-greeter/Makefile.am
322
--- gdm-2.26.1/gui/simple-greeter/Makefile.am 2009-02-20 03:45:09.000000000 +0100
323
+++ gdm-2.26.1.new/gui/simple-greeter/Makefile.am 2009-07-13 12:01:49.548475376 +0200
325
$(DISABLE_DEPRECATED_CFLAGS) \
327
$(SIMPLE_GREETER_CFLAGS) \
328
- $(POLKIT_GNOME_CFLAGS) \
331
@INTLTOOL_SCHEMAS_RULE@
335
$(SIMPLE_GREETER_LIBS) \
336
- $(POLKIT_GNOME_LIBS) \
343
$(SIMPLE_GREETER_LIBS) \
344
- $(POLKIT_GNOME_LIBS) \
347
test_user_manager_SOURCES = \
351
$(SIMPLE_GREETER_LIBS) \
352
- $(POLKIT_GNOME_LIBS) \
358
$(EXTRA_GREETER_LIBS) \
359
$(SIMPLE_GREETER_LIBS) \
360
- $(POLKIT_GNOME_LIBS) \
362
$(LIBXKLAVIER_LIBS) \