aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-location-manager.c
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-05-30 04:00:00 +0800
committerPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-01 23:35:33 +0800
commit992b424a41a2725eb96940cb3434ef0fd2a0e589 (patch)
treec23ebb710c620d37a6c08e4d9af969a8874f61ba /libempathy-gtk/empathy-location-manager.c
parent9713a23a9b42860aa76f02b82cbc7a761110c3aa (diff)
downloadgsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.tar
gsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.tar.gz
gsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.tar.bz2
gsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.tar.lz
gsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.tar.xz
gsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.tar.zst
gsoc2013-empathy-992b424a41a2725eb96940cb3434ef0fd2a0e589.zip
Use timeout instead of idle (and fix the fact that it wasn't actually working)
Diffstat (limited to 'libempathy-gtk/empathy-location-manager.c')
-rw-r--r--libempathy-gtk/empathy-location-manager.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 4c4e5e10c..0726661cb 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -44,6 +44,9 @@
#define DEBUG_FLAG EMPATHY_DEBUG_LOCATION
#include "libempathy/empathy-debug.h"
+/* Seconds before updating the location */
+#define TIMEOUT 10
+
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLocationManager)
typedef struct {
gboolean geoclue_is_setup;
@@ -65,7 +68,7 @@ typedef struct {
EmpathyAccountManager *account_manager;
/* The idle id for publish_on_idle func */
- guint idle_id;
+ guint timeout_id;
} EmpathyLocationManagerPriv;
static void location_manager_dispose (GObject *object);
@@ -117,7 +120,7 @@ publish_on_idle (gpointer user_data)
EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
- priv->idle_id = 0;
+ priv->timeout_id = 0;
publish_to_all_accounts (manager, TRUE);
return FALSE;
}
@@ -235,7 +238,6 @@ empathy_location_manager_init (EmpathyLocationManager *location_manager)
G_CALLBACK (account_connection_changed_cb), location_manager);
}
-
static void
location_manager_dispose (GObject *object)
{
@@ -275,7 +277,6 @@ location_manager_dispose (GObject *object)
G_OBJECT_CLASS (empathy_location_manager_parent_class)->finalize (object);
}
-
static void
location_manager_get_property (GObject *object,
guint param_id,
@@ -294,7 +295,6 @@ location_manager_get_property (GObject *object,
};
}
-
static void
location_manager_set_property (GObject *object,
guint param_id,
@@ -313,7 +313,6 @@ location_manager_set_property (GObject *object,
};
}
-
EmpathyLocationManager *
empathy_location_manager_dup_default (void)
{
@@ -427,8 +426,8 @@ position_changed_cb (GeocluePosition *position,
}
update_timestamp (location_manager);
- if (priv->idle_id == 0)
- g_idle_add (publish_on_idle, location_manager);
+ if (priv->timeout_id == 0)
+ priv->timeout_id = g_timeout_add_seconds (TIMEOUT, publish_on_idle, location_manager);
}
static void
@@ -488,11 +487,10 @@ address_changed_cb (GeoclueAddress *address,
update_timestamp (location_manager);
- if (priv->idle_id == 0)
- g_idle_add (publish_on_idle, location_manager);
+ if (priv->timeout_id == 0)
+ priv->timeout_id = g_timeout_add_seconds (TIMEOUT, publish_on_idle, location_manager);
}
-
static void
update_resources (EmpathyLocationManager *location_manager)
{
@@ -517,7 +515,6 @@ update_resources (EmpathyLocationManager *location_manager)
initial_address_cb, location_manager);
geoclue_position_get_position_async (priv->gc_position,
initial_position_cb, location_manager);
-
}
static void
@@ -606,7 +603,6 @@ publish_cb (EmpathyConf *conf,
}
-
static void
accuracy_cb (EmpathyConf *conf,
const gchar *key,