After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706627 - Port to Geoclue2
Port to Geoclue2
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Geolocation
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-23 00:37 UTC by Zeeshan Ali
Modified: 2013-09-03 10:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
depends on GLib 2.37 (984 bytes, patch)
2013-09-02 12:47 UTC, Guillaume Desmottes
committed Details | Review
add empathy-geoclue-helper (20.96 KB, patch)
2013-09-02 12:47 UTC, Guillaume Desmottes
committed Details | Review
location-manager: use Geoclue 2 (17.55 KB, patch)
2013-09-02 12:47 UTC, Guillaume Desmottes
committed Details | Review
preferences: remove location sources preferences (8.81 KB, patch)
2013-09-02 12:48 UTC, Guillaume Desmottes
committed Details | Review

Description Zeeshan Ali 2013-08-23 00:37:09 UTC
Geoclue is being re-written, with emphasis on simplicity (API and implementation) and privacy (user's location should not be shared w/o asking for user's consent). Obviously, all apps that use geoclue need to port to new D-Bus interface: http://cgit.freedesktop.org/geoclue/tree/src/geoclue-interface.xml . Sorry no docs yet but there is two examples at least:

http://cgit.freedesktop.org/geoclue/tree/demo/where-am-i.c
https://git.gnome.org/browse/gnome-maps/tree/src/geoclue.js
Comment 1 Guillaume Desmottes 2013-08-23 12:10:30 UTC
Is this planned for GNOME 3.10?
Comment 2 Zeeshan Ali 2013-08-23 12:37:13 UTC
(In reply to comment #1)
> Is this planned for GNOME 3.10?

Yes, already in 3.9 releases and Maps uses it already (hopefully clocks, weather & control-center will too). Fedora packaging on the way: https://bugzilla.redhat.com/show_bug.cgi?id=999153
Comment 3 Guillaume Desmottes 2013-08-26 09:01:10 UTC
I built geoclue from source but got this error when trying to start the daemon; any idea?

** (geoclue:9721): CRITICAL **: Failed to acquire name 'org.freedesktop.GeoClue2' on system bus or lost it.
Comment 4 Zeeshan Ali 2013-08-26 12:30:17 UTC
(In reply to comment #3)
> I built geoclue from source but got this error when trying to start the daemon;
> any idea?
> 
> ** (geoclue:9721): CRITICAL **: Failed to acquire name
> 'org.freedesktop.GeoClue2' on system bus or lost it.

Its a system service so you need to be root to run it. Best just install it on system prefix and lets dbus autolaunch it.
Comment 5 Guillaume Desmottes 2013-08-28 13:52:01 UTC
I get this error even when I'm launching it with sudo.
Comment 6 Zeeshan Ali 2013-08-28 14:30:51 UTC
(In reply to comment #5)
> I get this error even when I'm launching it with sudo.

Did you install it on system prefix? If you don't want to do that, you'll at least want to manually setup the following files then:

/etc/dbus-1/system.d/org.freedesktop.GeoClue2.conf
/usr/share/dbus-1/system-services/org.freedesktop.GeoClue2.service

Also I'm hoping you didn't build it in jhbuild env as autolaunch won't work as jhbuild env is not accessible to your system dbus.
Comment 7 Guillaume Desmottes 2013-08-29 09:21:31 UTC
Thanks I was missing the .conf file, it works now.

Is there any plan to provide a client side helper lib? I'd rather not cargo cult where-am-i.c, most of it could be encapsulated in a simple object providing the current location.
Comment 8 Zeeshan Ali 2013-08-29 12:29:06 UTC
(In reply to comment #7)
> Thanks I was missing the .conf file, it works now.
> 
> Is there any plan to provide a client side helper lib? I'd rather not cargo
> cult where-am-i.c, most of it could be encapsulated in a simple object
> providing the current location.

No, actually we just removed the (generated) library we were providing on Bastien's instructions: https://bugs.freedesktop.org/show_bug.cgi?id=68439#c5
Comment 9 Guillaume Desmottes 2013-08-29 12:42:06 UTC
(In reply to comment #8)
> No, actually we just removed the (generated) library we were providing on
> Bastien's instructions: https://bugs.freedesktop.org/show_bug.cgi?id=68439#c5

Ok, so I guess I'll have to use gdbus-codegen myself then. This comment suggests that I should query geoclue-2.0.pc to find the location of the API XML file but it doesn't seem part of this .pc. Is that something you still have to add?
Comment 10 Zeeshan Ali 2013-08-29 12:53:33 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > No, actually we just removed the (generated) library we were providing on
> > Bastien's instructions: https://bugs.freedesktop.org/show_bug.cgi?id=68439#c5
> 
> Ok, so I guess I'll have to use gdbus-codegen myself then. This comment
> suggests that I should query geoclue-2.0.pc to find the location of the API XML
> file but it doesn't seem part of this .pc. Is that something you still have to
> add?

Yes, I would have already if I knew how you do it. :)
Comment 11 Guillaume Desmottes 2013-08-29 15:02:07 UTC
(In reply to comment #8)
> No, actually we just removed the (generated) library we were providing on
> Bastien's instructions: https://bugs.freedesktop.org/show_bug.cgi?id=68439#c5

Even with generated client side code, it's still a lot of boilerplate to get the location:

- create a Manager proxy
- call GetClient()
- create a client proxy
- call Start()
- Each time we receive a 'location-updated' signal we have to create a Location proxy and finally receive the location

In C all of this result in a lot of boring functions because of the async. Geoclue should really provide a higher level helper object doing all this and just giving location updates.
Comment 12 Zeeshan Ali 2013-08-29 15:59:02 UTC
(In reply to comment #11)
> (In reply to comment #8)
> > No, actually we just removed the (generated) library we were providing on
> > Bastien's instructions: https://bugs.freedesktop.org/show_bug.cgi?id=68439#c5
> 
> Even with generated client side code, it's still a lot of boilerplate to get
> the location:
> 
> - create a Manager proxy
> - call GetClient()
> - create a client proxy
> - call Start()
> - Each time we receive a 'location-updated' signal we have to create a Location
> proxy and finally receive the location
> 
> In C all of this result in a lot of boring functions because of the async.
> Geoclue should really provide a higher level helper object doing all this and
> just giving location updates.

There is a reason for API to be not as simple as you'd want it to be: https://bugs.freedesktop.org/show_bug.cgi?id=68658#c1

Regarding async being difficult in C, thats something I can't fix. There is a reason why people tend to write apps in high-level languages. Anyways, API design came from Bastien and also the suggestion of dropping the library (my intention was to provide very simple API throught that library) so please don't hate me for it.
Comment 13 Guillaume Desmottes 2013-09-02 12:47:49 UTC
Created attachment 253835 [details] [review]
depends on GLib 2.37

Needed for the latest GDbus code gen.
Comment 14 Guillaume Desmottes 2013-09-02 12:47:53 UTC
Created attachment 253836 [details] [review]
add empathy-geoclue-helper

Based on a proposed API on fdo#68658. May end up in geoclue at some point.
Comment 15 Guillaume Desmottes 2013-09-02 12:47:57 UTC
Created attachment 253837 [details] [review]
location-manager: use Geoclue 2
Comment 16 Guillaume Desmottes 2013-09-02 12:48:01 UTC
Created attachment 253838 [details] [review]
preferences: remove location sources preferences

Not used anymore with Geoclue 2.
Comment 17 Guillaume Desmottes 2013-09-02 12:49:40 UTC
Those patches are blocked by https://bugs.freedesktop.org/show_bug.cgi?id=68833 but they can already be reviewed.

Ideally most of this code should be in Geoclue itself ( https://bugs.freedesktop.org/show_bug.cgi?id=68658 ) but we shouldn't block on it.
Comment 18 Xavier Claessens 2013-09-02 13:15:06 UTC
Patches looks good, but new code should be using GTask isntead of GSimpleAsyncResult.
Comment 19 Guillaume Desmottes 2013-09-03 10:12:16 UTC
Attachment 253835 [details] pushed as 28be746 - depends on GLib 2.37
Attachment 253836 [details] pushed as dcb5ddc - add empathy-geoclue-helper
Attachment 253837 [details] pushed as f6f6c64 - location-manager: use Geoclue 2
Attachment 253838 [details] pushed as 32529f4 - preferences: remove location sources preferences