From fa93d278ee67c6fc17cbd07958c5cf1499f30cea Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 10 Jun 2009 04:20:34 +0000 Subject: Port to PolicyKit 1 --- gnome-panel.spec | 26 +- polkit1.patch | 789 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 803 insertions(+), 12 deletions(-) create mode 100644 polkit1.patch diff --git a/gnome-panel.spec b/gnome-panel.spec index 7afb60d..8a85a9a 100644 --- a/gnome-panel.spec +++ b/gnome-panel.spec @@ -23,7 +23,7 @@ Summary: GNOME panel Name: gnome-panel Version: 2.26.2 -Release: 2%{?dist} +Release: 3%{?dist} URL: http://www.gnome.org Source0: http://download.gnome.org/sources/gnome-panel/2.26/%{name}-%{version}.tar.bz2 @@ -41,7 +41,6 @@ Requires: gnome-menus >= %{gnome_menus_version} %if %{use_evolution_data_server} Requires: evolution-data-server >= %{evolution_data_server_version} %endif -Requires: PolicyKit-authentication-agent Requires: gnome-session-xsession Requires(post): GConf2 >= %{gconf_version} @@ -82,8 +81,7 @@ BuildRequires: evolution-data-server-devel >= %{evolution_data_server_version} BuildRequires: ORBit2-devel >= %{orbit_version} BuildRequires: dbus-devel >= %{dbus_version} %endif -BuildRequires: PolicyKit-devel -BuildRequires: PolicyKit-gnome-devel +BuildRequires: polkit-devel >= 0.92 BuildRequires: libgweather-devel >= %{libgweather_version} BuildRequires: librsvg2-devel BuildRequires: NetworkManager-devel @@ -118,6 +116,9 @@ Patch35: clock-wakeups.patch # http://bugzilla.gnome.org/show_bug.cgi?id=579092 Patch38: clock-network.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=498366 +Patch42: polkit1.patch + Conflicts: gnome-power-manager < 2.15.3 %description @@ -165,8 +166,7 @@ Panel Applets using the libpanel-applet library. %patch24 -p1 -b .allow-spurious-view-done-signals %patch35 -p1 -b .clock-wakeups %patch38 -p1 -b .clock-network - -libtoolize --force --copy +%patch42 -p1 -b .polkit1 . %{SOURCE6} @@ -174,6 +174,10 @@ cp -f %{SOURCE3} gnome-panel/panel-default-setup.entries cp -f %{SOURCE4} m4 cp -f %{SOURCE5} gnome-panel/panel-compatibility.schemas +aclocal -I m4 +automake +autoconf + # strip unneeded translations from .mo files # ideally intltool (ha!) would do that for us # http://bugzilla.gnome.org/show_bug.cgi?id=474987 @@ -188,11 +192,6 @@ done %build -# gpm-integration patches Makefile.am and configure.in -aclocal -I m4 -automake --add-missing -autoheader -autoconf %configure \ --disable-gtk-doc \ --disable-scrollkeeper \ @@ -352,7 +351,7 @@ fi %{_sysconfdir}/dbus-1/system.d/org.gnome.ClockApplet.Mechanism.conf %{_datadir}/dbus-1/system-services/org.gnome.ClockApplet.Mechanism.service -%{_datadir}/PolicyKit/policy/org.gnome.clockapplet.mechanism.policy +%{_datadir}/polkit-1/actions/org.gnome.clockapplet.mechanism.policy %files libs %{_libdir}/*.so.* @@ -366,6 +365,9 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Tue Jun 9 2009 Matthias Clasen - 2.26.2-3 +- Port to PolicyKit 1 + * Tue Jun 2 2009 Matthias Clasen - 2.26.2-2 - Replace tomboy by gnote in the default panel configuration diff --git a/polkit1.patch b/polkit1.patch new file mode 100644 index 0000000..b34aefc --- /dev/null +++ b/polkit1.patch @@ -0,0 +1,789 @@ +diff -up gnome-panel-2.26.1/applets/clock/clock.c.polkit1 gnome-panel-2.26.1/applets/clock/clock.c +--- gnome-panel-2.26.1/applets/clock/clock.c.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/clock.c 2009-05-13 17:53:57.490936276 -0400 +@@ -1707,7 +1707,7 @@ update_set_time_button (ClockData *cd) + { + gint can_set; + +- can_set = can_set_system_time (); /* this can return 0, 1, 2 */ ++ can_set = can_set_system_time (); + + if (cd->time_settings_button) + gtk_widget_set_sensitive (cd->time_settings_button, can_set); +@@ -1770,7 +1770,7 @@ set_time (GtkWidget *widget, ClockData * + + tim = mktime (&t); + +- set_system_time_async (tim, GDK_WINDOW_XWINDOW (cd->applet->window), (GFunc)set_time_callback, cd, NULL); ++ set_system_time_async (tim, (GFunc)set_time_callback, cd, NULL); + } + + static void +diff -up gnome-panel-2.26.1/applets/clock/clock-location.c.polkit1 gnome-panel-2.26.1/applets/clock/clock-location.c +--- gnome-panel-2.26.1/applets/clock/clock-location.c.polkit1 2009-05-13 17:53:57.477962768 -0400 ++++ gnome-panel-2.26.1/applets/clock/clock-location.c 2009-05-13 17:53:57.491936414 -0400 +@@ -537,8 +537,7 @@ clock_location_make_current (ClockLocati + + filename = g_build_filename (SYSTEM_ZONEINFODIR, priv->timezone, NULL); + set_system_timezone_async (filename, +- transient_parent_xid, +- (GFunc)make_current_cb, ++ (GFunc)make_current_cb, + mcdata, + free_make_current_data); + g_free (filename); +diff -up gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.c.polkit1 gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.c +--- gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.c.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.c 2009-05-13 18:00:51.818938425 -0400 +@@ -37,7 +37,7 @@ + #include + #include + +-#include ++#include + + #include "system-timezone.h" + +@@ -68,7 +68,7 @@ struct GnomeClockAppletMechanismPrivate + { + DBusGConnection *system_bus_connection; + DBusGProxy *system_bus_proxy; +- PolKitContext *pol_ctx; ++ PolkitAuthority *auth; + }; + + static void gnome_clock_applet_mechanism_finalize (GObject *object); +@@ -172,50 +172,11 @@ gnome_clock_applet_mechanism_finalize (G + } + + static gboolean +-pk_io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_data) +-{ +- int fd; +- PolKitContext *pk_context = user_data; +- fd = g_io_channel_unix_get_fd (channel); +- polkit_context_io_func (pk_context, fd); +- return TRUE; +-} +- +-static int +-pk_io_add_watch (PolKitContext *pk_context, int fd) +-{ +- guint id = 0; +- GIOChannel *channel; +- channel = g_io_channel_unix_new (fd); +- if (channel == NULL) +- goto out; +- id = g_io_add_watch (channel, G_IO_IN, pk_io_watch_have_data, pk_context); +- if (id == 0) { +- g_io_channel_unref (channel); +- goto out; +- } +- g_io_channel_unref (channel); +-out: +- return id; +-} +- +-static void +-pk_io_remove_watch (PolKitContext *pk_context, int watch_id) +-{ +- g_source_remove (watch_id); +-} +- +-static gboolean + register_mechanism (GnomeClockAppletMechanism *mechanism) + { + GError *error = NULL; + +- mechanism->priv->pol_ctx = polkit_context_new (); +- polkit_context_set_io_watch_functions (mechanism->priv->pol_ctx, pk_io_add_watch, pk_io_remove_watch); +- if (!polkit_context_init (mechanism->priv->pol_ctx, NULL)) { +- g_critical ("cannot initialize libpolkit"); +- goto error; +- } ++ mechanism->priv->auth = polkit_authority_get (); + + error = NULL; + mechanism->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); +@@ -266,49 +227,36 @@ _check_polkit_for_action (GnomeClockAppl + { + const char *sender; + GError *error; +- DBusError dbus_error; +- PolKitCaller *pk_caller; +- PolKitAction *pk_action; +- PolKitResult pk_result; ++ PolkitSubject *subject; ++ PolkitAuthorizationResult *result; + + error = NULL; + + /* Check that caller is privileged */ + sender = dbus_g_method_get_sender (context); +- dbus_error_init (&dbus_error); +- pk_caller = polkit_caller_new_from_dbus_name ( +- dbus_g_connection_get_connection (mechanism->priv->system_bus_connection), +- sender, +- &dbus_error); +- if (pk_caller == NULL) { +- error = g_error_new (GNOME_CLOCK_APPLET_MECHANISM_ERROR, +- GNOME_CLOCK_APPLET_MECHANISM_ERROR_GENERAL, +- "Error getting information about caller: %s: %s", +- dbus_error.name, dbus_error.message); +- dbus_error_free (&dbus_error); +- dbus_g_method_return_error (context, error); +- g_error_free (error); +- return FALSE; +- } ++ subject = polkit_system_bus_name_new (sender); + +- pk_action = polkit_action_new (); +- polkit_action_set_action_id (pk_action, action); +- pk_result = polkit_context_is_caller_authorized (mechanism->priv->pol_ctx, pk_action, pk_caller, FALSE, NULL); +- polkit_caller_unref (pk_caller); +- polkit_action_unref (pk_action); ++ result = polkit_authority_check_authorization_sync (mechanism->priv->auth, ++ subject, ++ action, ++ NULL, ++ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, ++ NULL, NULL); ++ g_object_unref (subject); + +- if (pk_result != POLKIT_RESULT_YES) { ++ if (!polkit_authorization_result_get_is_authorized (result)) { + error = g_error_new (GNOME_CLOCK_APPLET_MECHANISM_ERROR, + GNOME_CLOCK_APPLET_MECHANISM_ERROR_NOT_PRIVILEGED, +- "%s %s <-- (action, result)", +- action, +- polkit_result_to_string_representation (pk_result)); +- dbus_error_free (&dbus_error); ++ "Not Authorized for action %s", action); + dbus_g_method_return_error (context, error); + g_error_free (error); ++ g_object_unref (result); ++ + return FALSE; + } + ++ g_object_unref (result); ++ + return TRUE; + } + +@@ -607,5 +555,61 @@ gnome_clock_applet_mechanism_set_hardwar + } + dbus_g_method_return (context); + return TRUE; ++} ++ ++static void ++check_can_do (GnomeClockAppletMechanism *mechanism, ++ const char *action, ++ DBusGMethodInvocation *context) ++{ ++ const char *sender; ++ PolkitSubject *subject; ++ PolkitAuthorizationResult *result; ++ ++ /* Check that caller is privileged */ ++ sender = dbus_g_method_get_sender (context); ++ subject = polkit_system_bus_name_new (sender); ++ ++ result = polkit_authority_check_authorization_sync (mechanism->priv->auth, ++ subject, ++ action, ++ NULL, ++ 0, ++ NULL, NULL); ++ g_object_unref (subject); ++ ++ if (polkit_authorization_result_get_is_authorized (result)) { ++ dbus_g_method_return (context, 2); ++ } ++ else if (polkit_authorization_result_get_is_challenge (result)) { ++ dbus_g_method_return (context, 1); ++ } ++ else { ++ dbus_g_method_return (context, 0); ++ } ++ ++ g_object_unref (result); ++} ++ ++ ++gboolean ++gnome_clock_applet_mechanism_can_set_time (GnomeClockAppletMechanism *mechanism, ++ DBusGMethodInvocation *context) ++{ ++ check_can_do (mechanism, ++ "org.gnome.clockapplet.mechanism.settime", ++ context); ++ ++ return TRUE; ++} ++ ++gboolean ++gnome_clock_applet_mechanism_can_set_timezone (GnomeClockAppletMechanism *mechanism, ++ DBusGMethodInvocation *context) ++{ ++ check_can_do (mechanism, ++ "org.gnome.clockapplet.mechanism.settimezone", ++ context); + ++ return TRUE; + } +diff -up gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.h.polkit1 gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.h +--- gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.h.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.h 2009-05-13 17:53:57.493994728 -0400 +@@ -69,9 +69,14 @@ gboolean gnome_clock_applet_m + const char *zone_file, + DBusGMethodInvocation *context); + ++gboolean gnome_clock_applet_mechanism_can_set_timezone (GnomeClockAppletMechanism *mechanism, ++ DBusGMethodInvocation *context); ++ + gboolean gnome_clock_applet_mechanism_set_time (GnomeClockAppletMechanism *mechanism, + gint64 seconds_since_epoch, + DBusGMethodInvocation *context); ++gboolean gnome_clock_applet_mechanism_can_set_time (GnomeClockAppletMechanism *mechanism, ++ DBusGMethodInvocation *context); + + gboolean gnome_clock_applet_mechanism_adjust_time (GnomeClockAppletMechanism *mechanism, + gint64 seconds_to_add, +diff -up gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.xml.polkit1 gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.xml +--- gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.xml.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/gnome-clock-applet-mechanism.xml 2009-05-13 17:53:57.494962879 -0400 +@@ -5,10 +5,18 @@ + + + ++ ++ ++ ++ + + + + ++ ++ ++ ++ + + + +diff -up gnome-panel-2.26.1/applets/clock/Makefile.am.polkit1 gnome-panel-2.26.1/applets/clock/Makefile.am +--- gnome-panel-2.26.1/applets/clock/Makefile.am.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/Makefile.am 2009-05-13 17:53:57.495947232 -0400 +@@ -7,7 +7,7 @@ INCLUDES = \ + $(GNOME_INCLUDEDIR) \ + $(WARN_CFLAGS) \ + $(CLOCK_CFLAGS) \ +- $(POLKIT_GNOME_CFLAGS) \ ++ $(POLKIT_CFLAGS) \ + $(LIBPANEL_APPLET_CFLAGS) \ + -DDATADIR=\""$(datadir)"\" \ + -DGLADEDIR=\""$(datadir)/gnome-panel/glade"\" \ +@@ -66,7 +66,7 @@ CLOCK_LDADD = \ + ../../libpanel-applet/libpanel-applet-2.la \ + $(CLOCK_LIBS) \ + $(LIBPANEL_APPLET_LIBS) \ +- $(POLKIT_GNOME_LIBS) \ ++ $(POLKIT_LIBS) \ + -lgweather + + BUILT_SOURCES = \ +@@ -128,11 +128,11 @@ endif + + gnome_clock_applet_mechanism_INCLUDES = \ + $(CLOCK_MECHANISM_CFLAGS) \ +- $(POLKIT_GNOME_CFLAGS) ++ $(POLKIT_CFLAGS) + + gnome_clock_applet_mechanism_LDADD = \ + $(CLOCK_MECHANISM_LIBS) \ +- $(POLKIT_GNOME_LIBS) ++ $(POLKIT_LIBS) + + if CLOCK_INPROCESS + APPLET_TYPE = shlib +@@ -201,7 +201,7 @@ endif + + dbus_servicesdir = $(datadir)/dbus-1/system-services + dbus_confdir = $(sysconfdir)/dbus-1/system.d +-polkitdir = $(datadir)/PolicyKit/policy ++polkitdir = $(datadir)/polkit-1/actions + + dbus_services_in_files = org.gnome.ClockApplet.Mechanism.service.in + polkit_in_files = org.gnome.clockapplet.mechanism.policy.in +diff -up gnome-panel-2.26.1/applets/clock/org.gnome.clockapplet.mechanism.policy.in.polkit1 gnome-panel-2.26.1/applets/clock/org.gnome.clockapplet.mechanism.policy.in +--- gnome-panel-2.26.1/applets/clock/org.gnome.clockapplet.mechanism.policy.in.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/org.gnome.clockapplet.mechanism.policy.in 2009-05-13 17:53:57.496936685 -0400 +@@ -13,7 +13,7 @@ + <_message>Privileges are required to change the system time zone. + + no +- auth_self_keep_always ++ auth_self_keep + + + +@@ -22,7 +22,7 @@ + <_message>Privileges are required to change the system time. + + no +- auth_self_keep_always ++ auth_self_keep + + + +@@ -31,7 +31,7 @@ + <_message>Privileges are required to configure the hardware clock. + + no +- auth_self_keep_always ++ auth_self_keep + + + +diff -up gnome-panel-2.26.1/applets/clock/set-timezone.c.polkit1 gnome-panel-2.26.1/applets/clock/set-timezone.c +--- gnome-panel-2.26.1/applets/clock/set-timezone.c.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/set-timezone.c 2009-05-13 17:53:57.497965108 -0400 +@@ -32,31 +32,8 @@ + #include + #include + +-#include +-#include +- + #include "set-timezone.h" + +-#define CACHE_VALIDITY_SEC 2 +- +-static DBusGConnection * +-get_session_bus (void) +-{ +- GError *error; +- static DBusGConnection *bus = NULL; +- +- if (bus == NULL) { +- error = NULL; +- bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); +- if (bus == NULL) { +- g_warning ("Couldn't connect to session bus: %s", +- error->message); +- g_error_free (error); +- } +- } +- +- return bus; +-} + + static DBusGConnection * + get_system_bus (void) +@@ -77,148 +54,96 @@ get_system_bus (void) + return bus; + } + +-static gboolean +-pk_io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_data) +-{ +- int fd; +- PolKitContext *pk_context = user_data; +- fd = g_io_channel_unix_get_fd (channel); +- polkit_context_io_func (pk_context, fd); +- return TRUE; +-} +- +-static int +-pk_io_add_watch_fn (PolKitContext *pk_context, int fd) +-{ +- guint id = 0; +- GIOChannel *channel; +- channel = g_io_channel_unix_new (fd); +- if (channel == NULL) +- goto out; +- id = g_io_add_watch (channel, G_IO_IN, pk_io_watch_have_data, pk_context); +- if (id == 0) { +- g_io_channel_unref (channel); +- goto out; +- } +- g_io_channel_unref (channel); +-out: +- return id; +-} ++#define CACHE_VALIDITY_SEC 2 + +-static void +-pk_io_remove_watch_fn (PolKitContext *pk_context, int watch_id) +-{ +- g_source_remove (watch_id); +-} ++typedef void (*CanDoFunc) (gint value); + +-static PolKitContext * +-get_pk_context (void) ++static void ++can_do_notify (DBusGProxy *proxy, ++ DBusGProxyCall *call, ++ void *user_data) + { +- static PolKitContext *pk_context = NULL; ++ CanDoFunc callback = user_data; ++ GError *error = NULL; ++ gint value; + +- if (pk_context == NULL) { +- pk_context = polkit_context_new (); +- polkit_context_set_io_watch_functions (pk_context, +- pk_io_add_watch_fn, +- pk_io_remove_watch_fn); +- if (!polkit_context_init (pk_context, NULL)) { +- polkit_context_unref (pk_context); +- pk_context = NULL; +- } ++ if (dbus_g_proxy_end_call (proxy, call, ++ &error, ++ G_TYPE_INT, &value, ++ G_TYPE_INVALID)) { ++ callback (value); + } +- +- return pk_context; + } + +-static gint +-can_do (const gchar *pk_action_id) ++static void ++can_do_refresh (const gchar *action, CanDoFunc callback) + { +- DBusConnection *system_bus; +- PolKitCaller *pk_caller; +- PolKitAction *pk_action; +- PolKitResult pk_result; +- PolKitContext *pk_context; +- DBusError dbus_error; +- gint res = 0; +- +- pk_caller = NULL; +- pk_action = NULL; +- +- system_bus = dbus_g_connection_get_connection (get_system_bus ()); +- if (system_bus == NULL) +- goto out; +- +- pk_context = get_pk_context (); +- if (pk_context == NULL) +- goto out; +- +- pk_action = polkit_action_new (); +- polkit_action_set_action_id (pk_action, pk_action_id); +- +- dbus_error_init (&dbus_error); +- pk_caller = polkit_caller_new_from_pid (system_bus, getpid (), &dbus_error); +- if (pk_caller == NULL) { +- fprintf (stderr, "cannot get caller from dbus name\n"); +- goto out; +- } ++ DBusGConnection *bus; ++ DBusGProxy *proxy; + +- pk_result = polkit_context_is_caller_authorized (pk_context, pk_action, pk_caller, FALSE, NULL); ++ bus = get_system_bus (); ++ if (bus == NULL) ++ return; + +- switch (pk_result) { +- case POLKIT_RESULT_UNKNOWN: +- case POLKIT_RESULT_NO: +- res = 0; +- break; +- case POLKIT_RESULT_YES: +- res = 2; +- break; +- default: +- /* This covers all the POLKIT_RESULT_ONLY_VIA_[SELF|ADMIN]_AUTH_* cases as more of these +- * may be added in the future. +- */ +- res = 1; +- break; +- } +- +-out: +- if (pk_action != NULL) +- polkit_action_unref (pk_action); +- if (pk_caller != NULL) +- polkit_caller_unref (pk_caller); ++ proxy = dbus_g_proxy_new_for_name (bus, ++ "org.gnome.ClockApplet.Mechanism", ++ "/", ++ "org.gnome.ClockApplet.Mechanism"); ++ ++ dbus_g_proxy_begin_call_with_timeout (proxy, ++ action, ++ can_do_notify, ++ callback, NULL, ++ INT_MAX, ++ G_TYPE_INVALID); ++} + +- return res; ++static gint settimezone_cache = 0; ++static time_t settimezone_stamp = 0; ++ ++static void ++update_can_settimezone (gint res) ++{ ++ settimezone_cache = res; ++ time (&settimezone_stamp); + } + + gint + can_set_system_timezone (void) + { +- static gboolean cache = FALSE; +- static time_t last_refreshed = 0; + time_t now; + + time (&now); +- if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) { +- cache = can_do ("org.gnome.clockapplet.mechanism.settimezone"); +- last_refreshed = now; ++ if (ABS (now - settimezone_stamp) > CACHE_VALIDITY_SEC) { ++ can_do_refresh ("CanSetTimezone", update_can_settimezone); ++ settimezone_stamp = now; + } + +- return cache; ++ return settimezone_cache; ++} ++ ++static gint settime_cache = 0; ++static time_t settime_stamp = 0; ++ ++static void ++update_can_settime (gint res) ++{ ++ settime_cache = res; ++ time (&settime_stamp); + } + + gint + can_set_system_time (void) + { +- static gboolean cache = FALSE; +- static time_t last_refreshed = 0; +- time_t now; ++ time_t now; + + time (&now); +- if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) { +- cache = can_do ("org.gnome.clockapplet.mechanism.settime"); +- last_refreshed = now; ++ if (ABS (now - settime_stamp) > CACHE_VALIDITY_SEC) { ++ can_do_refresh ("CanSetTime", update_can_settime); ++ settime_stamp = now; + } + +- return cache; ++ return settime_cache; + } + + typedef struct { +@@ -226,7 +151,6 @@ typedef struct { + gchar *call; + gint64 time; + gchar *filename; +- guint transient_parent_xid; + GFunc callback; + gpointer data; + GDestroyNotify notify; +@@ -246,61 +170,6 @@ free_data (gpointer d) + } + } + +-static void set_time_async (SetTimeCallbackData *data); +- +-static void +-auth_notify (DBusGProxy *proxy, +- DBusGProxyCall *call, +- void *user_data) +-{ +- SetTimeCallbackData *data = user_data; +- GError *error = NULL; +- gboolean gained_privilege; +- +- if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &gained_privilege, G_TYPE_INVALID)) { +- if (gained_privilege) +- set_time_async (data); +- } +- else { +- if (data->callback) +- data->callback (data->data, error); +- else +- g_error_free (error); +- } +-} +- +-static void +-do_auth_async (const gchar *action, +- const gchar *result, +- SetTimeCallbackData *data) +-{ +- DBusGConnection *bus; +- DBusGProxy *proxy; +- +- g_debug ("helper refused; returned polkit_result='%s' and polkit_action='%s'", +- result, action); +- +- /* Now ask the user for auth... */ +- bus = get_session_bus (); +- if (bus == NULL) +- return; +- +- proxy = dbus_g_proxy_new_for_name (bus, +- "org.gnome.PolicyKit", +- "/org/gnome/PolicyKit/Manager", +- "org.gnome.PolicyKit.Manager"); +- +- data->ref_count++; +- dbus_g_proxy_begin_call_with_timeout (proxy, +- "ShowDialog", +- auth_notify, +- data, free_data, +- INT_MAX, +- G_TYPE_STRING, action, +- G_TYPE_UINT, data->transient_parent_xid, +- G_TYPE_INVALID); +-} +- + static void + set_time_notify (DBusGProxy *proxy, + DBusGProxyCall *call, +@@ -324,17 +193,6 @@ set_time_notify (DBusGProxy *proxy, + if (data->callback) + data->callback (data->data, NULL); + } +- else if (dbus_g_error_has_name (error, "org.gnome.ClockApplet.Mechanism.NotPrivileged")) { +- gchar **tokens; +- +- tokens = g_strsplit (error->message, " ", 2); +- g_error_free (error); +- if (g_strv_length (tokens) == 2) +- do_auth_async (tokens[0], tokens[1], data); +- else +- g_warning ("helper return string malformed"); +- g_strfreev (tokens); +- } + else { + if (data->callback) + data->callback (data->data, error); +@@ -386,9 +244,8 @@ set_time_async (SetTimeCallbackData *dat + + void + set_system_time_async (gint64 time, +- guint transient_parent_xid, +- GFunc callback, +- gpointer d, ++ GFunc callback, ++ gpointer d, + GDestroyNotify notify) + { + SetTimeCallbackData *data; +@@ -401,7 +258,6 @@ set_system_time_async (gint64 ti + data->call = "SetTime"; + data->time = time; + data->filename = NULL; +- data->transient_parent_xid = transient_parent_xid; + data->callback = callback; + data->data = d; + data->notify = notify; +@@ -412,9 +268,8 @@ set_system_time_async (gint64 ti + + void + set_system_timezone_async (const gchar *filename, +- guint transient_parent_xid, +- GFunc callback, +- gpointer d, ++ GFunc callback, ++ gpointer d, + GDestroyNotify notify) + { + SetTimeCallbackData *data; +@@ -427,7 +282,6 @@ set_system_timezone_async (const gchar + data->call = "SetTimezone"; + data->time = -1; + data->filename = g_strdup (filename); +- data->transient_parent_xid = transient_parent_xid; + data->callback = callback; + data->data = d; + data->notify = notify; +diff -up gnome-panel-2.26.1/applets/clock/set-timezone.h.polkit1 gnome-panel-2.26.1/applets/clock/set-timezone.h +--- gnome-panel-2.26.1/applets/clock/set-timezone.h.polkit1 2009-04-14 16:14:55.000000000 -0400 ++++ gnome-panel-2.26.1/applets/clock/set-timezone.h 2009-05-13 17:53:57.498936332 -0400 +@@ -28,13 +28,11 @@ gint can_set_system_timezone (void); + gint can_set_system_time (void); + + void set_system_time_async (gint64 time, +- guint transient_parent_xid, + GFunc callback, + gpointer data, + GDestroyNotify notify); + + void set_system_timezone_async (const gchar *filename, +- guint transient_parent_xid, + GFunc callback, + gpointer data, + GDestroyNotify notify); +diff -up gnome-panel-2.26.1/configure.in.polkit1 gnome-panel-2.26.1/configure.in +--- gnome-panel-2.26.1/configure.in.polkit1 2009-04-14 16:15:50.000000000 -0400 ++++ gnome-panel-2.26.1/configure.in 2009-05-13 17:53:57.498936332 -0400 +@@ -129,24 +129,21 @@ PKG_CHECK_MODULES(CLOCK_MECHANISM, [ gth + AC_SUBST(CLOCK_MECHANISM_CFLAGS) + AC_SUBST(CLOCK_MECHANISM_LIBS) + +-POLKIT_GNOME_REQUIRED=0.7 +-POLKIT_DBUS_REQUIRED=0.7 ++POLKIT_REQUIRED=0.91 + DBUS_GLIB_REQUIRED=0.71 + DBUS_REQUIRED=1.1.2 + NETWORK_MANAGER_REQUIRED=0.6 + + # PolicyKit detection; defaults to 'auto' (use it if it's available) + # +-POLKIT_GNOME_CFLAGS= +-POLKIT_GNOME_LIBS= +-POLKIT_DBUS_CFLAGS= +-POLKIT_DBUS_LIBS= ++POLKIT_CFLAGS= ++POLKIT_LIBS= + AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit],[Enable PolicyKit support (auto)]),enable_polkit=$enableval,enable_polkit=auto) + if test "x$enable_polkit" = "xno" ; then + HAVE_POLKIT=no + else + HAVE_POLKIT=no +- PKG_CHECK_MODULES(POLKIT_GNOME, polkit-gnome >= $POLKIT_GNOME_REQUIRED dbus-1 >= $DBUS_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) ++ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-1 >= $DBUS_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) + + if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno" ; then + AC_MSG_ERROR(PolicyKit support explicity enabled but not available) +@@ -154,16 +151,11 @@ else + + if test "x$HAVE_POLKIT" = "xyes" ; then + AC_DEFINE(HAVE_POLKIT, 1, [Defined if PolicyKit support is enabled]) +- PKG_CHECK_MODULES(POLKIT_DBUS, polkit-dbus >= $POLKIT_DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED gobject-2.0) +- AC_CHECK_PROG([POLKIT_POLICY_FILE_VALIDATE], +- [polkit-policy-file-validate], [polkit-policy-file-validate]) + fi + fi + AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE_POLKIT" = "xyes") +-AC_SUBST(POLKIT_GNOME_CFLAGS) +-AC_SUBST(POLKIT_GNOME_LIBS) +-AC_SUBST(POLKIT_DBUS_CFLAGS) +-AC_SUBST(POLKIT_DBUS_LIBS) ++AC_SUBST(POLKIT_CFLAGS) ++AC_SUBST(POLKIT_LIBS) + + AC_ARG_ENABLE(network_manager, AS_HELP_STRING([--enable-network-manager],[Enable NetworkManager support (auto)]),enable_network_manager=$enableval,enable_network_manager=auto) + if test "x$enable_network_manager" = "xno" ; then -- cgit