diff options
author | Matthias Clasen <mclasen@fedoraproject.org> | 2009-07-13 06:00:01 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@fedoraproject.org> | 2009-07-13 06:00:01 +0000 |
commit | db8baaa2911545f2576d5fb747fdaa659f66cd77 (patch) | |
tree | a26dd8c268793477f436a7f6aaa91c55e76fa424 /polkit1.patch | |
parent | 8da13d97b3b866d1d56868e47ddf5c87e0ce591b (diff) | |
download | gnome-applets-db8baaa2911545f2576d5fb747fdaa659f66cd77.tar.gz gnome-applets-db8baaa2911545f2576d5fb747fdaa659f66cd77.tar.xz gnome-applets-db8baaa2911545f2576d5fb747fdaa659f66cd77.zip |
fix polkit1 portgnome-applets-2_27_3-4_fc12
Diffstat (limited to 'polkit1.patch')
-rw-r--r-- | polkit1.patch | 673 |
1 files changed, 354 insertions, 319 deletions
diff --git a/polkit1.patch b/polkit1.patch index 2b6ac8e..801e1f5 100644 --- a/polkit1.patch +++ b/polkit1.patch @@ -1,6 +1,252 @@ -diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c hacked/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c ---- gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c 2009-03-16 19:39:11.000000000 -0400 -+++ hacked/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c 2009-05-14 23:45:38.384939252 -0400 +diff -up gnome-applets-2.27.3/configure.in.polkit1 gnome-applets-2.27.3/configure.in +--- gnome-applets-2.27.3/configure.in.polkit1 2009-07-13 01:24:29.668203682 -0400 ++++ gnome-applets-2.27.3/configure.in 2009-07-13 01:24:29.812193607 -0400 +@@ -33,7 +35,7 @@ LIBXML_REQUIRED=2.5.0 + GWEATHER_REQUIRED=2.22.1 + GUCHARMAP2_REQUIRED=2.23.0 + GUCHARMAP_REQUIRED=1.4.0 +-POLKIT_REQUIRED=0.7 ++POLKIT_REQUIRED=0.92 + NETWORKMANAGER_REQUIRED=0.7 + GST10_REQUIRED=0.10.2 + dnl *************************************************************************** +@@ -210,7 +217,7 @@ AC_ARG_ENABLE([polkit], + enable_polkit=$enableval, + enable_polkit=auto) + if test "x$enable_polkit" != "xno"; then +- PKG_CHECK_MODULES(POLKIT, polkit >= $POLKIT_REQUIRED polkit-dbus >= $POLKIT_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) ++ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) + if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno"; then + AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found]) + fi +@@ -226,22 +233,6 @@ AM_CONDITIONAL(HAVE_POLKIT, test "x$HAVE + AC_SUBST(POLKIT_CFLAGS) + AC_SUBST(POLKIT_LIBS) + +-POLKIT_GNOME_CFLAGS= +-POLKIT_GNOME_LIBS= +-polkit_gnome=no +-if test "x$enable_polkit" != "xno"; then +- PKG_CHECK_MODULES(POLKIT_GNOME, polkit-gnome >= $POLKIT_REQUIRED, polkit_gnome=yes, polkit_gnome=no) +- if test "x$enable_polkit" = "xyes" -a "x$polkit_gnome" = "xno"; then +- AC_MSG_ERROR([PolicyKit-gnome support explicitly requested but dependencies not found]) +- fi +-fi +-if test "x$polkit_gnome" = "xyes"; then +- AC_DEFINE(HAVE_POLKIT_GNOME, [1], [PolicyKit-gnome available]) +-fi +-AM_CONDITIONAL(HAVE_POLKIT_GNOME, test "x$polkit_gnome" = "xyes") +-AC_SUBST(POLKIT_GNOME_CFLAGS) +-AC_SUBST(POLKIT_GNOME_LIBS) +- + + dnl -- check for libhal (optional) -------------------------------------------- + HAL_CFLAGS= +@@ -797,7 +788,6 @@ gnome-applets-$VERSION configure summary + - cpufreq $build_cpufreq_applet + - building selector $enable_selector + - using PolicyKit $HAVE_POLKIT +- - using PolicyKit-gnome $polkit_gnome + - enabling suid bit $suid + - drivemount always + - geyes always +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-selector.c.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-selector.c +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-selector.c.polkit1 2009-06-16 21:43:08.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-selector.c 2009-07-13 01:24:29.710444190 -0400 +@@ -19,19 +19,18 @@ + + #include <config.h> + +-#ifdef HAVE_POLKIT_GNOME ++#ifdef HAVE_POLKIT + #include <dbus/dbus-glib.h> +-#endif /* HAVE_POLKIT_GNOME */ ++#endif /* HAVE_POLKIT */ + + #include "cpufreq-selector.h" + + struct _CPUFreqSelector { + GObject parent; + +-#ifdef HAVE_POLKIT_GNOME ++#ifdef HAVE_POLKIT + DBusGConnection *system_bus; +- DBusGConnection *session_bus; +-#endif /* HAVE_POLKIT_GNOME */ ++#endif /* HAVE_POLKIT */ + }; + + struct _CPUFreqSelectorClass { +@@ -45,10 +44,9 @@ cpufreq_selector_finalize (GObject *obje + { + CPUFreqSelector *selector = CPUFREQ_SELECTOR (object); + +-#ifdef HAVE_POLKIT_GNOME ++#ifdef HAVE_POLKIT + selector->system_bus = NULL; +- selector->session_bus = NULL; +-#endif /* HAVE_POLKIT_GNOME */ ++#endif /* HAVE_POLKIT */ + + G_OBJECT_CLASS (cpufreq_selector_parent_class)->finalize (object); + } +@@ -77,7 +75,7 @@ cpufreq_selector_get_default (void) + return selector; + } + +-#ifdef HAVE_POLKIT_GNOME ++#ifdef HAVE_POLKIT + typedef enum { + FREQUENCY, + GOVERNOR +@@ -114,90 +112,12 @@ cpufreq_selector_connect_to_system_bus ( + { + if (selector->system_bus) + return TRUE; +- ++ + selector->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, error); + + return (selector->system_bus != NULL); + } + +-static gboolean +-cpufreq_selector_connect_to_session_bus (CPUFreqSelector *selector, +- GError **error) +-{ +- if (selector->session_bus) +- return TRUE; +- +- selector->session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, error); +- +- return (selector->session_bus != NULL); +-} +- +-static void +-dbus_auth_call_notify_cb (DBusGProxy *proxy, +- DBusGProxyCall *call, +- gpointer user_data) +-{ +- SelectorAsyncData *data; +- gboolean gained_privilege; +- GError *error = NULL; +- +- data = (SelectorAsyncData *)user_data; +- +- if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &gained_privilege, G_TYPE_INVALID)) { +- g_warning ("%s", error->message); +- g_error_free (error); +- +- selector_async_data_free (data); +- +- return; +- } +- +- if (gained_privilege) { +- switch (data->call) { +- case FREQUENCY: +- selector_set_frequency_async (data); +- break; +- case GOVERNOR: +- selector_set_governor_async (data); +- break; +- default: +- g_assert_not_reached (); +- } +- } else { +- selector_async_data_free (data); +- } +-} +- +-static void +-do_auth_async (SelectorAsyncData *data) +-{ +- DBusGProxy *proxy; +- GError *error = NULL; +- +- if (!cpufreq_selector_connect_to_session_bus (data->selector, &error)) { +- g_warning ("%s", error->message); +- g_error_free (error); +- +- selector_async_data_free (data); +- +- return; +- } +- +- proxy = dbus_g_proxy_new_for_name (data->selector->session_bus, +- "org.gnome.PolicyKit", +- "/org/gnome/PolicyKit/Manager", +- "org.gnome.PolicyKit.Manager"); +- +- dbus_g_proxy_begin_call_with_timeout (proxy, +- "ShowDialog", +- dbus_auth_call_notify_cb, +- data, NULL, +- INT_MAX, +- G_TYPE_STRING, "org.gnome.cpufreqselector", +- G_TYPE_UINT, data->parent_xid, +- G_TYPE_INVALID); +-} +- + static void + dbus_set_call_notify_cb (DBusGProxy *proxy, + DBusGProxyCall *call, +@@ -213,12 +133,6 @@ dbus_set_call_notify_cb (DBusGProxy + return; + } + +- if (error->domain == DBUS_GERROR && DBUS_GERROR_REMOTE_EXCEPTION && +- dbus_g_error_has_name (error, "org.gnome.CPUFreqSelector.NotAuthorized")) { +- do_auth_async (data); +- return; +- } +- + selector_async_data_free (data); + g_warning ("%s", error->message); + g_error_free (error); +@@ -229,13 +143,13 @@ selector_set_frequency_async (SelectorAs + { + DBusGProxy *proxy; + GError *error = NULL; +- ++ + if (!cpufreq_selector_connect_to_system_bus (data->selector, &error)) { + g_warning ("%s", error->message); + g_error_free (error); + + selector_async_data_free (data); +- ++ + return; + } + +@@ -243,7 +157,7 @@ selector_set_frequency_async (SelectorAs + "org.gnome.CPUFreqSelector", + "/org/gnome/cpufreq_selector/selector", + "org.gnome.CPUFreqSelector"); +- ++ + dbus_g_proxy_begin_call_with_timeout (proxy, "SetFrequency", + dbus_set_call_notify_cb, + data, NULL, +@@ -321,7 +235,7 @@ cpufreq_selector_set_governor_async (CPU + + selector_set_governor_async (data); + } +-#else /* !HAVE_POLKIT_GNOME */ ++#else /* !HAVE_POLKIT */ + static void + cpufreq_selector_run_command (CPUFreqSelector *selector, + const gchar *args) +@@ -372,4 +286,4 @@ cpufreq_selector_set_governor_async (CPU + cpufreq_selector_run_command (selector, args); + g_free (args); + } +-#endif /* HAVE_POLKIT_GNOME */ ++#endif /* HAVE_POLKIT */ +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c.polkit1 2009-06-16 21:43:08.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.c 2009-07-13 01:24:29.712443397 -0400 @@ -17,7 +17,7 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -10,7 +256,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se #include <dbus/dbus-glib-lowlevel.h> #include "cpufreq-selector.h" -@@ -37,7 +37,7 @@ +@@ -37,7 +37,7 @@ struct _CPUFreqSelectorService { DBusGConnection *system_bus; /* PolicyKit */ @@ -19,7 +265,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se }; struct _CPUFreqSelectorServiceClass { -@@ -99,9 +99,9 @@ +@@ -99,9 +99,9 @@ cpufreq_selector_service_finalize (GObje service->selectors_max = -1; } @@ -32,7 +278,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se } G_OBJECT_CLASS (cpufreq_selector_service_parent_class)->finalize (object); -@@ -153,42 +153,6 @@ +@@ -153,42 +153,6 @@ reset_killtimer (void) NULL); } @@ -75,7 +321,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se gboolean cpufreq_selector_service_register (CPUFreqSelectorService *service, GError **error) -@@ -198,7 +162,6 @@ +@@ -198,7 +162,6 @@ cpufreq_selector_service_register (CPUFr gboolean res; guint result; GError *err = NULL; @@ -83,7 +329,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se if (service->system_bus) { g_set_error (error, -@@ -268,30 +231,7 @@ +@@ -268,30 +231,7 @@ cpufreq_selector_service_register (CPUFr return FALSE; } @@ -115,7 +361,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se service->system_bus = connection; -@@ -330,62 +270,39 @@ +@@ -330,62 +270,42 @@ cpufreq_selector_service_check_policy (C DBusGMethodInvocation *context, GError **error) { @@ -125,13 +371,13 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se + PolkitSubject *subject; + PolkitAuthorizationResult *result; gchar *sender; - DBusConnection *connection; +- DBusConnection *connection; - DBusError dbus_error; - PolKitError *pk_error = NULL; + gboolean ret; sender = dbus_g_method_get_sender (context); - connection = dbus_g_connection_get_connection (service->system_bus); +- connection = dbus_g_connection_get_connection (service->system_bus); - dbus_error_init (&dbus_error); - pk_caller = polkit_caller_new_from_dbus_name (connection, sender, &dbus_error); @@ -143,15 +389,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se - dbus_error.name, dbus_error.message); - dbus_error_free (&dbus_error); - g_free (sender); -+ subject = polkit_system_bus_name_new (sender); -+ result = polkit_authority_check_authorization_sync (service->authority, -+ service, -+ "org.gnome.cpufreqselector", -+ NULL, -+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, -+ NULL, NULL); -+ g_object_unref (subject); - +- - return FALSE; - } - g_free (sender); @@ -165,40 +403,51 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se - polkit_action_unref (pk_action); - - if (polkit_error_is_set (pk_error)) { -+ if (!polkit_authorization_result_get_is_authorized (result)) { - g_set_error (error, - CPUFREQ_SELECTOR_SERVICE_ERROR, +- g_set_error (error, +- CPUFREQ_SELECTOR_SERVICE_ERROR, - SERVICE_ERROR_GENERAL, - "Could not determine if caller is authorized: %s", - polkit_error_get_error_message (pk_error)); - polkit_error_free (pk_error); -+ SERVICE_ERROR_NOT_AUTHORIZED, -+ "Caller is not authorized"); ++ subject = polkit_system_bus_name_new (sender); ++ result = polkit_authority_check_authorization_sync (service->authority, ++ subject, ++ "org.gnome.cpufreqselector", ++ NULL, ++ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, ++ NULL, error); ++ g_object_unref (subject); -- return FALSE; -+ ret = FALSE; -+ } -+ else { -+ ret = TRUE; ++ if (*error) { ++ g_warning ("check policy: %s", (*error)->message); + return FALSE; } - if (pk_result != POLKIT_RESULT_YES) { -- g_set_error (error, -- CPUFREQ_SELECTOR_SERVICE_ERROR, -- SERVICE_ERROR_NOT_AUTHORIZED, ++ if (!polkit_authorization_result_get_is_authorized (result)) { + g_set_error (error, + CPUFREQ_SELECTOR_SERVICE_ERROR, + SERVICE_ERROR_NOT_AUTHORIZED, - "Caller is not authorized: %s", - polkit_result_to_string_representation (pk_result)); -+ g_object_unref (result); ++ "Caller is not authorized"); - return FALSE; -- } ++ ret = FALSE; + } - - return TRUE; ++ else { ++ ret = TRUE; ++ } ++ ++ g_object_unref (result); ++ + return ret; } /* D-BUS interface */ -@@ -518,3 +435,43 @@ +@@ -518,3 +438,47 @@ cpufreq_selector_service_set_governor (C return TRUE; } @@ -211,24 +460,26 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se + PolkitSubject *subject; + PolkitAuthorizationResult *result; + gchar *sender; -+ DBusConnection *connection; + gboolean ret; ++ GError *error = NULL; + + reset_killtimer (); + + sender = dbus_g_method_get_sender (context); -+ connection = dbus_g_connection_get_connection (service->system_bus); -+ + subject = polkit_system_bus_name_new (sender); + result = polkit_authority_check_authorization_sync (service->authority, -+ service, ++ subject, + "org.gnome.cpufreqselector", + NULL, + 0, -+ NULL, NULL); -+ g_object_unref (subject); ++ NULL, &error); ++ g_object_unref (subject); ++ if (error) { ++ dbus_g_method_return_error (context, error); ++ return FALSE; ++ } + -+ if (polkit_authorization_result_get_is_authorized (result)) { ++ if (polkit_authorization_result_get_is_authorized (result)) { + ret = TRUE; + } + else if (polkit_authorization_result_get_is_challenge (result)) { @@ -240,12 +491,14 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se + + g_object_unref (result); + -+ return ret; ++ dbus_g_method_return (context, ret); ++ ++ return TRUE; +} -diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h hacked/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h ---- gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h 2009-03-16 19:39:11.000000000 -0400 -+++ hacked/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h 2009-05-14 23:39:52.716688684 -0400 -@@ -62,6 +62,8 @@ +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h.polkit1 2009-06-16 21:43:08.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.h 2009-07-13 01:24:29.713443245 -0400 +@@ -62,6 +62,8 @@ gboolean cpufreq_selector guint cpu, const gchar *governor, DBusGMethodInvocation *context); @@ -254,10 +507,10 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se G_END_DECLS -diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml hacked/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml ---- gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml 2009-03-16 19:39:11.000000000 -0400 -+++ hacked/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml 2009-05-14 23:38:41.683938881 -0400 -@@ -13,6 +13,10 @@ +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml.polkit1 2009-06-16 21:43:08.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/cpufreq-selector-service.xml 2009-07-13 01:24:29.714443163 -0400 +@@ -13,6 +13,11 @@ <arg name="cpu" direction="in" type="u"/> <arg name="governor" direction="in" type="s"/> </method> @@ -265,207 +518,38 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector/cpufreq-selector-se + + <method name="CanSet"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> ++ <arg name="result" direction="out" type="b"/> + </method> + </interface> </node> -diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-selector.c hacked/cpufreq/src/cpufreq-selector.c ---- gnome-applets-2.26.1/cpufreq/src/cpufreq-selector.c 2009-03-16 19:39:11.000000000 -0400 -+++ hacked/cpufreq/src/cpufreq-selector.c 2009-05-14 23:58:36.989938814 -0400 -@@ -19,19 +19,18 @@ - - #include <config.h> - --#ifdef HAVE_POLKIT_GNOME -+#ifdef HAVE_POLKIT - #include <dbus/dbus-glib.h> --#endif /* HAVE_POLKIT_GNOME */ -+#endif /* HAVE_POLKIT */ - - #include "cpufreq-selector.h" - - struct _CPUFreqSelector { - GObject parent; - --#ifdef HAVE_POLKIT_GNOME -+#ifdef HAVE_POLKIT - DBusGConnection *system_bus; -- DBusGConnection *session_bus; --#endif /* HAVE_POLKIT_GNOME */ -+#endif /* HAVE_POLKIT */ - }; - - struct _CPUFreqSelectorClass { -@@ -45,10 +44,9 @@ - { - CPUFreqSelector *selector = CPUFREQ_SELECTOR (object); - --#ifdef HAVE_POLKIT_GNOME -+#ifdef HAVE_POLKIT - selector->system_bus = NULL; -- selector->session_bus = NULL; --#endif /* HAVE_POLKIT_GNOME */ -+#endif /* HAVE_POLKIT */ - - G_OBJECT_CLASS (cpufreq_selector_parent_class)->finalize (object); - } -@@ -77,7 +75,7 @@ - return selector; - } - --#ifdef HAVE_POLKIT_GNOME -+#ifdef HAVE_POLKIT - typedef enum { - FREQUENCY, - GOVERNOR -@@ -114,90 +112,12 @@ - { - if (selector->system_bus) - return TRUE; -- -+ - selector->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, error); - - return (selector->system_bus != NULL); - } - --static gboolean --cpufreq_selector_connect_to_session_bus (CPUFreqSelector *selector, -- GError **error) --{ -- if (selector->session_bus) -- return TRUE; -- -- selector->session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, error); -- -- return (selector->session_bus != NULL); --} -- --static void --dbus_auth_call_notify_cb (DBusGProxy *proxy, -- DBusGProxyCall *call, -- gpointer user_data) --{ -- SelectorAsyncData *data; -- gboolean gained_privilege; -- GError *error = NULL; -- -- data = (SelectorAsyncData *)user_data; -- -- if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &gained_privilege, G_TYPE_INVALID)) { -- g_warning ("%s", error->message); -- g_error_free (error); -- -- selector_async_data_free (data); -- -- return; -- } -- -- if (gained_privilege) { -- switch (data->call) { -- case FREQUENCY: -- selector_set_frequency_async (data); -- break; -- case GOVERNOR: -- selector_set_governor_async (data); -- break; -- default: -- g_assert_not_reached (); -- } -- } else { -- selector_async_data_free (data); -- } --} -- --static void --do_auth_async (SelectorAsyncData *data) --{ -- DBusGProxy *proxy; -- GError *error = NULL; -- -- if (!cpufreq_selector_connect_to_session_bus (data->selector, &error)) { -- g_warning ("%s", error->message); -- g_error_free (error); -- -- selector_async_data_free (data); -- -- return; -- } -- -- proxy = dbus_g_proxy_new_for_name (data->selector->session_bus, -- "org.gnome.PolicyKit", -- "/org/gnome/PolicyKit/Manager", -- "org.gnome.PolicyKit.Manager"); -- -- dbus_g_proxy_begin_call_with_timeout (proxy, -- "ShowDialog", -- dbus_auth_call_notify_cb, -- data, NULL, -- INT_MAX, -- G_TYPE_STRING, "org.gnome.cpufreqselector", -- G_TYPE_UINT, data->parent_xid, -- G_TYPE_INVALID); --} -- - static void - dbus_set_call_notify_cb (DBusGProxy *proxy, - DBusGProxyCall *call, -@@ -213,12 +133,6 @@ - return; - } - -- if (error->domain == DBUS_GERROR && DBUS_GERROR_REMOTE_EXCEPTION && -- dbus_g_error_has_name (error, "org.gnome.CPUFreqSelector.NotAuthorized")) { -- do_auth_async (data); -- return; -- } -- - selector_async_data_free (data); - g_warning ("%s", error->message); - g_error_free (error); -@@ -229,13 +143,13 @@ - { - DBusGProxy *proxy; - GError *error = NULL; -- -+ - if (!cpufreq_selector_connect_to_system_bus (data->selector, &error)) { - g_warning ("%s", error->message); - g_error_free (error); - - selector_async_data_free (data); -- -+ - return; - } - -@@ -243,7 +157,7 @@ - "org.gnome.CPUFreqSelector", - "/org/gnome/cpufreq_selector/selector", - "org.gnome.CPUFreqSelector"); -- -+ - dbus_g_proxy_begin_call_with_timeout (proxy, "SetFrequency", - dbus_set_call_notify_cb, - data, NULL, -@@ -321,7 +235,7 @@ - - selector_set_governor_async (data); - } --#else /* !HAVE_POLKIT_GNOME */ -+#else /* !HAVE_POLKIT */ - static void - cpufreq_selector_run_command (CPUFreqSelector *selector, - const gchar *args) -@@ -372,4 +286,4 @@ - cpufreq_selector_run_command (selector, args); - g_free (args); - } --#endif /* HAVE_POLKIT_GNOME */ -+#endif /* HAVE_POLKIT */ -diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c hacked/cpufreq/src/cpufreq-utils.c ---- gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c 2009-03-16 19:39:11.000000000 -0400 -+++ hacked/cpufreq/src/cpufreq-utils.c 2009-05-15 00:00:16.374688984 -0400 +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/Makefile.am.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/Makefile.am +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/Makefile.am.polkit1 2009-07-13 01:30:32.497197598 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/Makefile.am 2009-07-13 01:30:42.876197568 -0400 +@@ -51,7 +51,7 @@ polkit_in_files = org.gnome.cpufreqselec + + dbus_servicesdir = $(datadir)/dbus-1/system-services + dbus_confdir = $(sysconfdir)/dbus-1/system.d +-polkitdir = $(datadir)/PolicyKit/policy ++polkitdir = $(datadir)/polkit-1/actions + + if HAVE_POLKIT + BUILT_SOURCES = cpufreq-selector-service-glue.h +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/org.gnome.cpufreqselector.policy.in.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/org.gnome.cpufreqselector.policy.in +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/org.gnome.cpufreqselector.policy.in.polkit1 2009-04-18 22:12:10.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-selector/org.gnome.cpufreqselector.policy.in 2009-07-13 01:24:29.715443081 -0400 +@@ -15,7 +15,7 @@ + <_message>Privileges are required to change the CPU Frequency scaling.</_message> + <defaults> + <allow_inactive>no</allow_inactive> +- <allow_active>auth_admin_keep_always</allow_active> ++ <allow_active>auth_admin_keep</allow_active> + </defaults> + </action> + +diff -up gnome-applets-2.27.3/cpufreq/src/cpufreq-utils.c.polkit1 gnome-applets-2.27.3/cpufreq/src/cpufreq-utils.c +--- gnome-applets-2.27.3/cpufreq/src/cpufreq-utils.c.polkit1 2009-06-16 21:43:08.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/cpufreq-utils.c 2009-07-13 01:24:29.716443139 -0400 @@ -21,13 +21,6 @@ #include <config.h> @@ -491,7 +575,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c hacked/cpufreq/src/c guint cpufreq_utils_get_n_cpus (void) { -@@ -108,56 +105,16 @@ +@@ -108,56 +105,16 @@ cpufreq_utils_display_error (const gchar gtk_widget_show (dialog); } @@ -552,7 +636,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c hacked/cpufreq/src/c if (!system_bus) { system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); -@@ -169,54 +126,19 @@ +@@ -169,54 +126,22 @@ selector_is_available (const gchar *acti } } @@ -576,23 +660,25 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c hacked/cpufreq/src/c - - return FALSE; - } -- } -- -- dbus_error_init (&dbus_error); -- pk_caller = polkit_caller_new_from_pid (dbus_g_connection_get_connection (system_bus), -- getpid (), &dbus_error); -- if (!pk_caller) { -- g_warning ("Cannot get caller from dbus name"); + proxy = dbus_g_proxy_new_for_name (system_bus, + "org.gnome.CPUFreqSelector", + "/org/gnome/cpufreq_selector/selector", + "org.gnome.CPUFreqSelector"); + -+ dbus_g_proxy_call (proxy, "CanSet", NULL, -+ G_TYPE_INVALID, -+ &result, -+ G_TYPE_INVALID); ++ if (!dbus_g_proxy_call (proxy, "CanSet", &error, ++ G_TYPE_INVALID, ++ G_TYPE_BOOLEAN, &result, ++ G_TYPE_INVALID)) { ++ g_warning ("error calling org.gnome.CPUFreqSelector.CanSet: %s", error->message); ++ g_error_free (error); + } +- dbus_error_init (&dbus_error); +- pk_caller = polkit_caller_new_from_pid (dbus_g_connection_get_connection (system_bus), +- getpid (), &dbus_error); +- if (!pk_caller) { +- g_warning ("Cannot get caller from dbus name"); +- - return FALSE; - } - @@ -618,7 +704,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c hacked/cpufreq/src/c } gboolean -@@ -228,13 +150,13 @@ +@@ -228,13 +153,13 @@ cpufreq_utils_selector_is_available (voi time (&now); if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) { @@ -634,10 +720,10 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/cpufreq-utils.c hacked/cpufreq/src/c gboolean cpufreq_utils_selector_is_available (void) { -diff -u -r gnome-applets-2.26.1/cpufreq/src/Makefile.am hacked/cpufreq/src/Makefile.am ---- gnome-applets-2.26.1/cpufreq/src/Makefile.am 2009-03-16 19:39:11.000000000 -0400 -+++ hacked/cpufreq/src/Makefile.am 2009-05-14 23:14:18.926939010 -0400 -@@ -9,10 +9,6 @@ +diff -up gnome-applets-2.27.3/cpufreq/src/Makefile.am.polkit1 gnome-applets-2.27.3/cpufreq/src/Makefile.am +--- gnome-applets-2.27.3/cpufreq/src/Makefile.am.polkit1 2009-06-16 21:43:08.000000000 -0400 ++++ gnome-applets-2.27.3/cpufreq/src/Makefile.am 2009-07-13 01:24:29.717442917 -0400 +@@ -9,10 +9,6 @@ INCLUDES = \ $(GNOME_LIBS2_CFLAGS) \ $(LIBGLADE_CFLAGS) @@ -648,7 +734,7 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/Makefile.am hacked/cpufreq/src/Makef libexec_PROGRAMS = cpufreq-applet if HAVE_LIBCPUFREQ -@@ -38,8 +34,4 @@ +@@ -38,8 +34,4 @@ cpufreq_applet_LDADD = \ $(LIBGLADE_LIBS) \ $(LIBCPUFREQ_LIBS) @@ -657,54 +743,3 @@ diff -u -r gnome-applets-2.26.1/cpufreq/src/Makefile.am hacked/cpufreq/src/Makef -endif - ---- gnome-applets-2.26.1/configure.in 2009-05-15 00:01:14.206719170 -0400 -+++ hacked/configure.in 2009-05-14 23:13:29.129939391 -0400 -@@ -35,7 +35,7 @@ - GWEATHER_REQUIRED=2.22.1 - GUCHARMAP2_REQUIRED=2.23.0 - GUCHARMAP_REQUIRED=1.4.0 --POLKIT_REQUIRED=0.7 -+POLKIT_REQUIRED=0.92 - NETWORKMANAGER_REQUIRED=0.7 - GST10_REQUIRED=0.10.2 - dnl *************************************************************************** -@@ -217,7 +217,7 @@ - enable_polkit=$enableval, - enable_polkit=auto) - if test "x$enable_polkit" != "xno"; then -- PKG_CHECK_MODULES(POLKIT, polkit >= $POLKIT_REQUIRED polkit-dbus >= $POLKIT_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) -+ PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= $POLKIT_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_POLKIT=yes, HAVE_POLKIT=no) - if test "x$enable_polkit" = "xyes" -a "x$HAVE_POLKIT" = "xno"; then - AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found]) - fi -@@ -233,22 +233,6 @@ - AC_SUBST(POLKIT_CFLAGS) - AC_SUBST(POLKIT_LIBS) - --POLKIT_GNOME_CFLAGS= --POLKIT_GNOME_LIBS= --polkit_gnome=no --if test "x$enable_polkit" != "xno"; then -- PKG_CHECK_MODULES(POLKIT_GNOME, polkit-gnome >= $POLKIT_REQUIRED, polkit_gnome=yes, polkit_gnome=no) -- if test "x$enable_polkit" = "xyes" -a "x$polkit_gnome" = "xno"; then -- AC_MSG_ERROR([PolicyKit-gnome support explicitly requested but dependencies not found]) -- fi --fi --if test "x$polkit_gnome" = "xyes"; then -- AC_DEFINE(HAVE_POLKIT_GNOME, [1], [PolicyKit-gnome available]) --fi --AM_CONDITIONAL(HAVE_POLKIT_GNOME, test "x$polkit_gnome" = "xyes") --AC_SUBST(POLKIT_GNOME_CFLAGS) --AC_SUBST(POLKIT_GNOME_LIBS) -- - - dnl -- check for libhal (optional) -------------------------------------------- - HAL_CFLAGS= -@@ -797,7 +781,6 @@ - - cpufreq $build_cpufreq_applet - - building selector $enable_selector - - using PolicyKit $HAVE_POLKIT -- - using PolicyKit-gnome $polkit_gnome - - enabling suid bit $suid - - drivemount always - - geyes always |