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

Proposed by Jackson Doak on 2014-11-08
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 2014-11-08 Needs Information on 2014-11-13
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.
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
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 on 2014-11-08

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

Subscribers

People subscribed via source and target branches

to all changes: