Merge lp:~noskcaj/empathy/geoclue-2.0 into lp:~ubuntu-desktop/empathy/ubuntu

Proposed by Jackson Doak
Status: Needs review
Proposed branch: lp:~noskcaj/empathy/geoclue-2.0
Merge into: lp:~ubuntu-desktop/empathy/ubuntu
Diff against target: 1473 lines (+10/-1425)
4 files modified
debian/changelog (+8/-0)
debian/control (+2/-2)
debian/patches/Revert-geoclue-2.0.patch (+0/-1422)
debian/patches/series (+0/-1)
To merge this branch: bzr merge lp:~noskcaj/empathy/geoclue-2.0
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Information
Review via email: mp+241187@code.launchpad.net

Description of the change

Use geoclue-2.0 now that it's in main

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, but what about the fact that geoclue doesn't support plugin and can't use ubuntu-geoip? What difference would that mean in the user experience?

review: Needs Information
Revision history for this message
Tim Lunn (darkxst) wrote :

geoclue-2.0 uses mozilla location service, so the user would still get a location, just not from ubuntu-geoip.

Unmerged revisions

370. By Jackson Doak

* Use geoclue-2.0. LP: #1389336
  - Drop Revert-geoclue-2.0.patch
  - Replace old geoclue deps with geoclue-2.0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-10-28 17:30:15 +0000
+++ debian/changelog 2014-11-08 20:15:08 +0000
@@ -1,3 +1,11 @@
1empathy (3.12.6-0ubuntu2) vivid; urgency=medium
2
3 * Use geoclue-2.0. LP: #1389336
4 - Drop Revert-geoclue-2.0.patch
5 - Replace old geoclue deps with geoclue-2.0
6
7 -- Jackson Doak <noskcaj@ubuntu.com> Sat, 08 Nov 2014 16:24:34 +1100
8
1empathy (3.12.6-0ubuntu1) vivid; urgency=medium9empathy (3.12.6-0ubuntu1) vivid; urgency=medium
210
3 [ Jackson Doak ]11 [ Jackson Doak ]
412
=== modified file 'debian/control'
--- debian/control 2014-09-30 11:10:19 +0000
+++ debian/control 2014-11-08 20:15:08 +0000
@@ -29,7 +29,7 @@
29 libgstreamer-plugins-base1.0-dev,29 libgstreamer-plugins-base1.0-dev,
30 libnm-glib-dev (>= 0.7) [linux-any],30 libnm-glib-dev (>= 0.7) [linux-any],
31 libnm-util-dev (>= 0.7) [linux-any],31 libnm-util-dev (>= 0.7) [linux-any],
32 libgeoclue-dev (>= 0.12),32 geoclue-2.0,
33 libgnome-keyring-dev (>= 2.26.0),33 libgnome-keyring-dev (>= 2.26.0),
34 libgcr-3-dev (>= 2.91.4),34 libgcr-3-dev (>= 2.91.4),
35 libfolks-dev (>= 0.9.5),35 libfolks-dev (>= 0.9.5),
@@ -65,7 +65,7 @@
65 telepathy-mission-control-5 (>= 1:5.12.0),65 telepathy-mission-control-5 (>= 1:5.12.0),
66 gsettings-desktop-schemas,66 gsettings-desktop-schemas,
67 gnome-icon-theme (>= 2.30.0),67 gnome-icon-theme (>= 2.30.0),
68 geoclue,68 geoclue-2.0,
69 telepathy-logger (>= 0.2.13),69 telepathy-logger (>= 0.2.13),
70 dbus-x11,70 dbus-x11,
71 gstreamer1.0-pulseaudio71 gstreamer1.0-pulseaudio
7272
=== removed file 'debian/patches/Revert-geoclue-2.0.patch'
--- debian/patches/Revert-geoclue-2.0.patch 2014-09-24 08:08:59 +0000
+++ debian/patches/Revert-geoclue-2.0.patch 1970-01-01 00:00:00 +0000
@@ -1,1422 +0,0 @@
1Description: Revert 4 upstream git commits so we can use old geoclue
2 Reverted commits used for new geoclue:
3 https://git.gnome.org/browse/empathy/commit/?id=dcb5ddc560b51cc5eb59a2ef27d91cf279271f36
4 https://git.gnome.org/browse/empathy/commit/?id=24238851a5f3617c52bd60d1f99ac5eef0c079a1
5 https://git.gnome.org/browse/empathy/commit/?id=32529f49e3935b5f4fd747fcfe2d62322f86ec52
6 https://git.gnome.org/browse/empathy/commit/?id=f6f6c6421e0e286db920d3e01fa64cc3ebe4f4df
7Author: Jackson Doak <noskcaj@ubuntu.com>
8Origin: upstream
9Forwarded: not-needed
10Last-Update: 2014-09-24
11
12--- empathy-3.12.6.orig/configure.ac
13+++ empathy-3.12.6/configure.ac
14@@ -73,7 +73,7 @@ GOA_REQUIRED=3.5.1
15
16 # Optional deps
17 ENCHANT_REQUIRED=1.2.0
18-GEOCLUE_REQUIRED=1.99.3
19+GEOCLUE_REQUIRED=0.12
20 GEOCODE_GLIB_REQUIRED=0.99.1
21 ISO_CODES_REQUIRED=0.35
22 NAUTILUS_SENDTO_REQUIRED=2.90.0
23@@ -416,18 +416,11 @@ AC_ARG_ENABLE(location,
24 if test "x$enable_location" != "xno"; then
25 PKG_CHECK_MODULES(GEOCLUE,
26 [
27- geoclue-2.0 >= $GEOCLUE_REQUIRED
28+ geoclue >= $GEOCLUE_REQUIRED
29 ], have_geoclue="yes", have_geoclue="no")
30
31 if test "x$have_geoclue" = "xyes"; then
32- GEOCLUE_XML_FILE=`pkg-config --variable=dbus_interface geoclue-2.0`
33- if test "x$GEOCLUE_XML_FILE" = "x"; then
34- echo "Can't find dbus_interface variable in geoclue-2.0.pc"
35- have_geoclue="no"
36- else
37- AC_DEFINE(HAVE_GEOCLUE, 1, [Define if you have geoclue-2])
38- AC_SUBST(GEOCLUE_XML_FILE)
39- fi
40+ AC_DEFINE(HAVE_GEOCLUE, 1, [Define if you have geoclue])
41 fi
42 else
43 have_geoclue="no"
44--- empathy-3.12.6.orig/data/empathy.convert
45+++ empathy-3.12.6/data/empathy.convert
46@@ -54,5 +54,8 @@ close-main-window = /apps/empathy/hints/
47
48 [org.gnome.Empathy.location]
49 publish = /apps/empathy/location/publish
50+resource-network = /apps/empathy/location/resource_network
51+resource-cell = /apps/empathy/location/resource_cell
52+resource-gps = /apps/empathy/location/resource_gps
53 reduce-accuracy = /apps/empathy/location/reduce_accuracy
54
55--- empathy-3.12.6.orig/data/org.gnome.Empathy.gschema.xml
56+++ empathy-3.12.6/data/org.gnome.Empathy.gschema.xml
57@@ -256,6 +256,21 @@ present them to the user immediately.</d
58 <summary>Empathy can publish the user's location</summary>
59 <description>Whether Empathy can publish the user's location to their contacts.</description>
60 </key>
61+ <key name="resource-network" type="b">
62+ <default>true</default>
63+ <summary>Empathy can use the network to guess the location</summary>
64+ <description>Whether Empathy can use the network to guess the location.</description>
65+ </key>
66+ <key name="resource-cell" type="b">
67+ <default>true</default>
68+ <summary>Empathy can use the cellular network to guess the location</summary>
69+ <description>Whether Empathy can use the cellular network to guess the location.</description>
70+ </key>
71+ <key name="resource-gps" type="b">
72+ <default>false</default>
73+ <summary>Empathy can use the GPS to guess the location</summary>
74+ <description>Whether Empathy can use the GPS to guess the location.</description>
75+ </key>
76 <key name="reduce-accuracy" type="b">
77 <default>true</default>
78 <summary>Empathy should reduce the location's accuracy</summary>
79--- empathy-3.12.6.orig/libempathy-gtk/Makefile.am
80+++ empathy-3.12.6/libempathy-gtk/Makefile.am
81@@ -249,26 +249,11 @@ EXTRA_DIST = \
82 $(ui_DATA)
83
84 if HAVE_GEOCLUE
85-geoclue-interface.c: geoclue-interface.h
86-geoclue-interface.h: Makefile.am
87- gdbus-codegen \
88- --interface-prefix org.freedesktop.GeoClue2. \
89- --c-namespace GClue \
90- --generate-c-code geoclue-interface \
91- $(GEOCLUE_XML_FILE)
92-
93-BUILT_SOURCES += \
94- geoclue-interface.h \
95- geoclue-interface.c
96-
97 libempathy_gtk_handwritten_source += \
98- empathy-location-manager.c \
99- empathy-geoclue-helper.c
100+ empathy-location-manager.c
101
102 libempathy_gtk_headers += \
103- empathy-location-manager.h \
104- empathy-geoclue-helper.h
105-
106+ empathy-location-manager.h
107 else
108 EXTRA_DIST += \
109 empathy-location-manager.c \
110--- empathy-3.12.6.orig/libempathy-gtk/empathy-geoclue-helper.c
111+++ /dev/null
112@@ -1,523 +0,0 @@
113-/*
114- * empathy-geoclue-helper.c
115- *
116- * Copyright (C) 2013 Collabora Ltd. <http://www.collabora.co.uk/>
117- *
118- * This library is free software; you can redistribute it and/or
119- * modify it under the terms of the GNU Lesser General Public
120- * License as published by the Free Software Foundation; either
121- * version 2.1 of the License, or (at your option) any later version.
122- *
123- * This library is distributed in the hope that it will be useful,
124- * but WITHOUT ANY WARRANTY; without even the implied warranty of
125- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
126- * Lesser General Public License for more details.
127- *
128- * You should have received a copy of the GNU Lesser General Public
129- * License along with this library; if not, write to the Free Software
130- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
131- */
132-
133-#include "config.h"
134-
135-#include <gio/gio.h>
136-
137-#include "empathy-geoclue-helper.h"
138-
139-#define DEBUG_FLAG EMPATHY_DEBUG_LOCATION
140-#include "empathy-debug.h"
141-
142-#define GEOCLUE_BUS_NAME "org.freedesktop.GeoClue2"
143-
144-/**
145- * SECTION: empathy-geoclue-helper
146- * @title: EmpathyGeoclueHelper
147- * @short_description: TODO
148- *
149- * TODO
150- */
151-
152-/**
153- * EmpathyGeoclueHelper:
154- *
155- * Data structure representing a #EmpathyGeoclueHelper.
156- *
157- * Since: UNRELEASED
158- */
159-
160-/**
161- * EmpathyGeoclueHelperClass:
162- *
163- * The class of a #EmpathyGeoclueHelper.
164- *
165- * Since: UNRELEASED
166- */
167-
168-static void async_initable_iface_init (GAsyncInitableIface *iface);
169-
170-G_DEFINE_TYPE_WITH_CODE (EmpathyGeoclueHelper, empathy_geoclue_helper,
171- G_TYPE_OBJECT,
172- G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init));
173-
174-enum
175-{
176- PROP_DISTANCE_THRESHOLD = 1,
177- PROP_LOCATION,
178- N_PROPS
179-};
180-
181-enum
182-{
183- SIG_LOCATION_CHANGED,
184- LAST_SIGNAL
185-};
186-
187-static guint signals[LAST_SIGNAL];
188-
189-struct _EmpathyGeoclueHelperPriv
190-{
191- guint distance_threshold;
192- GClueLocation *location;
193-
194- gboolean started;
195- GClueClient *client;
196-};
197-
198-static void
199-empathy_geoclue_helper_get_property (GObject *object,
200- guint property_id,
201- GValue *value,
202- GParamSpec *pspec)
203-{
204- EmpathyGeoclueHelper *self = EMPATHY_GEOCLUE_HELPER (object);
205-
206- switch (property_id)
207- {
208- case PROP_DISTANCE_THRESHOLD:
209- g_value_set_uint (value, self->priv->distance_threshold);
210- break;
211- case PROP_LOCATION:
212- g_value_set_object (value, self->priv->location);
213- break;
214- default:
215- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
216- break;
217- }
218-}
219-
220-static void
221-empathy_geoclue_helper_set_property (GObject *object,
222- guint property_id,
223- const GValue *value,
224- GParamSpec *pspec)
225-{
226- EmpathyGeoclueHelper *self = EMPATHY_GEOCLUE_HELPER (object);
227-
228- switch (property_id)
229- {
230- case PROP_DISTANCE_THRESHOLD:
231- self->priv->distance_threshold = g_value_get_uint (value);
232- break;
233- default:
234- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
235- break;
236- }
237-}
238-
239-static void
240-empathy_geoclue_helper_constructed (GObject *object)
241-{
242- //EmpathyGeoclueHelper *self = EMPATHY_GEOCLUE_HELPER (object);
243- void (*chain_up) (GObject *) =
244- ((GObjectClass *) empathy_geoclue_helper_parent_class)->constructed;
245-
246- chain_up (object);
247-}
248-
249-static void
250-empathy_geoclue_helper_dispose (GObject *object)
251-{
252- EmpathyGeoclueHelper *self = EMPATHY_GEOCLUE_HELPER (object);
253- void (*chain_up) (GObject *) =
254- ((GObjectClass *) empathy_geoclue_helper_parent_class)->dispose;
255-
256- if (self->priv->started)
257- {
258- gclue_client_call_stop (self->priv->client, NULL, NULL, NULL);
259-
260- self->priv->started = FALSE;
261- }
262-
263- g_clear_object (&self->priv->location);
264- g_clear_object (&self->priv->client);
265-
266- chain_up (object);
267-}
268-
269-static void
270-empathy_geoclue_helper_finalize (GObject *object)
271-{
272- //EmpathyGeoclueHelper *self = EMPATHY_GEOCLUE_HELPER (object);
273- void (*chain_up) (GObject *) =
274- ((GObjectClass *) empathy_geoclue_helper_parent_class)->finalize;
275-
276- chain_up (object);
277-}
278-
279-static void
280-empathy_geoclue_helper_class_init (
281- EmpathyGeoclueHelperClass *klass)
282-{
283- GObjectClass *oclass = G_OBJECT_CLASS (klass);
284- GParamSpec *spec;
285-
286- oclass->get_property = empathy_geoclue_helper_get_property;
287- oclass->set_property = empathy_geoclue_helper_set_property;
288- oclass->constructed = empathy_geoclue_helper_constructed;
289- oclass->dispose = empathy_geoclue_helper_dispose;
290- oclass->finalize = empathy_geoclue_helper_finalize;
291-
292- /**
293- * EmpathyGeoclueHelper:distance-threshold:
294- *
295- * TODO
296- *
297- * Since: UNRELEASED
298- */
299- spec = g_param_spec_uint ("distance-threshold", "distance-threshold",
300- "DistanceThreshold",
301- 0, G_MAXUINT32, 0,
302- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
303- g_object_class_install_property (oclass, PROP_DISTANCE_THRESHOLD, spec);
304-
305- /**
306- * EmpathyGeoclueHelper:location:
307- *
308- * TODO
309- *
310- * Since: UNRELEASED
311- */
312- spec = g_param_spec_object ("location", "location", "GClueLocation",
313- GCLUE_TYPE_LOCATION,
314- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
315- g_object_class_install_property (oclass, PROP_LOCATION, spec);
316-
317- /**
318- * EmpathyGeoclueHelper::location-changed:
319- * @self: a #EmpathyGeoclueHelper
320- *
321- * TODO
322- *
323- * Since: UNRELEASED
324- */
325- signals[SIG_LOCATION_CHANGED] = g_signal_new ("location-changed",
326- G_OBJECT_CLASS_TYPE (klass),
327- G_SIGNAL_RUN_LAST,
328- 0, NULL, NULL, NULL,
329- G_TYPE_NONE,
330- 1, GCLUE_TYPE_LOCATION);
331-
332- g_type_class_add_private (klass, sizeof (EmpathyGeoclueHelperPriv));
333-}
334-
335-static void
336-empathy_geoclue_helper_init (EmpathyGeoclueHelper *self)
337-{
338- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
339- EMPATHY_TYPE_GEOCLUE_HELPER, EmpathyGeoclueHelperPriv);
340-}
341-
342-static void
343-location_cb (GObject *source,
344- GAsyncResult *result,
345- gpointer user_data)
346-{
347- EmpathyGeoclueHelper *self = user_data;
348- GError *error = NULL;
349-
350- g_clear_object (&self->priv->location);
351-
352- self->priv->location = gclue_location_proxy_new_finish (result, &error);
353- if (self->priv->location == NULL)
354- {
355- DEBUG ("Failed to create Location proxy: %s", error->message);
356- g_error_free (error);
357- }
358-
359- g_signal_emit (self, signals[SIG_LOCATION_CHANGED], 0, self->priv->location);
360-
361- g_object_notify (G_OBJECT (self), "location");
362-}
363-
364-static void
365-location_updated_cb (GClueClient *client,
366- const gchar *old,
367- const gchar *new,
368- EmpathyGeoclueHelper *self)
369-{
370- gclue_location_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
371- GEOCLUE_BUS_NAME, new,
372- NULL, location_cb, self);
373-}
374-
375-static void
376-client_start_cb (GObject *source,
377- GAsyncResult *result,
378- gpointer user_data)
379-{
380- GTask *task = user_data;
381- EmpathyGeoclueHelper *self = g_task_get_source_object (task);
382- GClueClient *client = GCLUE_CLIENT (source);
383- GError *error = NULL;
384-
385- if (!gclue_client_call_start_finish (client, result, &error))
386- {
387- DEBUG ("Failed to start Geoclue client: %s", error->message);
388- g_error_free (error);
389- return;
390- }
391-
392- self->priv->started = TRUE;
393-
394- g_task_return_boolean (task, TRUE);
395- g_object_unref (task);
396-}
397-
398-static void
399-client_cb (GObject *source,
400- GAsyncResult *result,
401- gpointer user_data)
402-{
403- GTask *task = user_data;
404- EmpathyGeoclueHelper *self = g_task_get_source_object (task);
405- GError *error = NULL;
406-
407- self->priv->client = gclue_client_proxy_new_finish (result, &error);
408- if (!gclue_client_proxy_new_for_bus_finish (result, &error))
409- {
410- DEBUG ("Failed to create Geoclue client: %s", error->message);
411- g_task_return_error (task, error);
412- goto out;
413- }
414-
415- g_signal_connect_object (self->priv->client, "location-updated",
416- G_CALLBACK (location_updated_cb), self, 0);
417-
418- g_object_set (self->priv->client,
419- "distance-threshold", self->priv->distance_threshold,
420- NULL);
421-
422- g_task_return_boolean (task, TRUE);
423-
424-out:
425- g_object_unref (task);
426-}
427-
428-static void
429-get_client_cb (GObject *source,
430- GAsyncResult *result,
431- gpointer user_data)
432-{
433- GTask *task = user_data;
434- GError *error = NULL;
435- gchar *path;
436-
437- if (!gclue_manager_call_get_client_finish (GCLUE_MANAGER (source), &path,
438- result, &error))
439- {
440- DEBUG ("GetClient failed: %s", error->message);
441- g_task_return_error (task, error);
442- g_object_unref (task);
443- return;
444- }
445-
446- gclue_client_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
447- GEOCLUE_BUS_NAME, path, NULL, client_cb, task);
448-
449- g_free (path);
450-}
451-
452-static void
453-manager_cb (GObject *source,
454- GAsyncResult *result,
455- gpointer user_data)
456-{
457- GTask *task = user_data;
458- GError *error = NULL;
459- GClueManager *mgr;
460-
461- mgr = gclue_manager_proxy_new_for_bus_finish (result, &error);
462- if (mgr == NULL)
463- {
464- DEBUG ("Failed to create Geoclue manager: %s", error->message);
465- g_task_return_error (task, error);
466- g_object_unref (task);
467- return;
468- }
469-
470- gclue_manager_call_get_client (mgr, NULL, get_client_cb, task);
471- g_object_unref (mgr);
472-}
473-
474-void
475-empathy_geoclue_helper_start_async (EmpathyGeoclueHelper *self,
476- GAsyncReadyCallback callback,
477- gpointer user_data)
478-{
479- GTask *task;
480-
481- task = g_task_new (self, NULL, callback, user_data);
482-
483- if (self->priv->started)
484- {
485- g_task_return_boolean (task, TRUE);
486- g_object_unref (task);
487- return;
488- }
489-
490- gclue_client_call_start (self->priv->client, NULL, client_start_cb, task);
491-}
492-
493-gboolean
494-empathy_geoclue_helper_start_finish (EmpathyGeoclueHelper *self,
495- GAsyncResult *result,
496- GError **error)
497-{
498- g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
499-
500- return g_task_propagate_boolean (G_TASK (result), error);
501-}
502-
503-GClueLocation *
504-empathy_geoclue_helper_get_location (EmpathyGeoclueHelper *self)
505-{
506- return self->priv->location;
507-}
508-
509-static void
510-empathy_geoclue_helper_init_async (GAsyncInitable *initable,
511- gint io_priority,
512- GCancellable *cancellable,
513- GAsyncReadyCallback callback,
514- gpointer user_data)
515-{
516- GTask *task;
517-
518- task = g_task_new (initable, cancellable, callback, user_data);
519-
520- gclue_manager_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
521- GEOCLUE_BUS_NAME, "/org/freedesktop/GeoClue2/Manager",
522- NULL, manager_cb, task);
523-}
524-
525-static gboolean
526-empathy_geoclue_helper_init_finish (GAsyncInitable *initable,
527- GAsyncResult *result,
528- GError **error)
529-{
530- g_return_val_if_fail (g_task_is_valid (result, initable), FALSE);
531-
532- return g_task_propagate_boolean (G_TASK (result), error);
533-}
534-
535-static void
536-async_initable_iface_init (GAsyncInitableIface *iface)
537-{
538- iface->init_async = empathy_geoclue_helper_init_async;
539- iface->init_finish = empathy_geoclue_helper_init_finish;
540-}
541-
542-void
543-empathy_geoclue_helper_new_async (guint distance_threshold,
544- GAsyncReadyCallback callback,
545- gpointer user_data)
546-{
547- g_async_initable_new_async (EMPATHY_TYPE_GEOCLUE_HELPER,
548- G_PRIORITY_DEFAULT, NULL, callback, user_data,
549- "distance-threshold", distance_threshold,
550- NULL);
551-}
552-
553-EmpathyGeoclueHelper *
554-empathy_geoclue_helper_new_finish (GAsyncResult *result,
555- GError **error)
556-{
557- GObject *object, *source_object;
558-
559- source_object = g_async_result_get_source_object (result);
560-
561- object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object),
562- result, error);
563- g_object_unref (source_object);
564-
565- if (object != NULL)
566- return EMPATHY_GEOCLUE_HELPER (object);
567- else
568- return NULL;
569-}
570-
571-static void
572-new_started_cb (GObject *source,
573- GAsyncResult *result,
574- gpointer user_data)
575-{
576- EmpathyGeoclueHelper *self = EMPATHY_GEOCLUE_HELPER (source);
577- GTask *new_started_task = user_data;
578- GError *error = NULL;
579-
580- if (!empathy_geoclue_helper_start_finish (self, result, &error))
581- {
582- g_task_return_error (new_started_task, error);
583- g_object_unref (self);
584- goto out;
585- }
586-
587- /* pass ownership of self to g_task_return_error */
588- g_task_return_pointer (new_started_task, self, g_object_unref);
589-
590-out:
591- g_object_unref (new_started_task);
592-}
593-
594-static void
595-new_started_init_cb (GObject *source,
596- GAsyncResult *result,
597- gpointer user_data)
598-{
599- GTask *new_started_task = user_data;
600- EmpathyGeoclueHelper *self;
601- GError *error = NULL;
602-
603- self = empathy_geoclue_helper_new_finish (result, &error);
604- if (self == NULL)
605- {
606- g_task_return_error (new_started_task, error);
607- g_object_unref (new_started_task);
608- return;
609- }
610-
611- /* Pass owernship of 'self' to new_started_cb */
612- empathy_geoclue_helper_start_async (self, new_started_cb, new_started_task);
613-}
614-
615-void
616-empathy_geoclue_helper_new_started_async (guint distance_threshold,
617- GAsyncReadyCallback callback,
618- gpointer user_data)
619-{
620- GTask *new_started_task;
621-
622- new_started_task = g_task_new (NULL, NULL, callback, user_data);
623-
624- empathy_geoclue_helper_new_async (distance_threshold, new_started_init_cb,
625- new_started_task);
626-}
627-
628-EmpathyGeoclueHelper *
629-empathy_geoclue_helper_new_started_finish (GAsyncResult *result,
630- GError **error)
631-{
632- g_return_val_if_fail (g_task_is_valid (result, NULL), NULL);
633-
634- return g_task_propagate_pointer (G_TASK (result), error);
635-}
636--- empathy-3.12.6.orig/libempathy-gtk/empathy-geoclue-helper.h
637+++ /dev/null
638@@ -1,99 +0,0 @@
639-/*
640- * empathy-geoclue-helper.h
641- *
642- * Copyright (C) 2013 Collabora Ltd. <http://www.collabora.co.uk/>
643- *
644- * This library is free software; you can redistribute it and/or
645- * modify it under the terms of the GNU Lesser General Public
646- * License as published by the Free Software Foundation; either
647- * version 2.1 of the License, or (at your option) any later version.
648- *
649- * This library is distributed in the hope that it will be useful,
650- * but WITHOUT ANY WARRANTY; without even the implied warranty of
651- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
652- * Lesser General Public License for more details.
653- *
654- * You should have received a copy of the GNU Lesser General Public
655- * License along with this library; if not, write to the Free Software
656- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
657- */
658-
659-#ifndef __EMPATHY_GEOCLUE_HELPER_H__
660-#define __EMPATHY_GEOCLUE_HELPER_H__
661-
662-#include <glib-object.h>
663-
664-G_BEGIN_DECLS
665-
666-#include "geoclue-interface.h"
667-
668-typedef struct _EmpathyGeoclueHelper EmpathyGeoclueHelper;
669-typedef struct _EmpathyGeoclueHelperClass EmpathyGeoclueHelperClass;
670-typedef struct _EmpathyGeoclueHelperPriv EmpathyGeoclueHelperPriv;
671-
672-struct _EmpathyGeoclueHelperClass
673-{
674- /*<private>*/
675- GObjectClass parent_class;
676-};
677-
678-struct _EmpathyGeoclueHelper
679-{
680- /*<private>*/
681- GObject parent;
682- EmpathyGeoclueHelperPriv *priv;
683-};
684-
685-GType empathy_geoclue_helper_get_type (void);
686-
687-/* TYPE MACROS */
688-#define EMPATHY_TYPE_GEOCLUE_HELPER \
689- (empathy_geoclue_helper_get_type ())
690-#define EMPATHY_GEOCLUE_HELPER(obj) \
691- (G_TYPE_CHECK_INSTANCE_CAST((obj), \
692- EMPATHY_TYPE_GEOCLUE_HELPER, \
693- EmpathyGeoclueHelper))
694-#define EMPATHY_GEOCLUE_HELPER_CLASS(klass) \
695- (G_TYPE_CHECK_CLASS_CAST((klass), \
696- EMPATHY_TYPE_GEOCLUE_HELPER, \
697- EmpathyGeoclueHelperClass))
698-#define EMPATHY_IS_GEOCLUE_HELPER(obj) \
699- (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
700- EMPATHY_TYPE_GEOCLUE_HELPER))
701-#define EMPATHY_IS_GEOCLUE_HELPER_CLASS(klass) \
702- (G_TYPE_CHECK_CLASS_TYPE((klass), \
703- EMPATHY_TYPE_GEOCLUE_HELPER))
704-#define EMPATHY_GEOCLUE_HELPER_GET_CLASS(obj) \
705- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
706- EMPATHY_TYPE_GEOCLUE_HELPER, \
707- EmpathyGeoclueHelperClass))
708-
709-void empathy_geoclue_helper_new_async (guint distance_threshold,
710- GAsyncReadyCallback callback,
711- gpointer user_data);
712-
713-EmpathyGeoclueHelper * empathy_geoclue_helper_new_finish (GAsyncResult *result,
714- GError **error);
715-
716-void empathy_geoclue_helper_new_started_async (guint distance_threshold,
717- GAsyncReadyCallback callback,
718- gpointer user_data);
719-
720-EmpathyGeoclueHelper * empathy_geoclue_helper_new_started_finish (
721- GAsyncResult *result,
722- GError **error);
723-
724-void empathy_geoclue_helper_start_async (EmpathyGeoclueHelper *self,
725- GAsyncReadyCallback callback,
726- gpointer user_data);
727-
728-gboolean empathy_geoclue_helper_start_finish (EmpathyGeoclueHelper *self,
729- GAsyncResult *result,
730- GError **error);
731-
732-GClueLocation * empathy_geoclue_helper_get_location (
733- EmpathyGeoclueHelper *self);
734-
735-G_END_DECLS
736-
737-#endif /* #ifndef __EMPATHY_GEOCLUE_HELPER_H__*/
738--- empathy-3.12.6.orig/libempathy-gtk/empathy-location-manager.c
739+++ empathy-3.12.6/libempathy-gtk/empathy-location-manager.c
740@@ -24,11 +24,11 @@
741
742 #include <telepathy-glib/telepathy-glib-dbus.h>
743
744+#include <geoclue/geoclue-master.h>
745 #include <tp-account-widgets/tpaw-time.h>
746
747 #include "empathy-gsettings.h"
748 #include "empathy-location.h"
749-#include "empathy-geoclue-helper.h"
750
751 #define DEBUG_FLAG EMPATHY_DEBUG_LOCATION
752 #include "empathy-debug.h"
753@@ -37,16 +37,8 @@
754 #define TIMEOUT 10
755 static EmpathyLocationManager *location_manager = NULL;
756
757-typedef enum
758-{
759- GEOCLUE_NONE = 0,
760- GEOCLUE_STARTING,
761- GEOCLUE_STARTED,
762- GEOCLUE_FAILED,
763-} GeoclueStatus;
764-
765 struct _EmpathyLocationManagerPrivate {
766- GeoclueStatus geoclue_status;
767+ gboolean geoclue_is_setup;
768 /* Contains the location to be sent to accounts. Geoclue is used
769 * to populate it. This HashTable uses Telepathy's style (string,
770 * GValue). Keys are defined in empathy-location.h
771@@ -55,9 +47,13 @@ struct _EmpathyLocationManagerPrivate {
772
773 GSettings *gsettings_loc;
774
775+ GeoclueResourceFlags resources;
776+ GeoclueMasterClient *gc_client;
777+ GeocluePosition *gc_position;
778+ GeoclueAddress *gc_address;
779+
780 gboolean reduce_accuracy;
781 TpAccountManager *account_manager;
782- EmpathyGeoclueHelper *geoclue;
783
784 /* The idle id for publish_on_idle func */
785 guint timeout_id;
786@@ -97,6 +93,9 @@ location_manager_dispose (GObject *objec
787
788 tp_clear_object (&self->priv->account_manager);
789 tp_clear_object (&self->priv->gsettings_loc);
790+ tp_clear_object (&self->priv->gc_client);
791+ tp_clear_object (&self->priv->gc_position);
792+ tp_clear_object (&self->priv->gc_address);
793 tp_clear_pointer (&self->priv->location, g_hash_table_unref);
794
795 if (dispose != NULL)
796@@ -243,105 +242,333 @@ new_connection_cb (TpAccount *account,
797 }
798
799 static void
800-update_location (EmpathyLocationManager *self,
801- GClueLocation *proxy)
802+update_timestamp (EmpathyLocationManager *self)
803 {
804- gdouble latitude, longitude, accuracy;
805- const gchar *desc;
806 gint64 timestamp;
807
808- latitude = gclue_location_get_latitude (proxy);
809- longitude = gclue_location_get_longitude (proxy);
810- accuracy = gclue_location_get_accuracy (proxy);
811- desc = gclue_location_get_description (proxy);
812-
813- DEBUG ("Location updated: (%f %f) accuracy: %f (%s)",
814- latitude, longitude, accuracy, desc);
815-
816- if (self->priv->reduce_accuracy)
817- {
818- /* Truncate at 1 decimal place */
819- latitude = ((int) (latitude * 10)) / 10.0;
820- longitude = ((int) (longitude * 10)) / 10.0;
821+ timestamp = tpaw_time_get_current ();
822+ tp_asv_set_int64 (self->priv->location, EMPATHY_LOCATION_TIMESTAMP,
823+ timestamp);
824+
825+ DEBUG ("\t - Timestamp: %" G_GINT64_FORMAT, timestamp);
826+}
827+
828+static void
829+address_changed_cb (GeoclueAddress *address,
830+ int timestamp,
831+ GHashTable *details,
832+ GeoclueAccuracy *accuracy,
833+ gpointer user_data)
834+{
835+ EmpathyLocationManager *self = user_data;
836+ GeoclueAccuracyLevel level;
837+ GHashTableIter iter;
838+ gpointer key, value;
839+
840+ geoclue_accuracy_get_details (accuracy, &level, NULL, NULL);
841+ DEBUG ("New address (accuracy level %d):", level);
842+ /* FIXME: Publish accuracy level also considering the position's */
843+
844+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_STREET);
845+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_AREA);
846+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_REGION);
847+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_COUNTRY);
848+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_COUNTRY_CODE);
849+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_POSTAL_CODE);
850+
851+ if (g_hash_table_size (details) == 0)
852+ {
853+ DEBUG ("\t - (Empty)");
854+ return;
855+ }
856+
857+ g_hash_table_iter_init (&iter, details);
858+ while (g_hash_table_iter_next (&iter, &key, &value))
859+ {
860+ /* Discard street information if reduced accuracy is on */
861+ if (self->priv->reduce_accuracy &&
862+ !tp_strdiff (key, EMPATHY_LOCATION_STREET))
863+ continue;
864+
865+ tp_asv_set_string (self->priv->location, key, value);
866+
867+ DEBUG ("\t - %s: %s", (gchar *) key, (gchar *) value);
868+ }
869+
870+ update_timestamp (self);
871+ if (self->priv->timeout_id == 0)
872+ self->priv->timeout_id = g_timeout_add_seconds (TIMEOUT, publish_on_idle,
873+ self);
874+}
875+
876+static void
877+initial_address_cb (GeoclueAddress *address,
878+ int timestamp,
879+ GHashTable *details,
880+ GeoclueAccuracy *accuracy,
881+ GError *error,
882+ gpointer self)
883+{
884+ if (error)
885+ {
886+ DEBUG ("Error: %s", error->message);
887+ g_error_free (error);
888 }
889 else
890 {
891- /* Include the description only if we are not asked to reduce the
892- * accuracy as it can contains a pretty specific description of the
893- * location. */
894- tp_asv_set_string (self->priv->location, EMPATHY_LOCATION_DESCRIPTION,
895- desc);
896+ address_changed_cb (address, timestamp, details, accuracy, self);
897 }
898+}
899
900- tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_LAT, latitude);
901- tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_LON, longitude);
902- tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_ACCURACY, accuracy);
903+static void
904+position_changed_cb (GeocluePosition *position,
905+ GeocluePositionFields fields,
906+ int timestamp,
907+ double latitude,
908+ double longitude,
909+ double altitude,
910+ GeoclueAccuracy *accuracy,
911+ gpointer user_data)
912+{
913+ EmpathyLocationManager *self = user_data;
914+ GeoclueAccuracyLevel level;
915+ gdouble mean, horizontal, vertical;
916
917- timestamp = tpaw_time_get_current ();
918- tp_asv_set_int64 (self->priv->location, EMPATHY_LOCATION_TIMESTAMP,
919- timestamp);
920+ geoclue_accuracy_get_details (accuracy, &level, &horizontal, &vertical);
921+ DEBUG ("New position (accuracy level %d)", level);
922+ if (level == GEOCLUE_ACCURACY_LEVEL_NONE)
923+ return;
924+
925+ if (fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)
926+ {
927+
928+ if (self->priv->reduce_accuracy)
929+ /* Truncate at 1 decimal place */
930+ longitude = ((int) (longitude * 10)) / 10.0;
931
932+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_LON, longitude);
933+
934+ DEBUG ("\t - Longitude: %f", longitude);
935+ }
936+ else
937+ {
938+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_LON);
939+ }
940+
941+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE)
942+ {
943+ if (self->priv->reduce_accuracy)
944+ /* Truncate at 1 decimal place */
945+ latitude = ((int) (latitude * 10)) / 10.0;
946+
947+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_LAT, latitude);
948+
949+ DEBUG ("\t - Latitude: %f", latitude);
950+ }
951+ else
952+ {
953+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_LAT);
954+ }
955+
956+ if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE)
957+ {
958+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_ALT, altitude);
959+
960+ DEBUG ("\t - Altitude: %f", altitude);
961+ }
962+ else
963+ {
964+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_ALT);
965+ }
966+
967+ if (level == GEOCLUE_ACCURACY_LEVEL_DETAILED)
968+ {
969+ mean = (horizontal + vertical) / 2.0;
970+ tp_asv_set_double (self->priv->location, EMPATHY_LOCATION_ACCURACY, mean);
971+
972+ DEBUG ("\t - Accuracy: %f", mean);
973+ }
974+ else
975+ {
976+ g_hash_table_remove (self->priv->location, EMPATHY_LOCATION_ACCURACY);
977+ }
978+
979+ update_timestamp (self);
980 if (self->priv->timeout_id == 0)
981 self->priv->timeout_id = g_timeout_add_seconds (TIMEOUT, publish_on_idle,
982 self);
983 }
984
985 static void
986-location_changed_cb (EmpathyGeoclueHelper *geoclue,
987- GClueLocation *location,
988- EmpathyLocationManager *self)
989+initial_position_cb (GeocluePosition *position,
990+ GeocluePositionFields fields,
991+ int timestamp,
992+ double latitude,
993+ double longitude,
994+ double altitude,
995+ GeoclueAccuracy *accuracy,
996+ GError *error,
997+ gpointer self)
998 {
999- update_location (self, location);
1000+ if (error)
1001+ {
1002+ DEBUG ("Error: %s", error->message);
1003+ g_error_free (error);
1004+ }
1005+ else
1006+ {
1007+ position_changed_cb (position, fields, timestamp, latitude, longitude,
1008+ altitude, accuracy, self);
1009+ }
1010 }
1011
1012 static void
1013-geoclue_new_cb (GObject *source,
1014- GAsyncResult *result,
1015- gpointer user_data)
1016+set_requirements (EmpathyLocationManager *self,
1017+ GeoclueSetRequirementsCallback callback)
1018 {
1019- EmpathyLocationManager *self = EMPATHY_LOCATION_MANAGER (user_data);
1020- GError *error = NULL;
1021- GClueLocation *location;
1022+ geoclue_master_client_set_requirements_async (self->priv->gc_client,
1023+ GEOCLUE_ACCURACY_LEVEL_COUNTRY, 0, FALSE, self->priv->resources,
1024+ callback, self);
1025+}
1026+
1027+static void
1028+update_resources_set_requirements_cb (GeoclueMasterClient *client,
1029+ GError *error,
1030+ gpointer userdata)
1031+{
1032+ EmpathyLocationManager *self = userdata;
1033
1034- self->priv->geoclue = empathy_geoclue_helper_new_started_finish (result,
1035- &error);
1036+ if (error != NULL)
1037+ {
1038+ DEBUG ("set_requirements failed: %s", error->message);
1039+ g_error_free (error);
1040+ return;
1041+ }
1042
1043- if (self->priv->geoclue == NULL)
1044+ geoclue_address_get_address_async (self->priv->gc_address,
1045+ initial_address_cb, self);
1046+ geoclue_position_get_position_async (self->priv->gc_position,
1047+ initial_position_cb, self);
1048+}
1049+
1050+static void
1051+update_resources (EmpathyLocationManager *self)
1052+{
1053+ DEBUG ("Updating resources %d", self->priv->resources);
1054+
1055+ if (!self->priv->geoclue_is_setup)
1056+ return;
1057+
1058+ /* As per Geoclue bug #15126, using NONE results in no address
1059+ * being found as geoclue-manual report an empty address with
1060+ * accuracy = NONE */
1061+ set_requirements (self, update_resources_set_requirements_cb);
1062+}
1063+
1064+static void
1065+create_address_cb (GeoclueMasterClient *client,
1066+ GeoclueAddress *address,
1067+ GError *error,
1068+ gpointer userdata)
1069+{
1070+ EmpathyLocationManager *self = userdata;
1071+
1072+ if (error != NULL)
1073 {
1074- DEBUG ("Failed to create Geoclue client: %s", error->message);
1075+ DEBUG ("Failed to create GeoclueAddress: %s", error->message);
1076 g_error_free (error);
1077- self->priv->geoclue_status = GEOCLUE_FAILED;
1078 return;
1079 }
1080
1081- self->priv->geoclue_status = GEOCLUE_STARTED;
1082+ self->priv->gc_address = address;
1083
1084- g_signal_connect_object (self->priv->geoclue, "location-changed",
1085- G_CALLBACK (location_changed_cb), self, 0);
1086+ g_signal_connect (G_OBJECT (self->priv->gc_address), "address-changed",
1087+ G_CALLBACK (address_changed_cb), self);
1088
1089- location = empathy_geoclue_helper_get_location (self->priv->geoclue);
1090- if (location != NULL)
1091- update_location (self, location);
1092+ self->priv->geoclue_is_setup = TRUE;
1093 }
1094
1095 static void
1096-setup_geoclue (EmpathyLocationManager *self)
1097+create_position_cb (GeoclueMasterClient *client,
1098+ GeocluePosition *position,
1099+ GError *error,
1100+ gpointer userdata)
1101+{
1102+ EmpathyLocationManager *self = userdata;
1103+
1104+ if (error != NULL)
1105+ {
1106+ DEBUG ("Failed to create GeocluePosition: %s", error->message);
1107+ g_error_free (error);
1108+ return;
1109+ }
1110+
1111+ self->priv->gc_position = position;
1112+
1113+ g_signal_connect (G_OBJECT (self->priv->gc_position), "position-changed",
1114+ G_CALLBACK (position_changed_cb), self);
1115+
1116+ /* Get updated when the address changes */
1117+ geoclue_master_client_create_address_async (self->priv->gc_client,
1118+ create_address_cb, self);
1119+}
1120+
1121+static void
1122+create_client_set_requirements_cb (GeoclueMasterClient *client,
1123+ GError *error,
1124+ gpointer userdata)
1125+{
1126+ EmpathyLocationManager *self = userdata;
1127+
1128+ if (error != NULL)
1129+ {
1130+ DEBUG ("set_requirements failed: %s", error->message);
1131+ g_error_free (error);
1132+ return;
1133+ }
1134+
1135+ /* Get updated when the position is changes */
1136+ geoclue_master_client_create_position_async (self->priv->gc_client,
1137+ create_position_cb, self);
1138+}
1139+
1140+static void
1141+create_client_cb (GeoclueMaster *master,
1142+ GeoclueMasterClient *client,
1143+ char *object_path,
1144+ GError *error,
1145+ gpointer userdata)
1146 {
1147- switch (self->priv->geoclue_status)
1148+ EmpathyLocationManager *self = userdata;
1149+
1150+ if (error != NULL)
1151 {
1152- case GEOCLUE_NONE:
1153- g_assert (self->priv->geoclue == NULL);
1154- self->priv->geoclue_status = GEOCLUE_STARTING;
1155- empathy_geoclue_helper_new_started_async (0, geoclue_new_cb, self);
1156- break;
1157- case GEOCLUE_STARTED:
1158- case GEOCLUE_STARTING:
1159- case GEOCLUE_FAILED:
1160+ DEBUG ("Failed to create GeoclueMasterClient: %s", error->message);
1161+ g_error_free (error);
1162 return;
1163 }
1164+
1165+ /* @client seems be (transfer full) looking at the geoclue code; yeah for
1166+ * undocumented API... */
1167+ self->priv->gc_client = client;
1168+
1169+ set_requirements (self, create_client_set_requirements_cb);
1170 }
1171
1172 static void
1173+setup_geoclue (EmpathyLocationManager *self)
1174+{
1175+ GeoclueMaster *master;
1176+
1177+ DEBUG ("Setting up Geoclue");
1178+ master = geoclue_master_get_default ();
1179+
1180+ geoclue_master_create_client_async (master, create_client_cb, self);
1181+
1182+ g_object_unref (master);
1183+ }
1184+
1185+static void
1186 publish_cb (GSettings *gsettings_loc,
1187 const gchar *key,
1188 gpointer user_data)
1189@@ -352,7 +579,16 @@ publish_cb (GSettings *gsettings_loc,
1190
1191 if (g_settings_get_boolean (gsettings_loc, key))
1192 {
1193- setup_geoclue (self);
1194+ if (!self->priv->geoclue_is_setup)
1195+ setup_geoclue (self);
1196+ /* if still not setup than the init failed */
1197+ if (!self->priv->geoclue_is_setup)
1198+ return;
1199+
1200+ geoclue_address_get_address_async (self->priv->gc_address,
1201+ initial_address_cb, self);
1202+ geoclue_position_get_position_async (self->priv->gc_position,
1203+ initial_position_cb, self);
1204 }
1205 else
1206 {
1207@@ -361,10 +597,54 @@ publish_cb (GSettings *gsettings_loc,
1208 */
1209 g_hash_table_remove_all (self->priv->location);
1210 publish_to_all_connections (self, TRUE);
1211-
1212- g_clear_object (&self->priv->geoclue);
1213- self->priv->geoclue_status = GEOCLUE_NONE;
1214 }
1215+
1216+}
1217+
1218+static void
1219+resource_cb (GSettings *gsettings_loc,
1220+ const gchar *key,
1221+ gpointer user_data)
1222+{
1223+ EmpathyLocationManager *self = EMPATHY_LOCATION_MANAGER (user_data);
1224+ GeoclueResourceFlags resource = 0;
1225+
1226+ DEBUG ("%s changed", key);
1227+
1228+ if (!tp_strdiff (key, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK))
1229+ resource = GEOCLUE_RESOURCE_NETWORK;
1230+ if (!tp_strdiff (key, EMPATHY_PREFS_LOCATION_RESOURCE_CELL))
1231+ resource = GEOCLUE_RESOURCE_CELL;
1232+ if (!tp_strdiff (key, EMPATHY_PREFS_LOCATION_RESOURCE_GPS))
1233+ resource = GEOCLUE_RESOURCE_GPS;
1234+
1235+ if (g_settings_get_boolean (gsettings_loc, key))
1236+ self->priv->resources |= resource;
1237+ else
1238+ self->priv->resources &= ~resource;
1239+
1240+ if (self->priv->geoclue_is_setup)
1241+ update_resources (self);
1242+}
1243+
1244+static void
1245+accuracy_cb (GSettings *gsettings_loc,
1246+ const gchar *key,
1247+ gpointer user_data)
1248+{
1249+ EmpathyLocationManager *self = EMPATHY_LOCATION_MANAGER (user_data);
1250+
1251+ DEBUG ("%s changed", key);
1252+
1253+ self->priv->reduce_accuracy = g_settings_get_boolean (gsettings_loc, key);
1254+
1255+ if (!self->priv->geoclue_is_setup)
1256+ return;
1257+
1258+ geoclue_address_get_address_async (self->priv->gc_address,
1259+ initial_address_cb, self);
1260+ geoclue_position_get_position_async (self->priv->gc_position,
1261+ initial_position_cb, self);
1262 }
1263
1264 static void
1265@@ -402,6 +682,7 @@ empathy_location_manager_init (EmpathyLo
1266 EMPATHY_TYPE_LOCATION_MANAGER, EmpathyLocationManagerPrivate);
1267
1268 self->priv = priv;
1269+ priv->geoclue_is_setup = FALSE;
1270 priv->location = tp_asv_new (NULL, NULL);
1271 priv->gsettings_loc = g_settings_new (EMPATHY_PREFS_LOCATION_SCHEMA);
1272
1273@@ -415,7 +696,25 @@ empathy_location_manager_init (EmpathyLo
1274 g_signal_connect (priv->gsettings_loc,
1275 "changed::" EMPATHY_PREFS_LOCATION_PUBLISH,
1276 G_CALLBACK (publish_cb), self);
1277+ g_signal_connect (priv->gsettings_loc,
1278+ "changed::" EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
1279+ G_CALLBACK (resource_cb), self);
1280+ g_signal_connect (priv->gsettings_loc,
1281+ "changed::" EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
1282+ G_CALLBACK (resource_cb), self);
1283+ g_signal_connect (priv->gsettings_loc,
1284+ "changed::" EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
1285+ G_CALLBACK (resource_cb), self);
1286+ g_signal_connect (priv->gsettings_loc,
1287+ "changed::" EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
1288+ G_CALLBACK (accuracy_cb), self);
1289
1290+ resource_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
1291+ self);
1292+ resource_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_RESOURCE_CELL, self);
1293+ resource_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_RESOURCE_GPS, self);
1294+ accuracy_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
1295+ self);
1296 publish_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_PUBLISH, self);
1297 }
1298
1299--- empathy-3.12.6.orig/libempathy/empathy-gsettings.h
1300+++ empathy-3.12.6/libempathy/empathy-gsettings.h
1301@@ -83,6 +83,9 @@ G_BEGIN_DECLS
1302
1303 #define EMPATHY_PREFS_LOCATION_SCHEMA EMPATHY_PREFS_SCHEMA ".location"
1304 #define EMPATHY_PREFS_LOCATION_PUBLISH "publish"
1305+#define EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK "resource-network"
1306+#define EMPATHY_PREFS_LOCATION_RESOURCE_CELL "resource-cell"
1307+#define EMPATHY_PREFS_LOCATION_RESOURCE_GPS "resource-gps"
1308 #define EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY "reduce-accuracy"
1309
1310 #define EMPATHY_PREFS_LOGGER_SCHEMA "org.freedesktop.Telepathy.Logger"
1311--- empathy-3.12.6.orig/src/empathy-preferences.c
1312+++ empathy-3.12.6/src/empathy-preferences.c
1313@@ -191,6 +191,12 @@ preferences_setup_widgets (EmpathyPrefer
1314
1315 BIND_ACTIVE (loc, LOCATION_PUBLISH,
1316 "checkbutton_location_publish");
1317+ BIND_ACTIVE (loc, LOCATION_RESOURCE_NETWORK,
1318+ "checkbutton_location_resource_network");
1319+ BIND_ACTIVE (loc, LOCATION_RESOURCE_CELL,
1320+ "checkbutton_location_resource_cell");
1321+ BIND_ACTIVE (loc, LOCATION_RESOURCE_GPS,
1322+ "checkbutton_location_resource_gps");
1323 BIND_ACTIVE (loc, LOCATION_REDUCE_ACCURACY,
1324 "checkbutton_location_reduce_accuracy");
1325
1326--- empathy-3.12.6.orig/src/empathy-preferences.ui
1327+++ empathy-3.12.6/src/empathy-preferences.ui
1328@@ -833,6 +833,94 @@
1329 <property name="position">1</property>
1330 </packing>
1331 </child>
1332+ <child>
1333+ <object class="GtkFrame" id="frame5">
1334+ <property name="visible">True</property>
1335+ <property name="can_focus">False</property>
1336+ <property name="label_xalign">0</property>
1337+ <property name="shadow_type">none</property>
1338+ <child>
1339+ <object class="GtkAlignment" id="alignment4">
1340+ <property name="visible">True</property>
1341+ <property name="can_focus">False</property>
1342+ <property name="top_padding">6</property>
1343+ <property name="left_padding">12</property>
1344+ <child>
1345+ <object class="GtkBox" id="vbox5">
1346+ <property name="visible">True</property>
1347+ <property name="can_focus">False</property>
1348+ <property name="orientation">vertical</property>
1349+ <child>
1350+ <object class="GtkCheckButton" id="checkbutton_location_resource_gps">
1351+ <property name="label" translatable="yes">_GPS</property>
1352+ <property name="visible">True</property>
1353+ <property name="can_focus">True</property>
1354+ <property name="receives_default">False</property>
1355+ <property name="use_action_appearance">False</property>
1356+ <property name="use_underline">True</property>
1357+ <property name="draw_indicator">True</property>
1358+ </object>
1359+ <packing>
1360+ <property name="expand">False</property>
1361+ <property name="fill">False</property>
1362+ <property name="position">0</property>
1363+ </packing>
1364+ </child>
1365+ <child>
1366+ <object class="GtkCheckButton" id="checkbutton_location_resource_cell">
1367+ <property name="label" translatable="yes">_Cellphone</property>
1368+ <property name="visible">True</property>
1369+ <property name="can_focus">True</property>
1370+ <property name="receives_default">False</property>
1371+ <property name="use_action_appearance">False</property>
1372+ <property name="use_underline">True</property>
1373+ <property name="active">True</property>
1374+ <property name="draw_indicator">True</property>
1375+ </object>
1376+ <packing>
1377+ <property name="expand">False</property>
1378+ <property name="fill">False</property>
1379+ <property name="position">1</property>
1380+ </packing>
1381+ </child>
1382+ <child>
1383+ <object class="GtkCheckButton" id="checkbutton_location_resource_network">
1384+ <property name="label" translatable="yes">_Network (IP, Wi-Fi)</property>
1385+ <property name="visible">True</property>
1386+ <property name="can_focus">True</property>
1387+ <property name="receives_default">False</property>
1388+ <property name="use_action_appearance">False</property>
1389+ <property name="use_underline">True</property>
1390+ <property name="active">True</property>
1391+ <property name="draw_indicator">True</property>
1392+ </object>
1393+ <packing>
1394+ <property name="expand">False</property>
1395+ <property name="fill">False</property>
1396+ <property name="position">2</property>
1397+ </packing>
1398+ </child>
1399+ </object>
1400+ </child>
1401+ </object>
1402+ </child>
1403+ <child type="label">
1404+ <object class="GtkLabel" id="label5">
1405+ <property name="visible">True</property>
1406+ <property name="can_focus">False</property>
1407+ <property name="label" translatable="yes">Location sources:</property>
1408+ <attributes>
1409+ <attribute name="weight" value="bold"/>
1410+ </attributes>
1411+ </object>
1412+ </child>
1413+ </object>
1414+ <packing>
1415+ <property name="expand">False</property>
1416+ <property name="fill">True</property>
1417+ <property name="position">2</property>
1418+ </packing>
1419+ </child>
1420 </object>
1421 <packing>
1422 <property name="position">4</property>
14230
=== modified file 'debian/patches/series'
--- debian/patches/series 2014-09-24 08:32:39 +0000
+++ debian/patches/series 2014-11-08 20:15:08 +0000
@@ -8,4 +8,3 @@
842_shell_running.patch842_shell_running.patch
943_quicklists.patch943_quicklists.patch
10ubuntu_launch_uoa_panel.patch10ubuntu_launch_uoa_panel.patch
11Revert-geoclue-2.0.patch

Subscribers

People subscribed via source and target branches