Index: network-manager-applet-0.7.0/src/connection-editor/nm-connection-list.c =================================================================== --- network-manager-applet-0.7.0/src/connection-editor/nm-connection-list.c (revision 1036) +++ network-manager-applet-0.7.0/src/connection-editor/nm-connection-list.c (working copy) @@ -37,11 +37,13 @@ #include <gconf/gconf-client.h> #include <glib/gi18n.h> +#ifdef USE_POLKIT #ifdef NO_POLKIT_GNOME #include "polkit-gnome.h" #else #include <polkit-gnome/polkit-gnome.h> #endif +#endif #include <nm-setting-connection.h> #include <nm-connection.h> @@ -285,6 +287,7 @@ update_connection_row (GtkListStore *sto /**********************************************/ /* PolKit helpers */ +#ifdef USE_POLKIT static gboolean is_permission_denied_error (GError *error) { @@ -327,6 +330,31 @@ obtain_auth (GError *pk_error, return success; } +#else +typedef struct PolKitAction { + guint32 foo; +} PolKitAction; + +typedef void (*PolKitGnomeAuthCB) (PolKitAction *action, + gboolean gained_privilege, + GError *error, + gpointer user_data); + +static gboolean +is_permission_denied_error (GError *error) +{ + return TRUE; +} + +static gboolean +obtain_auth (GError *pk_error, + PolKitGnomeAuthCB callback, + gpointer user_data) +{ + g_warning ("Could not grant permssion: %s", pk_error ? pk_error->message : "(unknown)"); + return FALSE; +} +#endif /**********************************************/ /* Connection removing */ Index: network-manager-applet-0.7.0/src/connection-editor/nm-connection-editor.c =================================================================== --- network-manager-applet-0.7.0/src/connection-editor/nm-connection-editor.c (revision 1036) +++ network-manager-applet-0.7.0/src/connection-editor/nm-connection-editor.c (working copy) @@ -39,11 +39,13 @@ #include <gtk/gtklabel.h> #include <glib/gi18n.h> +#ifdef USE_POLKIT #ifdef NO_POLKIT_GNOME #include "polkit-gnome.h" #else #include <polkit-gnome/polkit-gnome.h> #endif +#endif #include <nm-setting-connection.h> #include <nm-setting-ip4-config.h> @@ -162,7 +164,11 @@ connection_editor_validate (NMConnection valid = TRUE; done: +#ifdef USE_POLKIT g_object_set (editor->system_gnome_action, "master-sensitive", valid, NULL); +#else + gtk_widget_set_sensitive (editor->ok_button, valid); +#endif } static void @@ -183,10 +189,12 @@ system_checkbutton_toggled_cb (GtkWidget } else req_privs = TRUE; +#ifdef USE_POLKIT if (req_privs) g_object_set (editor->system_gnome_action, "polkit-action", editor->system_action, NULL); else g_object_set (editor->system_gnome_action, "polkit-action", NULL, NULL); +#endif /* Can't ever modify read-only connections */ s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION)); @@ -227,7 +235,7 @@ set_editor_sensitivity (NMConnectionEdit } static void -update_sensitivity (NMConnectionEditor *editor, PolKitResult pk_result) +update_sensitivity (NMConnectionEditor *editor, guint32 pk_result) { NMSettingConnection *s_con; gboolean denied = FALSE; @@ -239,11 +247,15 @@ update_sensitivity (NMConnectionEditor * return; } +#ifdef USE_POLKIT if (pk_result == POLKIT_RESULT_UNKNOWN) pk_result = polkit_gnome_action_get_polkit_result (editor->system_gnome_action); if (pk_result == POLKIT_RESULT_NO || pk_result == POLKIT_RESULT_UNKNOWN) denied = TRUE; +#else + denied = TRUE; +#endif switch (editor->orig_scope) { case NM_CONNECTION_SCOPE_SYSTEM: @@ -263,6 +275,7 @@ update_sensitivity (NMConnectionEditor * } } +#ifdef USE_POLKIT static void system_pk_result_changed_cb (PolKitGnomeAction *gnome_action, PolKitResult result, @@ -270,13 +283,16 @@ system_pk_result_changed_cb (PolKitGnome { update_sensitivity (editor, result); } +#endif static void nm_connection_editor_init (NMConnectionEditor *editor) { GtkWidget *dialog, *hbox; +#ifdef USE_POLKIT const char *auth_label, *auth_tooltip; const char *label, *tooltip; +#endif /* Yes, we mean applet.glade, not nm-connection-editor.glade. The wireless security bits are taken from applet.glade. */ @@ -309,6 +325,7 @@ nm_connection_editor_init (NMConnectionE editor->cancel_button = glade_xml_get_widget (editor->xml, "cancel_button"); editor->system_checkbutton = glade_xml_get_widget (editor->xml, "system_checkbutton"); +#if USE_POLKIT editor->system_action = polkit_action_new (); polkit_action_set_action_id (editor->system_action, "org.freedesktop.network-manager-settings.system.modify"); @@ -355,8 +372,11 @@ nm_connection_editor_init (NMConnectionE g_signal_connect (editor->system_gnome_action, "polkit-result-changed", G_CALLBACK (system_pk_result_changed_cb), editor); - editor->ok_button = polkit_gnome_action_create_button (editor->system_gnome_action); +#else + editor->ok_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); + gtk_widget_show_all (editor->ok_button); +#endif hbox = glade_xml_get_widget (editor->xml, "action_area_hbox"); gtk_box_pack_end (GTK_BOX (hbox), editor->ok_button, TRUE, TRUE, 0); } @@ -378,8 +398,10 @@ dispose (GObject *object) gtk_widget_destroy (editor->window); g_object_unref (editor->xml); +#ifdef USE_POLKIT polkit_action_unref (editor->system_action); g_object_unref (editor->system_gnome_action); +#endif G_OBJECT_CLASS (nm_connection_editor_parent_class)->dispose (object); } @@ -460,7 +482,7 @@ populate_connection_ui (NMConnectionEdit if (editor->orig_scope == NM_CONNECTION_SCOPE_SYSTEM) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->system_checkbutton), TRUE); - update_sensitivity (editor, POLKIT_RESULT_UNKNOWN); + update_sensitivity (editor, 0); } static void Index: network-manager-applet-0.7.0/src/connection-editor/nm-connection-editor.h =================================================================== --- network-manager-applet-0.7.0/src/connection-editor/nm-connection-editor.h (revision 1036) +++ network-manager-applet-0.7.0/src/connection-editor/nm-connection-editor.h (working copy) @@ -28,11 +28,14 @@ #include <glib-object.h> #include <glade/glade-xml.h> #include <nm-settings.h> + +#ifdef USE_POLKIT #ifdef NO_POLKIT_GNOME #include "polkit-gnome.h" #else #include <polkit-gnome/polkit-gnome.h> #endif +#endif #define NM_TYPE_CONNECTION_EDITOR (nm_connection_editor_get_type ()) #define NM_IS_CONNECTION_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_EDITOR)) @@ -45,8 +48,10 @@ typedef struct { NMConnection *connection; NMConnectionScope orig_scope; +#ifdef USE_POLKIT PolKitAction *system_action; PolKitGnomeAction *system_gnome_action; +#endif GtkWidget *system_checkbutton; gboolean system_settings_can_modify; Index: network-manager-applet-0.7.0/src/connection-editor/Makefile.am =================================================================== --- network-manager-applet-0.7.0/src/connection-editor/Makefile.am (revision 1036) +++ network-manager-applet-0.7.0/src/connection-editor/Makefile.am (working copy) @@ -11,18 +11,12 @@ nm_connection_editor_CPPFLAGS = \ -DLIBDIR=\""$(libdir)"\" \ -DNMALOCALEDIR=\"$(datadir)/locale\" \ $(DBUS_CFLAGS) \ - $(POLKIT_CFLAGS) \ $(DISABLE_DEPRECATED) \ -I${top_srcdir}/src/gconf-helpers \ -I${top_srcdir}/src/utils \ -I${top_srcdir}/src/wireless-security \ $(NULL) -if NO_POLKIT_GNOME -nm_connection_editor_CPPFLAGS += \ - -I${top_srcdir}/src/polkit-helpers -endif - nm_connection_editor_SOURCES = \ nm-connection-editor.c \ nm-connection-editor.h \ @@ -68,16 +62,10 @@ nm_connection_editor_LDADD = \ ${top_builddir}/src/wireless-security/libwireless-security.la \ ${top_builddir}/src/utils/libutils.la \ $(NMA_LIBS) \ - $(POLKIT_LIBS) \ -L${top_builddir}/../libnm-util $(top_builddir)/../libnm-util/libnm-util.la \ -L${top_builddir}/../libnm-glib $(top_builddir)/../libnm-glib/libnm_glib.la \ -L${top_builddir}/../libnm-glib $(top_builddir)/../libnm-glib/libnm_glib_vpn.la -if NO_POLKIT_GNOME -nm_connection_editor_LDADD += \ - ${top_builddir}/src/polkit-helpers/libpolkit-helpers.la -endif - gladedir = $(datadir)/nm-applet glade_DATA = \ nm-connection-editor.glade \ Index: src/Makefile.am =================================================================== --- network-manager-applet-0.7.0/src/Makefile.am (revision 1036) +++ network-manager-applet-0.7.0/src/Makefile.am (working copy) @@ -1,4 +1,4 @@ -SUBDIRS = marshallers utils gconf-helpers wireless-security polkit-helpers connection-editor +SUBDIRS = marshallers utils gconf-helpers wireless-security connection-editor NULL= Index: network-manager-applet-0.7.0/configure.ac =================================================================== --- network-manager-applet-0.7.0/configure.ac (revision 1036) +++ network-manager-applet-0.7.0/configure.ac (working copy) @@ -112,49 +112,6 @@ else fi AC_SUBST(DBUS_CFLAGS) -#### PolicyKit checks; need at least 0.6 or later -PKG_CHECK_EXISTS(polkit-gnome,[have_polkit_gnome=yes],[have_polkit_gnome=no]) -if test x"$have_polkit_gnome" = "xyes"; then - PKG_CHECK_MODULES(POLKIT, polkit-gnome) -else - PKG_CHECK_MODULES(POLKIT, [polkit >= 0.6]) - PKG_CHECK_MODULES(POLKIT_DBUS, [polkit-dbus >= 0.6]) - AC_DEFINE([NO_POLKIT_GNOME],[1],[Define if you don't have PolicyKit-gnome 0.7 or later]) -fi -AM_CONDITIONAL(NO_POLKIT_GNOME, test x"$have_polkit_gnome" = "xno") - -##### Find out the version of PolicyKit we're using -polkit_version=`pkg-config --modversion polkit` -POLKIT_VERSION_MAJOR=`echo $polkit_version | awk -F. '{print $1}'` -POLKIT_VERSION_MINOR=`echo $polkit_version | awk -F. '{print $2}'` -POLKIT_VERSION_MICRO=`echo $polkit_version | awk -F. '{print $3}'` -if test "z$POLKIT_VERSION_MAJOR" = "z"; then - POLKIT_VERSION_MAJOR="0" -fi -if test "z$POLKIT_VERSION_MINOR" = "z"; then - POLKIT_VERSION_MINOR="0" -fi -if test "z$POLKIT_VERSION_MICRO" = "z"; then - POLKIT_VERSION_MICRO="0" -fi - -if test "z$POLKIT_VERSION_MAJOR" = "z0" -a "z$POLKIT_VERSION_MINOR" = "z0" -a "z$POLKIT_VERSION_MICRO" = "z0"; then - echo "Error: Couldn't determine the version of your PolicyKit package." - echo " This is probably an error in this script, please report it" - echo " along with the following information:" - echo " Base PolicyKit version ='$polkit_version'" - echo " POLKIT_VERSION_MAJOR='$POLKIT_VERSION_MAJOR'" - echo " POLKIT_VERSION_MINOR='$POLKIT_VERSION_MINOR'" - echo " POLKIT_VERSION_MICRO='$POLKIT_VERSION_MICRO'" - exit 1 -else - echo "Your PolicyKit version is $POLKIT_VERSION_MAJOR,$POLKIT_VERSION_MINOR,$POLKIT_VERSION_MICRO." - POLKIT_CFLAGS="$POLKIT_CFLAGS -DPOLKIT_VERSION_MAJOR=$POLKIT_VERSION_MAJOR" - POLKIT_CFLAGS="$POLKIT_CFLAGS -DPOLKIT_VERSION_MINOR=$POLKIT_VERSION_MINOR" - POLKIT_CFLAGS="$POLKIT_CFLAGS -DPOLKIT_VERSION_MICRO=$POLKIT_VERSION_MICRO" -fi -AC_SUBST(POLKIT_CFLAGS) - AC_MSG_CHECKING([Linux Wireless Extensions >= 18]) AC_TRY_COMPILE([#ifndef __user #define __user @@ -221,7 +178,6 @@ src/marshallers/Makefile src/utils/Makefile src/gconf-helpers/Makefile src/wireless-security/Makefile -src/polkit-helpers/Makefile src/connection-editor/Makefile icons/Makefile po/Makefile.in