[empathy] location-manager: use geoclue_master_client_create_position_async()



commit 3c6503936ec6703ef4c421d4ef3f30d140c4e114
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Mar 14 15:42:05 2012 +0100

    location-manager: use geoclue_master_client_create_position_async()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671994

 libempathy-gtk/empathy-location-manager.c |   34 +++++++++++++++++++---------
 1 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index ec7810f..9c72d30 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -476,7 +476,8 @@ update_resources (EmpathyLocationManager *self)
 }
 
 static void
-create_client_set_requirements_cb (GeoclueMasterClient *client,
+create_position_cb (GeoclueMasterClient *client,
+    GeocluePosition *position,
     GError *error,
     gpointer userdata)
 {
@@ -484,20 +485,12 @@ create_client_set_requirements_cb (GeoclueMasterClient *client,
 
   if (error != NULL)
     {
-      DEBUG ("set_requirements failed: %s", error->message);
-      return;
-    }
-
-  /* Get updated when the position is changes */
-  self->priv->gc_position = geoclue_master_client_create_position (
-      self->priv->gc_client, &error);
-  if (self->priv->gc_position == NULL)
-    {
       DEBUG ("Failed to create GeocluePosition: %s", error->message);
-      g_error_free (error);
       return;
     }
 
+  self->priv->gc_position = position;
+
   g_signal_connect (G_OBJECT (self->priv->gc_position), "position-changed",
       G_CALLBACK (position_changed_cb), self);
 
@@ -518,6 +511,25 @@ create_client_set_requirements_cb (GeoclueMasterClient *client,
 }
 
 static void
+create_client_set_requirements_cb (GeoclueMasterClient *client,
+    GError *error,
+    gpointer userdata)
+{
+  EmpathyLocationManager *self = userdata;
+
+  if (error != NULL)
+    {
+      DEBUG ("set_requirements failed: %s", error->message);
+      g_error_free (error);
+      return;
+    }
+
+  /* Get updated when the position is changes */
+  geoclue_master_client_create_position_async (self->priv->gc_client,
+      create_position_cb, self);
+}
+
+static void
 create_client_cb (GeoclueMaster *master,
     GeoclueMasterClient *client,
     char *object_path,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]