[empathy/gnome-2-30] factor out set_requirements
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy/gnome-2-30] factor out set_requirements
- Date: Wed, 9 Jun 2010 08:12:24 +0000 (UTC)
commit 2842333f503ad762c2ff52ed33a1fd44463147d6
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed Jun 9 10:06:26 2010 +0200
factor out set_requirements
libempathy-gtk/empathy-location-manager.c | 36 +++++++++++++++++-----------
1 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index b04e881..ec6ce3c 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -499,6 +499,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)
{
@@ -512,13 +530,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);
@@ -546,13 +559,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 (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]