[gnome-system-tools] Port to PolicyKit1
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-system-tools] Port to PolicyKit1
- Date: Wed, 19 Aug 2009 13:59:39 +0000 (UTC)
commit 517ee4c35559d1a368810fde2aefadf9ea570069
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Sun Aug 16 13:38:56 2009 +0200
Port to PolicyKit1
This removes most usage of that lib on the client side. The backends now take care of most details, and GstPolKitButton is replaced by PolkitLockButton from libpolkit-gtk, which is now the only lib we link to. Add a requirement on the system-tools-backends >= 2.8 to be sure users don't mix Policykit versions.
configure.in | 26 ++--
src/common/Makefile.am | 6 -
src/common/gst-dialog.c | 37 ++--
src/common/gst-polkit-action.c | 424 ----------------------------------------
src/common/gst-polkit-action.h | 63 ------
src/common/gst-polkit-button.c | 335 -------------------------------
src/common/gst-polkit-button.h | 63 ------
src/users/callbacks.c | 4 -
8 files changed, 32 insertions(+), 926 deletions(-)
---
diff --git a/configure.in b/configure.in
index 43e50cd..9126612 100644
--- a/configure.in
+++ b/configure.in
@@ -27,12 +27,13 @@ AC_PROG_MAKE_SET
dnl glib-genmarshal
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+STB_REQUIRED=2.8
LIBOOBS_REQUIRED=2.21.3
GTK_REQUIRED=2.12
GLIB_REQUIRED=2.15.2
GCONF_REQUIRED=2.2.0
DBUS_REQUIRED=0.32
-POLICYKIT_REQUIRED=0.5
+POLICYKIT_GTK_REQUIRED=0.92
dnl =====================================================
@@ -78,6 +79,7 @@ PKG_CHECK_MODULES(GST_DEPENDS,[
gtk+-2.0 >= $GTK_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED
liboobs-1 >= $LIBOOBS_REQUIRED
+ system-tools-backends-2.0 >= $STB_REQUIRED
])
PKG_CHECK_MODULES(DBUS,[
@@ -88,20 +90,20 @@ DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
AC_SUBST(DBUS_LIBS)
AC_SUBST(DBUS_CFLAGS)
-dnl Policykit support
+dnl PolicyKit-GTK support
have_polkit=no
-AC_ARG_ENABLE(polkit,
- AS_HELP_STRING([--enable-polkit],[Enable policykit support (default yes)]),
- [], [enable_polkit=yes])
+AC_ARG_ENABLE(polkit-gtk,
+ AS_HELP_STRING([--enable-polkit-gtk],[Enable PolicyKit support using polkit-gtk (default yes)]),
+ [], [enable_polkit_gtk=yes])
-if test "x$enable_polkit" = "xyes"; then
- PKG_CHECK_MODULES(POLKIT,[polkit-dbus >= $POLICYKIT_REQUIRED], have_polkit=yes)
+if test "x$enable_polkit_gtk" = "xyes"; then
+ PKG_CHECK_MODULES(POLKIT_GTK,[polkit-gtk-1 >= $POLICYKIT_GTK_REQUIRED], have_polkit=yes)
if test "$have_polkit" = "yes"; then
- AC_DEFINE(HAVE_POLKIT, [1], [whether PolKit was found])
+ AC_DEFINE(HAVE_POLKIT, [1], [whether polkit-gtk was found])
else
- AC_MSG_ERROR([Policykit support requested but not found])
+ AC_MSG_ERROR([PolicyKit support requested but polkit-gtk not found])
fi
fi
@@ -190,8 +192,8 @@ dnl =====================================================
dnl GST_DEPRECATED_FLAGS="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED"
GST_DEPRECATED_FLAGS=""
-GST_LIBS="$GST_DEPENDS_LIBS $POLKIT_LIBS"
-GST_CFLAGS="$GST_DEPENDS_CFLAGS $POLKIT_CFLAGS $GST_DEPRECATED_FLAGS"
+GST_LIBS="$GST_DEPENDS_LIBS $POLKIT_GTK_LIBS"
+GST_CFLAGS="$GST_DEPENDS_CFLAGS $POLKIT_GTK_CFLAGS $GST_DEPRECATED_FLAGS"
GST_TOOL_LIBS="\$(top_builddir)/src/common/libsetuptool.a $GST_LIBS"
GST_TOOL_CFLAGS="-I\$(top_srcdir)/src/common $GST_CFLAGS"
@@ -318,7 +320,7 @@ Configuration (GST):
Time tool: ${enable_time}
Shares tool: ${enable_shares}
Nautilus support: ${enable_nautilus}
- Use PolKit: ${have_polkit}
+ Use PolKit-GTK: ${have_polkit}
Compiler: ${CC}
"
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 87a3c84..5cfbd69 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -19,10 +19,4 @@ libsetuptool_a_SOURCES = \
gst-service-role.c gst-service-role.h \
gst.h
-if HAVE_POLKIT
-libsetuptool_a_SOURCES += \
- gst-polkit-action.c gst-polkit-action.h \
- gst-polkit-button.c gst-polkit-button.h
-endif
-
EXTRA_DIST = CommonMakefile $(headers)
diff --git a/src/common/gst-dialog.c b/src/common/gst-dialog.c
index 859af42..40a065d 100644
--- a/src/common/gst-dialog.c
+++ b/src/common/gst-dialog.c
@@ -31,7 +31,7 @@
#include "gst-conf.h"
#ifdef HAVE_POLKIT
-#include "gst-polkit-button.h"
+#include <polkitgtk/polkitgtk.h>
#endif
#define GST_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_DIALOG, GstDialogPrivate))
@@ -174,22 +174,6 @@ gst_dialog_init (GstDialog *dialog)
priv->modified = FALSE;
priv->policy_widgets = NULL;
-
-#ifdef HAVE_POLKIT
- priv->polkit_button = gst_polkit_button_new (NULL, _("_Unlock"));
- gtk_widget_show (priv->polkit_button);
-
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
- priv->polkit_button, GTK_RESPONSE_NONE);
-
- g_signal_connect_swapped (priv->polkit_button, "changed",
- G_CALLBACK (gst_dialog_unlock), dialog);
-#endif
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_HELP, GTK_RESPONSE_HELP,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL);
}
static GObject*
@@ -240,12 +224,25 @@ gst_dialog_constructor (GType type,
#ifdef HAVE_POLKIT
if (priv->tool) {
const gchar *action;
+ GtkWidget *action_area;
action = oobs_session_get_authentication_action (priv->tool->session);
- gst_polkit_button_set_action (GST_POLKIT_BUTTON (priv->polkit_button), action);
+ priv->polkit_button = polkit_lock_button_new (action);
+ gtk_widget_show (priv->polkit_button);
+
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (action_area), priv->polkit_button, TRUE, TRUE, 0);
+
+ g_signal_connect_swapped (priv->polkit_button, "changed",
+ G_CALLBACK (gst_dialog_unlock), dialog);
}
#endif
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ NULL);
+
if (priv->title)
gtk_window_set_title (GTK_WINDOW (dialog), priv->title);
@@ -634,7 +631,9 @@ gst_dialog_is_authenticated (GstDialog *dialog)
priv = GST_DIALOG_GET_PRIVATE (dialog);
- return gst_polkit_button_get_authenticated (GST_POLKIT_BUTTON (priv->polkit_button));
+ return (polkit_lock_button_get_is_authorized (POLKIT_LOCK_BUTTON (priv->polkit_button)) ||
+ (polkit_lock_button_get_can_obtain (POLKIT_LOCK_BUTTON (priv->polkit_button)) &&
+ !polkit_lock_button_get_is_visible (POLKIT_LOCK_BUTTON (priv->polkit_button))));
#else
return TRUE;
#endif
diff --git a/src/users/callbacks.c b/src/users/callbacks.c
index 218310e..05e29e6 100644
--- a/src/users/callbacks.c
+++ b/src/users/callbacks.c
@@ -26,10 +26,6 @@
#include <config.h>
#include "gst.h"
-#ifdef HAVE_POLKIT
-#include "gst-polkit-action.h"
-#endif
-
#include "passwd.h"
#include "callbacks.h"
#include "table.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]