rpms/gnome-panel/F-9 gnome-panel-consolekit-restart-shutdown.patch, NONE, 1.1 gnome-panel.spec, 1.305, 1.306

Warren Togami 砥上勇 wtogami at fedoraproject.org
Mon Oct 13 00:03:29 UTC 2008


Author: wtogami

Update of /cvs/pkgs/rpms/gnome-panel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28381

Modified Files:
	gnome-panel.spec 
Added Files:
	gnome-panel-consolekit-restart-shutdown.patch 
Log Message:
- backport of GNOME Bug #536915
  Do not show Shutdown and Reboot if in non-ConsoleKit session
  LTSP blocker RH Bug #444552


gnome-panel-consolekit-restart-shutdown.patch:

--- NEW FILE gnome-panel-consolekit-restart-shutdown.patch ---
--- gnome-panel-2.22.2/gnome-panel/panel-consolekit.c	2008-10-12 18:57:57.000000000 -0400
+++ foo/gnome-panel/panel-consolekit.c	2008-10-12 18:56:40.000000000 -0400
@@ -649,11 +649,75 @@
 	}
 }
 
+#ifdef HAVE_POLKIT
+static gboolean
+panel_consolekit_can_do_action (PanelConsolekit *manager,
+                              const char      *action_id)
+{
+        PolKitGnomeContext *gnome_context;
+        PolKitAction *action;
+        PolKitCaller *caller;
+        DBusError dbus_error;
+        PolKitError *error;
+        PolKitResult result;
+
+        gnome_context = polkit_gnome_context_get (NULL);
+
+        if (gnome_context == NULL) {
+                return FALSE;
+        }
+
+        if (gnome_context->pk_tracker == NULL) {
+                return FALSE;
+        }
+
+        dbus_error_init (&dbus_error);
+        caller = polkit_tracker_get_caller_from_pid (gnome_context->pk_tracker,
+                                                     getpid (),
+                                                     &dbus_error);
+        dbus_error_free (&dbus_error);
+
+        if (caller == NULL) {
+                return FALSE;
+        }
+
+        action = polkit_action_new ();
+
+        if (!polkit_action_set_action_id (action, action_id)) {
+                polkit_action_unref (action);
+                polkit_caller_unref (caller);
+                return FALSE;
+        }
+
+        result = POLKIT_RESULT_UNKNOWN;
+        error = NULL;
+        result = polkit_context_is_caller_authorized (gnome_context->pk_context,
+                                                      action, caller, FALSE,
+                                                      &error);
+        if (polkit_error_is_set (error)) {
+                polkit_error_free (error);
+        }
+        polkit_action_unref (action);
+        polkit_caller_unref (caller);
+
+        return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN;
+}
+#endif
+
 gboolean
 panel_consolekit_can_restart (PanelConsolekit *manager)
 {
 #ifdef HAVE_POLKIT
-	return panel_consolekit_ensure_ck_connection (manager, NULL);
+        gboolean res;
+
+        res = panel_consolekit_ensure_ck_connection (manager, NULL);
+
+        if (!res) {
+                return FALSE;
+        }
+
+        return panel_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart") ||
+               panel_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart-multiple-users");
 #else
 	return FALSE;
 #endif
@@ -663,7 +727,16 @@
 panel_consolekit_can_stop (PanelConsolekit *manager)
 {
 #ifdef HAVE_POLKIT
-	return panel_consolekit_ensure_ck_connection (manager, NULL);
+        gboolean res;
+
+        res = panel_consolekit_ensure_ck_connection (manager, NULL);
+
+        if (!res) {
+                return FALSE;
+        }
+
+        return panel_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop") ||
+               panel_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop-multiple-users");
 #else
 	return FALSE;
 #endif


Index: gnome-panel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-panel/F-9/gnome-panel.spec,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -r1.305 -r1.306
--- gnome-panel.spec	14 Aug 2008 22:00:15 -0000	1.305
+++ gnome-panel.spec	13 Oct 2008 00:02:58 -0000	1.306
@@ -24,7 +24,7 @@
 Summary: GNOME panel
 Name: gnome-panel
 Version: 2.22.2
-Release: 2%{?dist}
+Release: 3%{?dist}
 URL: http://www.gnome.org
 Source0: http://download.gnome.org/sources/gnome-panel/2.22/%{name}-%{version}.tar.bz2
 
@@ -126,6 +126,7 @@
 
 # fixed upstream
 Patch37: cannot-set-time.patch
+Patch38: gnome-panel-consolekit-restart-shutdown.patch
 
 Conflicts: gnome-power-manager < 2.15.3
 
@@ -178,6 +179,7 @@
 %patch33 -p1 -b .use-gio
 %patch34 -p1 -b .launch-with-gio
 %patch37 -p1 -b .cannot-set-time
+%patch38 -p1 -b .consolekitrestart
 
 . %{SOURCE6}
 
@@ -362,6 +364,11 @@
 %{_datadir}/gtk-doc/html/*
 
 %changelog
+* Sun Oct 12 2008 Warren Togami <wtogami at redhat.com> - 2.22.2-3
+- backport of GNOME Bug #536915
+  Do not show Shutdown and Reboot if in non-ConsoleKit session
+  LTSP blocker RH Bug #444552
+
 * Tue Jul  8 2008 Matthias Clasen  <mclasen at redhat.com> - 2.22.2-2
 - Fix debuginfo generation
 




More information about the fedora-extras-commits mailing list