aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-location-manager.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-09 16:06:26 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-09 16:06:26 +0800
commit4331e1a45060bac43c4083df8ca22f6be7361d92 (patch)
treef3cf560856e6b13ed0fddebec0c75964450ee8b8 /libempathy-gtk/empathy-location-manager.c
parente74e1d64e45dba2677757dfff5adafabc611b13f (diff)
downloadgsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.tar
gsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.tar.gz
gsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.tar.bz2
gsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.tar.lz
gsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.tar.xz
gsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.tar.zst
gsoc2013-empathy-4331e1a45060bac43c4083df8ca22f6be7361d92.zip
factor out set_requirements
Diffstat (limited to 'libempathy-gtk/empathy-location-manager.c')
-rw-r--r--libempathy-gtk/empathy-location-manager.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 3fd324917..89e0a014b 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -506,6 +506,24 @@ initial_position_cb (GeocluePosition *position,
}
}
+static gboolean
+set_requirements (EmpathyLocationManager *self)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (self);
+ GError *error = NULL;
+
+ if (!geoclue_master_client_set_requirements (priv->gc_client,
+ GEOCLUE_ACCURACY_LEVEL_COUNTRY, 0, FALSE, priv->resources,
+ &error))
+ {
+ DEBUG ("set_requirements failed: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
update_resources (EmpathyLocationManager *self)
{
@@ -519,13 +537,8 @@ update_resources (EmpathyLocationManager *self)
/* As per Geoclue bug #15126, using NONE results in no address
* being found as geoclue-manual report an empty address with
* accuracy = NONE */
- if (!geoclue_master_client_set_requirements (priv->gc_client,
- GEOCLUE_ACCURACY_LEVEL_COUNTRY, 0, FALSE, priv->resources,
- NULL))
- {
- DEBUG ("set_requirements failed");
- return;
- }
+ if (!set_requirements (self))
+ return;
geoclue_address_get_address_async (priv->gc_address,
initial_address_cb, self);
@@ -553,13 +566,8 @@ setup_geoclue (EmpathyLocationManager *self)
return;
}
- if (!geoclue_master_client_set_requirements (priv->gc_client,
- GEOCLUE_ACCURACY_LEVEL_COUNTRY, 0, FALSE, priv->resources,
- NULL))
- {
- DEBUG ("set_requirements failed");
- return;
- }
+ if (!set_requirements (self))
+ return;
/* Get updated when the position is changes */
priv->gc_position = geoclue_master_client_create_position (