summaryrefslogtreecommitdiffstats
path: root/polkit1.patch
blob: b34aefc4b0fdbeab79ce1f5ba1b84a3730356444 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
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 <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