summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gnome-base/gnome-session/files/gnome-session-2.26.2-shutdown.patch')
-rw-r--r--gnome-base/gnome-session/files/gnome-session-2.26.2-shutdown.patch123
1 files changed, 123 insertions, 0 deletions
diff --git a/gnome-base/gnome-session/files/gnome-session-2.26.2-shutdown.patch b/gnome-base/gnome-session/files/gnome-session-2.26.2-shutdown.patch
new file mode 100644
index 000000000000..29cc56955250
--- /dev/null
+++ b/gnome-base/gnome-session/files/gnome-session-2.26.2-shutdown.patch
@@ -0,0 +1,123 @@
+From 281e67308b9828a35ad863c39bd09e595c5e8771 Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <eva@gentoo.org>
+Date: Sun, 19 Apr 2009 16:45:29 +0200
+Subject: [PATCH 1/2] Allow shutdown without PolicyKit.
+
+ Straight forward fix to allow shutdown on systems not using policykit.
+
+ If the system really doesn't have policykit, it will make things work
+ as in 2.22.
+
+ If pk is in gsm but not in ck, it'll still work as in 2.22.
+
+ If pk is present in both, you just have to fix the logic to make
+ gsm ask pk if the user has the permission to shutdown _before_ showing
+ buttons and in case this is not possible, just damn fix pk.
+
+ reported as http://bugzilla.gnome.org/show_bug.cgi?id=549150
+---
+ gnome-session/gsm-consolekit.c | 38 ++++++++++++++++++++++----------------
+ 1 files changed, 22 insertions(+), 16 deletions(-)
+
+diff --git a/gnome-session/gsm-consolekit.c b/gnome-session/gsm-consolekit.c
+index 5541006..28f4cb7 100644
+--- a/gnome-session/gsm-consolekit.c
++++ b/gnome-session/gsm-consolekit.c
+@@ -541,7 +541,7 @@ request_restart_priv (GsmConsolekit *manager,
+ g_free (error_message);
+ }
+ #else
+- g_assert_not_reached ();
++ g_warning ("Failed to restart and Policykit support not enabled");
+ #endif /* HAVE POLKIT */
+ }
+
+@@ -581,7 +581,7 @@ request_stop_priv (GsmConsolekit *manager,
+ }
+ }
+ #else
+- g_assert_not_reached ();
++ g_warning ("Failed to shutdown and Policykit support not enabled");
+ #endif /* HAVE POLKIT */
+ }
+
+@@ -979,6 +979,15 @@ gsm_consolekit_can_do_action (GsmConsolekit *manager,
+
+ return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN;
+ }
++#else
++static gboolean
++gsm_consolekit_can_do_action (GsmConsolekit *manager,
++ const char *action_id)
++{
++ /* if we got here, res was true */
++ return TRUE;
++}
++#endif
+
+ static gboolean
+ gsm_consolekit_is_session_for_other_user (GsmConsolekit *manager,
+@@ -1096,6 +1105,7 @@ gsm_consolekit_is_single_user (GsmConsolekit *manager)
+ return single;
+ }
+
++#ifdef HAVE_POLKIT_GNOME
+ static void
+ obtain_privileges_cb (PolKitAction *action,
+ gboolean gained_privilege,
+@@ -1207,8 +1217,11 @@ gsm_consolekit_get_restart_privileges (GsmConsolekit *manager)
+ "org.freedesktop.consolekit.system.restart",
+ "org.freedesktop.consolekit.system.restart-multiple-users");
+ #else
+- g_debug ("GsmConsolekit: built without PolicyKit-gnome support");
+- return FALSE;
++ g_signal_emit (G_OBJECT (manager),
++ signals [PRIVILEGES_COMPLETED],
++ 0, TRUE, FALSE, FALSE);
++ g_debug ("GsmConsolekit: built without PolicyKit-gnome support, granting anyway");
++ return TRUE;
+ #endif
+ }
+
+@@ -1220,33 +1233,26 @@ gsm_consolekit_get_stop_privileges (GsmConsolekit *manager)
+ "org.freedesktop.consolekit.system.stop",
+ "org.freedesktop.consolekit.system.stop-multiple-users");
+ #else
+- g_debug ("GsmConsolekit: built without PolicyKit-gnome support");
+- return FALSE;
++ g_signal_emit (G_OBJECT (manager),
++ signals [PRIVILEGES_COMPLETED],
++ 0, TRUE, FALSE, FALSE);
++ g_debug ("GsmConsolekit: built without PolicyKit-gnome support, granting anyway");
++ return TRUE;
+ #endif
+ }
+
+ gboolean
+ gsm_consolekit_can_restart (GsmConsolekit *manager)
+ {
+-#ifdef HAVE_POLKIT_GNOME
+ return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart") ||
+ gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart-multiple-users");
+-#else
+- g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot restart system");
+- return FALSE;
+-#endif
+ }
+
+ gboolean
+ gsm_consolekit_can_stop (GsmConsolekit *manager)
+ {
+-#ifdef HAVE_POLKIT_GNOME
+ return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop") ||
+ gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop-multiple-users");
+-#else
+- g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot stop system");
+- return FALSE;
+-#endif
+ }
+
+ gchar *
+--
+1.6.3.3
+