[arch-commits] Commit in gnome-panel/gnome-unstable (PKGBUILD polkit1.patch)

Jan de Groot jgc at archlinux.org
Sun Sep 6 13:13:27 UTC 2009


    Date: Sunday, September 6, 2009 @ 09:13:27
  Author: jgc
Revision: 51241

Update to 2.27.91 - remove old patch

Modified:
  gnome-panel/gnome-unstable/PKGBUILD
Deleted:
  gnome-panel/gnome-unstable/polkit1.patch

---------------+
 PKGBUILD      |   18 -
 polkit1.patch |  789 --------------------------------------------------------
 2 files changed, 5 insertions(+), 802 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-09-06 13:08:43 UTC (rev 51240)
+++ PKGBUILD	2009-09-06 13:13:27 UTC (rev 51241)
@@ -2,33 +2,25 @@
 # Maintainer: Jan de Groot <jgc at archlinux.org>
 
 pkgname=gnome-panel
-pkgver=2.27.4
+pkgver=2.27.91
 pkgrel=1
 pkgdesc="The GNOME Panel"
 arch=(i686 x86_64)
 license=('GPL')
 url="http://www.gnome.org"
-depends=('libwnck>=2.27.5' 'gnome-menus>=2.27.5' 'evolution-data-server>=2.27.90' 'gnome-desktop>=2.27.5' 'libgweather>=2.26.2.1' 'librsvg>=2.26.0' 'libgnomeui>=2.24.1' 'hicolor-icon-theme')
-makedepends=('gnome-doc-utils>=0.17.3' 'pkgconfig' 'intltool' 'gnome-common')
+depends=('libwnck>=2.27.5' 'gnome-menus>=2.27.5' 'evolution-data-server>=2.27.91' 'gnome-desktop>=2.27.91' 'libgweather>=2.27.91' 'librsvg>=2.26.0' 'libgnomeui>=2.24.1' 'hicolor-icon-theme')
+makedepends=('gnome-doc-utils>=0.17.4' 'pkgconfig' 'intltool' 'networkmanager')
 options=('!libtool' '!emptydirs')
 groups=('gnome')
 install=gnome-panel.install
-source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.27/${pkgname}-${pkgver}.tar.bz2
-        polkit1.patch)
-sha256sums=('baf349ff8032979ace8668cb011d9f8ca9007713f689096dd3eaf09718f92b95'
-            'f077e5bf63b715c808be99228049a7fcc7eef348f36768130a588576eba523c8')
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/2.27/${pkgname}-${pkgver}.tar.bz2)
+sha256sums=('c536e7d331222d773138230058b858aed62d3840615c49bd9d3ca61e977b4181')
 
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
-  patch -Np1 -i "${srcdir}/polkit1.patch" || return 1
-  libtoolize -f || return 1
-  aclocal -I m4 || return 1
-  autoconf || return 1
-  automake || return 1
   ./configure --prefix=/usr --sysconfdir=/etc \
       --localstatedir=/var --disable-static \
       --libexecdir=/usr/lib/gnome-panel \
-      --disable-network-manager \
       --disable-scrollkeeper || return 1
   make || return 1
   make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install || return 1

Deleted: polkit1.patch
===================================================================
--- polkit1.patch	2009-09-06 13:08:43 UTC (rev 51240)
+++ polkit1.patch	2009-09-06 13:13:27 UTC (rev 51241)
@@ -1,789 +0,0 @@
-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 <dbus/dbus-glib.h>
- #include <dbus/dbus-glib-lowlevel.h>
- 
--#include <polkit-dbus/polkit-dbus.h>
-+#include <polkit/polkit.h>
- 
- #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 @@
-       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-       <arg name="zonefile" direction="in" type="s"/>
-     </method>
-+    <method name="CanSetTimezone">
-+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-+      <arg name="value" direction="out" type="i"/>
-+    </method>
-     <method name="SetTime">
-       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-       <arg name="seconds_since_epoch" direction="in" type="x"/>
-     </method>
-+    <method name="CanSetTime">
-+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-+      <arg name="value" direction="out" type="i"/>
-+    </method>
-     <method name="AdjustTime">
-       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-       <arg name="seconds_to_add" direction="in" type="x"/>
-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.</_message>
-     <defaults>
-       <allow_inactive>no</allow_inactive>
--      <allow_active>auth_self_keep_always</allow_active>
-+      <allow_active>auth_self_keep</allow_active>
-     </defaults>
-   </action>
- 
-@@ -22,7 +22,7 @@
-     <_message>Privileges are required to change the system time.</_message>
-     <defaults>
-       <allow_inactive>no</allow_inactive>
--      <allow_active>auth_self_keep_always</allow_active>
-+      <allow_active>auth_self_keep</allow_active>
-     </defaults>
-   </action>
- 
-@@ -31,7 +31,7 @@
-     <_message>Privileges are required to configure the hardware clock.</_message>
-     <defaults>
-       <allow_inactive>no</allow_inactive>
--      <allow_active>auth_self_keep_always</allow_active>
-+      <allow_active>auth_self_keep</allow_active>
-     </defaults>
-   </action>
- 
-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 <dbus/dbus-glib.h>
- #include <dbus/dbus-glib-lowlevel.h>
- 
--#include <polkit/polkit.h>
--#include <polkit-dbus/polkit-dbus.h>
--
- #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




More information about the arch-commits mailing list