Commit 64459b51 authored by Guido Gunther's avatar Guido Gunther
Browse files

location-manager: Translate location accuracy levels



Geoclue uses something different then the desktop schemas.

Thanks: Dylan Van Assche for the report
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent b99126ce
Pipeline #66480 passed with stages
in 38 minutes and 51 seconds
......@@ -109,6 +109,7 @@ gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.58')
glib_dep = dependency('glib-2.0', version: '>=2.58')
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>=3.26')
gobject_dep = dependency('gobject-2.0', version: '>=2.50.0')
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
gtk_dep = dependency('gtk+-3.0', version: '>=3.22')
gtk_wayland_dep = dependency('gtk+-wayland-3.0', version: '>=3.22')
libfeedback_dep = dependency('libfeedback-0.0',
......
......@@ -15,6 +15,7 @@
#include "shell.h"
#include "util.h"
#include <gdesktop-enums.h>
#include <gio/gdesktopappinfo.h>
/**
......@@ -90,12 +91,31 @@ G_DEFINE_TYPE_WITH_CODE (PhoshLocationManager,
static guint
get_max_level (PhoshLocationManager *self)
{
gint level;
if (self->enabled)
level = g_settings_get_enum (self->location_settings, "max-accuracy-level");
else
level = LEVEL_NONE;
gint level = LEVEL_NONE;
if (self->enabled) {
GDesktopLocationAccuracyLevel val = g_settings_get_enum (self->location_settings, "max-accuracy-level");
switch (val) {
case G_DESKTOP_LOCATION_ACCURACY_LEVEL_COUNTRY:
level = LEVEL_COUNTRY;
break;
case G_DESKTOP_LOCATION_ACCURACY_LEVEL_CITY:
level = LEVEL_CITY;
break;
case G_DESKTOP_LOCATION_ACCURACY_LEVEL_NEIGHBORHOOD:
level = LEVEL_NEIGHBORHOOD;
break;
case G_DESKTOP_LOCATION_ACCURACY_LEVEL_STREET:
level = LEVEL_STREET;
break;
case G_DESKTOP_LOCATION_ACCURACY_LEVEL_EXACT:
level = LEVEL_EXACT;
break;
default:
g_warn_if_reached ();
}
}
return level;
}
......
......@@ -209,6 +209,7 @@ phosh_deps = [
glib_dep,
gnome_desktop_dep,
gobject_dep,
gsettings_desktop_schemas_dep,
gtk_dep,
gtk_wayland_dep,
libfeedback_dep,
......
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