rpms/gnome-packagekit/devel ck-multi.patch, NONE, 1.1 .cvsignore, 1.11, 1.12 gnome-packagekit.spec, 1.16, 1.17 sources, 1.11, 1.12

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Sun Apr 6 03:26:40 UTC 2008


Author: mclasen

Update of /cvs/extras/rpms/gnome-packagekit/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9363

Modified Files:
	.cvsignore gnome-packagekit.spec sources 
Added Files:
	ck-multi.patch 
Log Message:
0.1.11


ck-multi.patch:

--- NEW FILE ck-multi.patch ---
diff --git a/src/gpk-common.c b/src/gpk-common.c
index fd63bf4..a3ee237 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -169,19 +169,39 @@ static PolKitAction *
 get_action_from_error (GError *error)
 {
 	PolKitAction *action;
-	const gchar *paction;
+	gchar *paction, *p;
 
 	action = polkit_action_new ();
 
 	paction = NULL;
 	if (g_str_has_prefix (error->message, "Not privileged for action: ")) {
-		paction = error->message + strlen ("Not privileged for action: ");
+		paction = g_strdup (error->message + strlen ("Not privileged for action: "));
+		p = strchr (paction, ' ');
+		if (p)
+			*p = '\0';
 	}
 	polkit_action_set_action_id (action, paction);
 
+	g_free (paction);
+
 	return action;
 }
 
+static PolKitResult
+get_result_from_error (GError *error)
+{
+	PolKitResult result = POLKIT_RESULT_UNKNOWN;
+	const char *p;
+
+	p = strrchr (error->message, ' ');
+	if (p) {
+		p++;
+		polkit_result_from_string_representation (p, &result);
+	}
+
+	return result;
+}
+
 static void
 system_restart_auth_cb (PolKitAction *action, gboolean gained_privilege,
 			GError *error, DBusGProxy *proxy)
@@ -229,6 +249,8 @@ gpk_restart_system (void)
 	GError *error = NULL;
 	gboolean ret;
 	PolKitAction *action;
+	PolKitAction *action2;
+	PolKitResult result;
 
 	/* check dbus connections, exit if not valid */
 	connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -253,6 +275,25 @@ gpk_restart_system (void)
 	if (!ret) {
 		if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
 			action = get_action_from_error (error);
+			result = get_result_from_error (error);
+			
+			if (result == POLKIT_RESULT_NO) {
+				action2 = polkit_action_new ();
+				polkit_action_set_action_id (action2,
+							     "org.freedesktop.consolekit.system.restart-multiple-users");
+				if (polkit_action_equal (action, action2)) {
+					gpk_error_modal_dialog (_("Failed to restart"),
+								_("You are not allowed to restart the computer "
+								  "because multiple users are logged in"));
+				}
+
+				g_error_free (error);
+
+				polkit_action_unref (action);
+				polkit_action_unref (action2);
+
+				return FALSE;
+			}
 			g_clear_error (&error);
 			ret = request_restart_priv (proxy, action, &error);
 			polkit_action_unref (action);


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/gnome-packagekit/devel/.cvsignore,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- .cvsignore	28 Mar 2008 18:26:08 -0000	1.11
+++ .cvsignore	6 Apr 2008 03:26:03 -0000	1.12
@@ -1 +1 @@
-gnome-packagekit-0.1.10.tar.gz
+gnome-packagekit-0.1.11.tar.gz


Index: gnome-packagekit.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-packagekit/devel/gnome-packagekit.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- gnome-packagekit.spec	28 Mar 2008 18:26:08 -0000	1.16
+++ gnome-packagekit.spec	6 Apr 2008 03:26:03 -0000	1.17
@@ -1,5 +1,5 @@
 %define dbus_version 0.61
-%define packagekit_version       0.1.10
+%define packagekit_version       0.1.11
 
 Summary:   GNOME PackageKit Client
 Name:      gnome-packagekit
@@ -11,6 +11,8 @@
 Source0:   http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Patch0:    gnome-packagekit-enable-kde.patch
+# handle failed restarts a little better
+Patch1:	   ck-multi.patch
 Requires:  gtk2 >= 2.12.0
 Requires:  gnome-icon-theme
 Requires:  libnotify >= 0.4.3
@@ -49,6 +51,7 @@
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1 -b .ck-multi
 
 %build
 %configure --disable-scrollkeeper --disable-schemas-install
@@ -123,6 +126,9 @@
 %{_datadir}/applications/pk-*.desktop
 
 %changelog
+* Sat Apr  5 2008 Matthias Clasen  <mclasen at redhat.com> - 0.1.11-1
+- Update to 0.1.11
+
 * Fri Mar 28 2008 Bill Nottingham <notting at redhat.com> - 0.1.10-1
 - update to 0.1.10
 - add PK-gnome-devel build requirement


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/gnome-packagekit/devel/sources,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sources	28 Mar 2008 18:26:08 -0000	1.11
+++ sources	6 Apr 2008 03:26:03 -0000	1.12
@@ -1 +1 @@
-dfb88547d4b1bdc7a030911de54e5a73  gnome-packagekit-0.1.10.tar.gz
+a88939386d9e4d7c08678fc04807771a  gnome-packagekit-0.1.11.tar.gz




More information about the fedora-extras-commits mailing list