From 3e8a6e71279c0bb36b5725a624058a889db3b55e Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Wed, 5 Aug 2015 17:51:22 +0200 Subject: [PATCH] modules/geolocation: Keep track of accuracy and set lower minimal value Instead of setting the highest accuracy level as minimum we now set the lowest level. By doing so we should get a somewhat accurate location in any case. Before this change we would just not get any location information at all which was confusing and let people think the module did not work. We also keep track of the AvailableAccuracyLevel property know. Fixes T2641 --- src/modules/geolocation/e_mod_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/modules/geolocation/e_mod_main.c b/src/modules/geolocation/e_mod_main.c index aa5d2f11c..7e6da0d00 100644 --- a/src/modules/geolocation/e_mod_main.c +++ b/src/modules/geolocation/e_mod_main.c @@ -40,6 +40,7 @@ struct _Instance Evas_Object *popup_accuracy; Evas_Object *popup_description; int in_use; + int available_accur_level; Eldbus_Connection *conn; Eldbus_Service_Interface *iface; Eldbus_Proxy *manager; @@ -52,6 +53,11 @@ struct _Instance const char *description; }; +#define GCLUE_ACCURACY_LEVEL_NONE 0; +#define GCLUE_ACCURACY_LEVEL_COUNTRY 1; +#define GCLUE_ACCURACY_LEVEL_CITY 4; +#define GCLUE_ACCURACY_LEVEL_NEIGHBORHOOD 5; +#define GCLUE_ACCURACY_LEVEL_STREET 6; #define GCLUE_ACCURACY_LEVEL_EXACT 8; static Eina_List *geolocation_instances = NULL; @@ -327,7 +333,7 @@ cb_client_object_get(Eldbus_Proxy *proxy EINA_UNUSED, void *data, Eldbus_Pending desktopid = "Enlightenment-module"; geo_clue2_client_desktop_id_propset(inst->client, cb_client_prop_set, inst, desktopid); - accuracy = GCLUE_ACCURACY_LEVEL_EXACT; + accuracy = GCLUE_ACCURACY_LEVEL_NONE; 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); @@ -357,6 +363,14 @@ cb_manager_props_changed(void *data, Eldbus_Proxy *proxy EINA_UNUSED, void *even else edje_object_signal_emit(inst->icon, "e,state,location_off", "e"); } + if (strcmp(ev->name, "AvailableAccuracyLevel") == 0) + { + eina_value_setup(&v, EINA_VALUE_TYPE_INT); + eina_value_convert(ev->value, &v); + eina_value_get(&v, &val); + inst->available_accur_level = val; + DBG("Manager AvailableAccuracyLevel property changed to %i", inst->available_accur_level); + } } static E_Gadcon_Client *