Commit c9350715 authored by Matthias Clasen's avatar Matthias Clasen

gclue-simple: Add portal support

When running inside a flatpak sandbox, or when GTK_USE_PORTAL
is set in the environment, talk to the location portal instead
of GeoClue directly.

In this situation, gclue_simple_get_client will return NULL.
parent 79948926
Pipeline #78938 passed with stage
in 17 minutes and 5 seconds
This diff is collapsed.
......@@ -25,11 +25,20 @@ gclue_manager = gnome.gdbus_codegen(
install_header: true,
install_dir: include_subdir)
# Location portal interface
location_portal = gnome.gdbus_codegen('xdp-location',
'org.freedesktop.portal.Location.xml',
interface_prefix: 'org.freedesktop.portal.',
namespace: 'Xdp',
install_header: false)
libgeoclue_sources = files('gclue-helpers.c', 'gclue-simple.c')
libgeoclue_sources += gclue_client[0]
libgeoclue_sources += gclue_location[0]
libgeoclue_sources += gclue_manager[0]
libgeoclue_sources += libgeoclue_public_api_gen_sources[1]
libgeoclue_sources += location_portal[0]
libgeoclue_sources += location_portal[1]
libgeoclue_headers = files('geoclue.h', 'gclue-helpers.h', 'gclue-simple.h')
......
<?xml version="1.0"?>
<!--
Copyright (C) 2018 Red Hat, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
Author: Matthias Clasen <mclasen@redhat.com>
-->
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<!--
org.freedesktop.portal.Location:
@short_description: Portal for obtaining information about the location
This simple interface lets sandboxed applications query basic
information about the location.
This documentation describes version 1 of this interface.
-->
<interface name="org.freedesktop.portal.Location">
<!--
CreateSession:
@options: Vardict with optional further information
@handle: Object path for the created #org.freedesktop.portal.Session object
Create a location session. A successfully created session can at
any time be closed using org.freedesktop.portal.Session::Close, or may
at any time be closed by the portal implementation, which will be
signalled via org.freedesktop.portal.Session::Closed.
`
Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>session_handle_token s</term>
<listitem><para>
A string that will be used as the last element of the session handle. Must be a valid
object path element. See the #org.freedesktop.portal.Session documentation for
more information about the session handle.
</para></listitem>
</varlistentry>
<varlistentry>
<term>distance-threshold u</term>
<listitem><para>
Distance threshold in meters. Default is 0.
</para></listitem>
</varlistentry>
<varlistentry>
<term>time-threshold u</term>
<listitem><para>
Time threshold in seconds. Default is 0.
</para></listitem>
</varlistentry>
<varlistentry>
<term>accuracy u</term>
<listitem><para>
Requested accuracy. Default is EXACT.
Values: NONE 0, COUNTRY 1, CITY 2, NEIGHBORHOOD 3, STREET 4, EXACT 5
</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="CreateSession">
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
Start:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@parent_window: Identifier for the application window, see <link linkend="parent_window">Common Conventions</link>
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
Start the location session.
An application can only attempt start a session once.
Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>handle_token s</term>
<listitem><para>
A string that will be used as the last element of the @handle. Must be a valid
object path element. See the #org.freedesktop.portal.Request documentation for
more information about the @handle.
</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="Start">
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="parent_window" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
LocationUpdated:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@location: Vardict with the current location data
The LocationUpdated signal is emitted when the location has changed, as well
as when the initial location has been determined.
The following results may get returned via the @location:
<variablelist>
<varlistentry>
<term>latitude d</term>
<listitem><para>
The latitude, in degrees.
</para></listitem>
</varlistentry>
<varlistentry>
<term>longitude d</term>
<listitem><para>
The longitude, in degrees.
</para></listitem>
</varlistentry>
<varlistentry>
<term>altitude d</term>
<listitem><para>
The altitude, in meters.
</para></listitem>
</varlistentry>
<varlistentry>
<term>accuracy d</term>
<listitem><para>
The accuracy, in meters.
</para></listitem>
</varlistentry>
<varlistentry>
<term>speed d</term>
<listitem><para>
The speed, in meters per second.
</para></listitem>
</varlistentry>
<varlistentry>
<term>heading d</term>
<listitem><para>
The heading, in degrees, going clockwise. North 0, East 90, South 180, West 270.
</para></listitem>
</varlistentry>
<varlistentry>
<term>timestamp (tt)</term>
<listitem><para>
The timestamp, as seconds and microsections since the Unix epoch.
</para></listitem>
</varlistentry>
</variablelist>
-->
<signal name="LocationUpdated">
<arg type="o" name="session_handle" direction="out"/>
<arg type="a{sv}" name="location" direction="out"/>
</signal>
<property name="version" type="u" access="read"/>
</interface>
</node>
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