modules/geolocation: Make module work with newer GeoClue2

In newer GeoClue2 version, tested with 2.1.10, we need to set
the DesktopId and AccurancyLevel to get a location object.
This commit is contained in:
Stefan Schmidt 2015-04-22 13:54:51 +02:00
parent e01edf1f59
commit 0ac7f90aa7
1 changed files with 17 additions and 0 deletions

View File

@ -52,6 +52,8 @@ struct _Instance
const char *description;
};
#define GCLUE_ACCURACY_LEVEL_EXACT 8;
static Eina_List *geolocation_instances = NULL;
static E_Module *geolocation_module = NULL;
@ -277,6 +279,14 @@ cb_location_prop_description_get(void *data EINA_UNUSED, Eldbus_Pending *p EINA_
DBG("Location property Description: %s", value);
}
void
cb_client_prop_set(void *data EINA_UNUSED, const char *propname EINA_UNUSED,
Eldbus_Proxy *proxy EINA_UNUSED, Eldbus_Pending *p EINA_UNUSED,
Eldbus_Error_Info *error_info EINA_UNUSED)
{
DBG("Client %s property set callback received", propname);
}
void
cb_client_location_updated_signal(void *data, const Eldbus_Message *msg)
{
@ -312,6 +322,8 @@ cb_client_object_get(Eldbus_Proxy *proxy EINA_UNUSED, void *data, Eldbus_Pending
Eldbus_Error_Info *error EINA_UNUSED, const char *client_path)
{
Instance *inst = data;
int accuracy;
const char *desktopid;
DBG("Client object path: %s", client_path);
inst->client = geo_clue2_client_proxy_get(inst->conn, "org.freedesktop.GeoClue2", client_path);
@ -321,6 +333,11 @@ cb_client_object_get(Eldbus_Proxy *proxy EINA_UNUSED, void *data, Eldbus_Pending
return;
}
desktopid = "Enlightenment-module";
geo_clue2_client_desktop_id_propset(inst->client, cb_client_prop_set, inst, desktopid);
accuracy = GCLUE_ACCURACY_LEVEL_EXACT;
geo_clue2_client_requested_accuracy_level_propset(inst->client, cb_client_prop_set, inst, (void*)(intptr_t)accuracy);
eldbus_proxy_signal_handler_add(inst->client, "LocationUpdated", cb_client_location_updated_signal, inst);
}