- Fix assertion failure in last patch

This commit is contained in:
Ray Strode 2008-10-10 00:38:15 +00:00
parent cced611965
commit 0bb290414d
2 changed files with 39 additions and 26 deletions

View File

@ -1,7 +1,7 @@
diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/gsm-consolekit.c
--- gnome-session-2.24.0/gnome-session/gsm-consolekit.c 2008-09-22 17:21:08.000000000 -0400
+++ new/gnome-session/gsm-consolekit.c 2008-10-09 11:32:26.000000000 -0400
@@ -54,6 +54,7 @@
diff -up gnome-session-2.24.0/gnome-session/gsm-consolekit.c.add-can-shutdown-api gnome-session-2.24.0/gnome-session/gsm-consolekit.c
--- gnome-session-2.24.0/gnome-session/gsm-consolekit.c.add-can-shutdown-api 2008-09-22 17:21:08.000000000 -0400
+++ gnome-session-2.24.0/gnome-session/gsm-consolekit.c 2008-10-09 13:30:44.000000000 -0400
@@ -54,6 +54,7 @@ struct _GsmConsolekitPrivate
DBusGConnection *dbus_connection;
DBusGProxy *bus_proxy;
DBusGProxy *ck_proxy;
@ -9,7 +9,7 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
guint32 is_connected : 1;
};
@@ -136,15 +137,29 @@
@@ -136,15 +137,29 @@ gsm_consolekit_class_init (GsmConsolekit
g_type_class_add_private (manager_class, sizeof (GsmConsolekitPrivate));
}
@ -39,7 +39,7 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
if (manager->priv->dbus_connection == NULL) {
manager->priv->dbus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM,
&connection_error);
@@ -154,6 +169,13 @@
@@ -154,6 +169,13 @@ gsm_consolekit_ensure_ck_connection (Gsm
is_connected = FALSE;
goto out;
}
@ -53,12 +53,13 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
}
if (manager->priv->bus_proxy == NULL) {
@@ -198,6 +220,24 @@
@@ -198,6 +220,27 @@ gsm_consolekit_ensure_ck_connection (Gsm
}
}
+ if (manager->priv->pk_tracker == NULL && connection != NULL) {
+ PolKitCaller *caller;
+ DBusError error;
+
+ manager->priv->pk_tracker = polkit_tracker_new ();
+ polkit_tracker_init (manager->priv->pk_tracker);
@ -67,8 +68,10 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
+
+ /* Prime the tracker's cache
+ */
+ dbus_error_init (&error);
+ caller = polkit_tracker_get_caller_from_dbus_name (manager->priv->pk_tracker,
+ CK_NAME, NULL);
+ CK_NAME, &error);
+ dbus_error_free (&error);
+
+ if (caller != NULL) {
+ g_object_unref (caller);
@ -78,7 +81,7 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
is_connected = TRUE;
out:
@@ -825,20 +865,61 @@
@@ -825,20 +868,68 @@ gsm_consolekit_can_switch_user (GsmConso
return ret;
}
@ -93,6 +96,7 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
+ PolKitAction *action;
+ PolKitCaller *caller;
+ PolKitResult result;
+ DBusError error;
+
+ gnome_context = polkit_gnome_context_get (NULL);
+
@ -109,12 +113,18 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
+ return FALSE;
+ }
+
+ dbus_error_init (&error);
+ caller =
+ polkit_tracker_get_caller_from_dbus_name (manager->priv->pk_tracker,
+ CK_NAME, NULL);
+ result = polkit_policy_default_can_caller_do_action (policy, action,
+ CK_NAME, &error);
+ dbus_error_free (&error);
+
+ if (caller != NULL) {
+ result = polkit_policy_default_can_caller_do_action (policy,
+ action,
+ caller);
+ polkit_caller_unref (caller);
+ }
+
+ return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN;
+}
@ -141,7 +151,7 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
#else
g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot restart system");
return FALSE;
@@ -857,8 +938,11 @@
@@ -857,8 +948,11 @@ gsm_consolekit_can_stop (GsmConsolekit *
g_warning ("Could not connect to ConsoleKit: %s",
error->message);
g_error_free (error);
@ -154,10 +164,10 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-consolekit.c new/gnome-session/g
#else
g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot stop system");
return FALSE;
diff -ru gnome-session-2.24.0/gnome-session/gsm-manager.c new/gnome-session/gsm-manager.c
--- gnome-session-2.24.0/gnome-session/gsm-manager.c 2008-09-22 17:21:08.000000000 -0400
+++ new/gnome-session/gsm-manager.c 2008-10-09 12:41:47.000000000 -0400
@@ -2313,6 +2313,35 @@
diff -up gnome-session-2.24.0/gnome-session/gsm-manager.c.add-can-shutdown-api gnome-session-2.24.0/gnome-session/gsm-manager.c
--- gnome-session-2.24.0/gnome-session/gsm-manager.c.add-can-shutdown-api 2008-09-22 17:21:08.000000000 -0400
+++ gnome-session-2.24.0/gnome-session/gsm-manager.c 2008-10-09 13:10:23.000000000 -0400
@@ -2313,6 +2313,35 @@ gsm_manager_shutdown (GsmManager *manage
}
gboolean
@ -193,10 +203,10 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-manager.c new/gnome-session/gsm-
gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error)
diff -ru gnome-session-2.24.0/gnome-session/gsm-manager.h new/gnome-session/gsm-manager.h
--- gnome-session-2.24.0/gnome-session/gsm-manager.h 2008-09-22 17:21:08.000000000 -0400
+++ new/gnome-session/gsm-manager.h 2008-10-09 12:42:20.000000000 -0400
@@ -151,6 +151,10 @@
diff -up gnome-session-2.24.0/gnome-session/gsm-manager.h.add-can-shutdown-api gnome-session-2.24.0/gnome-session/gsm-manager.h
--- gnome-session-2.24.0/gnome-session/gsm-manager.h.add-can-shutdown-api 2008-09-22 17:21:08.000000000 -0400
+++ gnome-session-2.24.0/gnome-session/gsm-manager.h 2008-10-09 13:10:23.000000000 -0400
@@ -151,6 +151,10 @@ gboolean gsm_manager_is_inhib
gboolean gsm_manager_shutdown (GsmManager *manager,
GError **error);
@ -207,9 +217,9 @@ diff -ru gnome-session-2.24.0/gnome-session/gsm-manager.h new/gnome-session/gsm-
gboolean gsm_manager_logout (GsmManager *manager,
guint logout_mode,
GError **error);
diff -ru gnome-session-2.24.0/gnome-session/org.gnome.SessionManager.xml new/gnome-session/org.gnome.SessionManager.xml
--- gnome-session-2.24.0/gnome-session/org.gnome.SessionManager.xml 2008-09-22 17:21:08.000000000 -0400
+++ new/gnome-session/org.gnome.SessionManager.xml 2008-10-09 12:35:17.000000000 -0400
diff -up gnome-session-2.24.0/gnome-session/org.gnome.SessionManager.xml.add-can-shutdown-api gnome-session-2.24.0/gnome-session/org.gnome.SessionManager.xml
--- gnome-session-2.24.0/gnome-session/org.gnome.SessionManager.xml.add-can-shutdown-api 2008-09-22 17:21:08.000000000 -0400
+++ gnome-session-2.24.0/gnome-session/org.gnome.SessionManager.xml 2008-10-09 14:33:59.000000000 -0400
@@ -252,6 +252,20 @@
</doc:doc>
</method>

View File

@ -12,7 +12,7 @@
Summary: GNOME session manager
Name: gnome-session
Version: 2.24.0
Release: 7%{?dist}
Release: 8%{?dist}
URL: http://www.gnome.org
Source0: http://download.gnome.org/sources/gnome-session/2.24/%{name}-%{version}.tar.bz2
Source1: redhat-default-session
@ -196,6 +196,9 @@ fi
%changelog
* Thu Oct 9 2008 Ray Strode <rstrode@redhat.com> - 2.24.0-8
- Fix assertion failure in last patch
* Thu Oct 9 2008 Ray Strode <rstrode@redhat.com> - 2.24.0-7
- Add new api for panel to figure out whether or not to show
Shutdown menu item.