GNOME Bugzilla – Bug 706627
Port to Geoclue2
Last modified: 2013-09-03 10:12:32 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
Is this planned for GNOME 3.10?
(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
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.
(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.
I get this error even when I'm launching it with sudo.
(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.
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.
(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
(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?
(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. :)
(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.
(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.
Created attachment 253835 [details] [review] depends on GLib 2.37 Needed for the latest GDbus code gen.
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.
Created attachment 253837 [details] [review] location-manager: use Geoclue 2
Created attachment 253838 [details] [review] preferences: remove location sources preferences Not used anymore with Geoclue 2.
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.
Patches looks good, but new code should be using GTask isntead of GSimpleAsyncResult.
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