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.
*/
-#include <polkit-dbus/polkit-dbus.h>
+#include <polkit/polkit.h>
#include <dbus/dbus-glib-lowlevel.h>
#include "cpufreq-selector.h"
@@ -37,7 +37,7 @@ struct _CPUFreqSelectorService {
DBusGConnection *system_bus;
/* PolicyKit */
- PolKitContext *pk_context;
+ PolkitAuthority *authority;
};
struct _CPUFreqSelectorServiceClass {
@@ -99,9 +99,9 @@ cpufreq_selector_service_finalize (GObje
service->selectors_max = -1;
}
- if (service->pk_context) {
- polkit_context_unref (service->pk_context);
- service->pk_context = NULL;
+ if (service->authority) {
+ g_object_unref (service->authority);
+ service->authority = NULL;
}
G_OBJECT_CLASS (cpufreq_selector_service_parent_class)->finalize (object);
@@ -153,42 +153,6 @@ reset_killtimer (void)
NULL);
}
-static gboolean
-pk_io_watch_have_data (GIOChannel *channel,
- GIOCondition condition,
- PolKitContext *pk_context)
-{
- polkit_context_io_func (pk_context,
- g_io_channel_unix_get_fd (channel));
- return TRUE;
-}
-
-static int
-pk_add_io_watch (PolKitContext *pk_context,
- int watch_id)
-{
- GIOChannel *channel;
- guint id = 0;
-
- channel = g_io_channel_unix_new (watch_id);
- if (!channel)
- return 0;
-
- id = g_io_add_watch (channel, G_IO_IN,
- (GIOFunc)pk_io_watch_have_data,
- pk_context);
- g_io_channel_unref (channel);
-
- return id;
-}
-
-static void
-pk_remove_io_watch (PolKitContext *pk_context,
- int watch_id)
-{
- g_source_remove (watch_id);
-}
-
gboolean
cpufreq_selector_service_register (CPUFreqSelectorService *service,
GError **error)
@@ -198,7 +162,6 @@ cpufreq_selector_service_register (CPUFr
gboolean res;
guint result;
GError *err = NULL;
- PolKitError *pk_err = NULL;
if (service->system_bus) {
g_set_error (error,
@@ -268,30 +231,7 @@ cpufreq_selector_service_register (CPUFr
return FALSE;
}
- service->pk_context = polkit_context_new ();
- polkit_context_set_io_watch_functions (service->pk_context,
- pk_add_io_watch,
- pk_remove_io_watch);
- if (!polkit_context_init (service->pk_context, &pk_err)) {
- polkit_context_unref (service->pk_context);
- service->pk_context = NULL;
-
- if (polkit_error_is_set (pk_err)) {
- g_set_error (error,
- CPUFREQ_SELECTOR_SERVICE_ERROR,
- SERVICE_ERROR_GENERAL,
- "Cannot initialize libpolkit: %s",
- polkit_error_get_error_message (pk_err));
- polkit_error_free (pk_err);
- } else {
- g_set_error (error,
- CPUFREQ_SELECTOR_SERVICE_ERROR,
- SERVICE_ERROR_GENERAL,
- "Cannot initialize libpolkit");
- }
-
- return FALSE;
- }
+ service->authority = polkit_authority_get ();
service->system_bus = connection;
@@ -330,62 +270,42 @@ cpufreq_selector_service_check_policy (C
DBusGMethodInvocation *context,
GError **error)
{
- PolKitAction *pk_action;
- PolKitCaller *pk_caller;
- PolKitResult pk_result;
+ PolkitSubject *subject;
+ PolkitAuthorizationResult *result;
gchar *sender;
- 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);
- dbus_error_init (&dbus_error);
- pk_caller = polkit_caller_new_from_dbus_name (connection, sender, &dbus_error);
- if (!pk_caller) {
- g_set_error (error,
- CPUFREQ_SELECTOR_SERVICE_ERROR,
- SERVICE_ERROR_DBUS,
- "Error getting information about caller: %s: %s",
- dbus_error.name, dbus_error.message);
- dbus_error_free (&dbus_error);
- g_free (sender);
-
- return FALSE;
- }
- g_free (sender);
-
- pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, "org.gnome.cpufreqselector");
- pk_result = polkit_context_is_caller_authorized (service->pk_context,
- pk_action, pk_caller,
- TRUE, &pk_error);
- polkit_caller_unref (pk_caller);
- polkit_action_unref (pk_action);
-
- if (polkit_error_is_set (pk_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);
+ 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);
+ if (*error) {
+ g_warning ("check policy: %s", (*error)->message);
return FALSE;
}
- if (pk_result != POLKIT_RESULT_YES) {
+ 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));
+ "Caller is not authorized");
- return FALSE;
+ ret = FALSE;
}
-
- return TRUE;
+ else {
+ ret = TRUE;
+ }
+
+ g_object_unref (result);
+
+ return ret;
}
/* D-BUS interface */
@@ -518,3 +438,47 @@ cpufreq_selector_service_set_governor (C
return TRUE;
}
+
+
+gboolean
+cpufreq_selector_service_can_set (CPUFreqSelectorService *service,
+ DBusGMethodInvocation *context)
+{
+ PolkitSubject *subject;
+ PolkitAuthorizationResult *result;
+ gchar *sender;
+ gboolean ret;
+ GError *error = NULL;
+
+ reset_killtimer ();
+
+ sender = dbus_g_method_get_sender (context);
+ subject = polkit_system_bus_name_new (sender);
+ result = polkit_authority_check_authorization_sync (service->authority,
+ subject,
+ "org.gnome.cpufreqselector",
+ NULL,
+ 0,
+ 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)) {
+ ret = TRUE;
+ }
+ else if (polkit_authorization_result_get_is_challenge (result)) {
+ ret = TRUE;
+ }
+ else {
+ ret = FALSE;
+ }
+
+ g_object_unref (result);
+
+ dbus_g_method_return (context, ret);
+
+ return TRUE;
+}
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);
+gboolean cpufreq_selector_service_can_set (CPUFreqSelectorService *service,
+ DBusGMethodInvocation *context);
G_END_DECLS
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>
-
+
+ <method name="CanSet">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="result" direction="out" type="b"/>
+ </method>
+
</interface>
</node>
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>
-#ifdef HAVE_POLKIT_GNOME
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <polkit/polkit.h>
-#include <polkit-dbus/polkit-dbus.h>
-#endif
-
#include <glib.h>
#include <gtk/gtk.h>
#include <sys/types.h>
@@ -39,6 +32,10 @@
#include "cpufreq-utils.h"
+#ifdef HAVE_POLKIT
+#include <dbus/dbus-glib.h>
+#endif /* HAVE_POLKIT */
+
guint
cpufreq_utils_get_n_cpus (void)
{
@@ -108,56 +105,16 @@ cpufreq_utils_display_error (const gchar
gtk_widget_show (dialog);
}
-#ifdef HAVE_POLKIT_GNOME
+#ifdef HAVE_POLKIT
#define CACHE_VALIDITY_SEC 2
static gboolean
-pk_io_watch_have_data (GIOChannel *channel,
- GIOCondition condition,
- PolKitContext *pk_context)
-{
- polkit_context_io_func (pk_context,
- g_io_channel_unix_get_fd (channel));
- return TRUE;
-}
-
-static int
-pk_add_io_watch (PolKitContext *pk_context,
- int watch_id)
-{
- GIOChannel *channel;
- guint id = 0;
-
- channel = g_io_channel_unix_new (watch_id);
- if (!channel)
- return 0;
-
- id = g_io_add_watch (channel, G_IO_IN,
- (GIOFunc)pk_io_watch_have_data,
- pk_context);
- g_io_channel_unref (channel);
-
- return id;
-}
-
-static void
-pk_remove_io_watch (PolKitContext *pk_context,
- int watch_id)
-{
- g_source_remove (watch_id);
-}
-
-static gboolean
-selector_is_available (const gchar *action)
+selector_is_available (void)
{
+ DBusGProxy *proxy;
static DBusGConnection *system_bus = NULL;
- static PolKitContext *pk_context = NULL;
- PolKitCaller *pk_caller;
- PolKitAction *pk_action;
- PolKitResult pk_result;
- PolKitError *pk_error = NULL;
GError *error = NULL;
- DBusError dbus_error;
+ gboolean result;
if (!system_bus) {
system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -169,54 +126,22 @@ selector_is_available (const gchar *acti
}
}
- if (!pk_context) {
- PolKitError *pk_error = NULL;
-
- pk_context = polkit_context_new ();
- polkit_context_set_io_watch_functions (pk_context,
- pk_add_io_watch,
- pk_remove_io_watch);
- if (!polkit_context_init (pk_context, &pk_error)) {
- polkit_context_unref (pk_context);
- pk_context = NULL;
-
- if (polkit_error_is_set (pk_error)) {
- g_warning ("%s", polkit_error_get_error_message (pk_error));
- polkit_error_free (pk_error);
- } else {
- g_warning ("Cannot initialize libpolkit");
- }
-
- return FALSE;
- }
+ proxy = dbus_g_proxy_new_for_name (system_bus,
+ "org.gnome.CPUFreqSelector",
+ "/org/gnome/cpufreq_selector/selector",
+ "org.gnome.CPUFreqSelector");
+
+ 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;
- }
-
- pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, action);
- pk_result = polkit_context_is_caller_authorized (pk_context,
- pk_action, pk_caller,
- FALSE, &pk_error);
-
- polkit_caller_unref (pk_caller);
- polkit_action_unref (pk_action);
-
- if (polkit_error_is_set (pk_error)) {
- g_warning ("%s", polkit_error_get_error_message (pk_error));
- polkit_error_free (pk_error);
-
- return FALSE;
- }
+ g_object_unref (proxy);
- return !(pk_result == POLKIT_RESULT_UNKNOWN || pk_result == POLKIT_RESULT_NO);
+ return result;
}
gboolean
@@ -228,13 +153,13 @@ cpufreq_utils_selector_is_available (voi
time (&now);
if (ABS (now - last_refreshed) > CACHE_VALIDITY_SEC) {
- cache = selector_is_available ("org.gnome.cpufreqselector");
+ cache = selector_is_available ();
last_refreshed = now;
}
return cache;
}
-#else /* !HAVE_POLKIT_GNOME */
+#else /* !HAVE_POLKIT */
gboolean
cpufreq_utils_selector_is_available (void)
{
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)
-if HAVE_POLKIT_GNOME
-INCLUDES += $(POLKIT_GNOME_CFLAGS)
-endif
-
libexec_PROGRAMS = cpufreq-applet
if HAVE_LIBCPUFREQ
@@ -38,8 +34,4 @@ cpufreq_applet_LDADD = \
$(LIBGLADE_LIBS) \
$(LIBCPUFREQ_LIBS)
-if HAVE_POLKIT_GNOME
-cpufreq_applet_LDADD += $(POLKIT_GNOME_LIBS)
-endif
-