aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--debian/changelog21
-rw-r--r--debian/control2
-rwxr-xr-xdebian/rules1
-rw-r--r--src/gtk-dialog/ck-pk-helper.c98
-rw-r--r--src/gtk-dialog/ck-pk-helper.h4
6 files changed, 65 insertions, 65 deletions
diff --git a/configure.ac b/configure.ac
index 9b5c7e2..ad743f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
GTK_REQUIRED_VERSION=2.12
INDICATOR_REQUIRED_VERSION=0.2.0
DBUSMENUGTK_REQUIRED_VERSION=0.1.1
+POLKIT_REQUIRED_VERSION=0.92
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
@@ -55,7 +56,8 @@ AC_SUBST(SESSIONERVICE_CFLAGS)
AC_SUBST(SESSIONERVICE_LIBS)
PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-2.0 >= $GTK_REQUIRED_VERSION
- polkit-gnome)
+ polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)
+
AC_SUBST(GTKLOGOUTHELPER_CFLAGS)
AC_SUBST(GTKLOGOUTHELPER_LIBS)
diff --git a/debian/changelog b/debian/changelog
index 3223f2f..3faec71 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,17 +6,28 @@ indicator-session (0.1.4-0ubuntu1~ppa2~mc1) karmic; urgency=low
-- Ted Gould <ted@ubuntu.com> Tue, 22 Sep 2009 20:07:57 -0500
-indicator-session (0.1.4-0ubuntu1~ppa1) karmic; urgency=low
+indicator-session (0.1.4-0ubuntu3~ppa1) karmic; urgency=low
- * Upstream release 0.1.4
+ * Merging in trunk (PK Changes)
+ * Removing patches 01_polkit-1.patch and 99_autoreconf.patch
+ as they were merged upstream.
- -- Ted Gould <ted@ubuntu.com> Thu, 17 Sep 2009 11:08:07 -0500
+ -- Ted Gould <ted@ubuntu.com> Tue, 22 Sep 2009 21:35:10 -0500
+
+indicator-session (0.1.4-0ubuntu2) karmic; urgency=low
+
+ * Add 01_polkit-1.patch: Port to polkit-1. (LP: #412601)
+ * Add 99_autoreconf.patch: Autoconf changes for above patch.
+ * debian/control: libpolkit-gnome-dev → libpolkit-gobject-1-dev
-indicator-session (0.1.3-0ubuntu2~ppa1) karmic; urgency=low
+ -- Martin Pitt <martin.pitt@ubuntu.com> Tue, 22 Sep 2009 09:17:43 +0200
+indicator-session (0.1.4-0ubuntu1) karmic; urgency=low
+
+ * Upstream release (LP: #432120)
* Fixes to issues brought up by the design team.
- -- Ted Gould <ted@ubuntu.com> Wed, 16 Sep 2009 16:14:34 -0500
+ -- Ted Gould <ted@ubuntu.com> Thu, 17 Sep 2009 11:08:07 -0500
indicator-session (0.1.3-0ubuntu1) karmic; urgency=low
diff --git a/debian/control b/debian/control
index 9d36741..57aba13 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 5.0),
libindicator-dev,
libdbusmenu-glib-dev (>= 0.1.2),
libdbusmenu-gtk-dev (>= 0.1.2),
- libpolkit-gnome-dev,
+ libpolkit-gobject-1-dev,
intltool,
libempathy-dev (>= 2.27.0)
Standards-Version: 3.8.2
diff --git a/debian/rules b/debian/rules
index ce98752..b632517 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,7 @@
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/gnome.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper
LDFLAGS += -Wl,-z,defs -Wl,--as-needed
diff --git a/src/gtk-dialog/ck-pk-helper.c b/src/gtk-dialog/ck-pk-helper.c
index 466ccbc..dc7d900 100644
--- a/src/gtk-dialog/ck-pk-helper.c
+++ b/src/gtk-dialog/ck-pk-helper.c
@@ -24,7 +24,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <unistd.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
-#include <polkit-gnome/polkit-gnome.h>
+#include <polkit/polkit.h>
#include "logout-dialog.h"
#include "ck-pk-helper.h"
@@ -170,67 +170,53 @@ pk_require_auth (LogoutDialogAction action) {
}
}
- PolKitResult polres;
+ PolkitAuthorizationResult *polres = NULL;
+ gboolean ret = FALSE;
if (pk_can_do_action(pk_action, &polres)) {
- if (polres == POLKIT_RESULT_YES) {
- return FALSE;
+ if (polkit_authorization_result_get_is_challenge (polres)) {
+ ret = TRUE;
}
- return TRUE;
+ g_debug ("pk_require_auth(%s): authorized, is_challenge: %i", pk_action, ret);
+ } else {
+ g_debug ("pk_require_auth(%s): not authorized", pk_action);
+ }
+ if (polres) {
+ g_object_unref (polres);
}
- return FALSE;
+ return ret;
}
gboolean
-pk_can_do_action (const gchar *action_id, PolKitResult * pol_result)
+pk_can_do_action (const gchar *action_id, PolkitAuthorizationResult ** pol_result)
{
- 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);
-
- if (pol_result != NULL) {
- *pol_result = result;
- }
+ PolkitAuthority *authority;
+ PolkitSubject *subject;
+ PolkitAuthorizationResult *result;
+ gboolean ret;
+
+ authority = polkit_authority_get();
+ if (!authority) {
+ g_warning ("Could not get PolicyKit authority instance");
+ return FALSE;
+ }
+ subject = polkit_unix_process_new (getpid());
- return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN;
+ result = polkit_authority_check_authorization_sync (authority, subject, action_id, NULL, 0, NULL, NULL);
+ g_object_unref (authority);
+
+ ret = FALSE;
+ if (result) {
+ ret = polkit_authorization_result_get_is_authorized (result) ||
+ polkit_authorization_result_get_is_challenge (result);
+ g_debug ("pk_can_do_action(%s): %i", action_id, ret);
+ } else {
+ g_warning ("pk_can_do_action(%s): check_authorization returned NULL", action_id);
+ }
+ if (pol_result) {
+ *pol_result = result;
+ } else {
+ g_object_unref (result);
+ }
+ return ret;
+
}
diff --git a/src/gtk-dialog/ck-pk-helper.h b/src/gtk-dialog/ck-pk-helper.h
index 98bce56..501a8c8 100644
--- a/src/gtk-dialog/ck-pk-helper.h
+++ b/src/gtk-dialog/ck-pk-helper.h
@@ -24,9 +24,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __CK_PK_HELPER_H__
#define __CK_PK_HELPER_H__ 1
-#include <polkit-gnome/polkit-gnome.h>
+#include <polkit/polkit.h>
gboolean pk_require_auth (LogoutDialogAction action);
-gboolean pk_can_do_action (const gchar *action_id, PolKitResult * pol_result);
+gboolean pk_can_do_action (const gchar *action_id, PolkitAuthorizationResult ** pol_result);
#endif /* __CK_PK_HELPER__ */