Commit 7d857264 authored by Zeeshan Ali's avatar Zeeshan Ali

agent: Add property to control max accuracy level

parent 4e8f7a31
......@@ -35,5 +35,18 @@
<arg name="authorized" type="b" direction="out"/>
<arg name="allowed_accuracy_level" type="u" direction="out"/>
The global maximum level of accuracy allowed for all clients. Since
agents are per-user, this can be different for each user. See
<link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link> for
possible values. Geoclue will set this value on agent upon agent
registering itself and will listen to changes to it by agent. Its done
this way so that geoclue is the entity that keeps this information on
disk and agent is just providing UI to control it.
<property name="MaxAccuracyLevel" type="u" access="readwrite"/>
......@@ -270,7 +270,7 @@ gclue_service_client_handle_start (GClueClient *client,
GClueConfig *config;
StartData *data;
const char *desktop_id;
GClueAccuracyLevel accuracy_level;
GClueAccuracyLevel accuracy_level, max_accuracy;
if (priv->locator != NULL)
/* Already started */
......@@ -302,6 +302,21 @@ gclue_service_client_handle_start (GClueClient *client,
return TRUE;
max_accuracy = gclue_agent_get_max_accuracy_level (priv->agent_proxy);
if (max_accuracy == 0) {
guint32 uid = gclue_client_info_get_user_id (priv->client_info);
g_dbus_method_invocation_return_error (invocation,
"Geolocation disabled for"
" UID %u",
start_data_free (data);
return TRUE;
accuracy_level = CLAMP (accuracy_level, 0, max_accuracy);
gclue_agent_call_authorize_app (priv->agent_proxy,
......@@ -27,11 +27,14 @@
#include "gclue-service-client.h"
#include "gclue-client-info.h"
#include "geoclue-agent-interface.h"
#include "gclue-enums.h"
#include "gclue-config.h"
#define AGENT_WAIT_TIMEOUT 100 /* milliseconds */
#define AGENT_WAIT_TIMEOUT_USEC 100000 /* microseconds */
static void
gclue_service_manager_manager_iface_init (GClueManagerIface *iface);
static void
......@@ -269,6 +272,8 @@ on_agent_proxy_ready (GObject *source_object,
G_CALLBACK (on_agent_vanished),
/* FIXME: We should be storing this on disk */
gclue_agent_set_max_accuracy_level (agent, DEFAULT_MAX_ACCURACY_LEVEL);
gclue_manager_complete_add_agent (data->manager, data->invocation);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment