aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-location-manager.c
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-01-22 13:03:54 +0800
committerPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-01 23:35:31 +0800
commitcab630a8ac359a8f44fdd30a5c3c128ef5d0916a (patch)
tree557d33b12f9eed8bf63065066bbde28e10bb0784 /libempathy-gtk/empathy-location-manager.c
parent2bf4823a18e5e140d13cfc37fa767b9e05daac02 (diff)
downloadgsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.tar
gsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.tar.gz
gsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.tar.bz2
gsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.tar.lz
gsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.tar.xz
gsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.tar.zst
gsoc2013-empathy-cab630a8ac359a8f44fdd30a5c3c128ef5d0916a.zip
Merge fixes due to API changes
Diffstat (limited to 'libempathy-gtk/empathy-location-manager.c')
-rw-r--r--libempathy-gtk/empathy-location-manager.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 7a2b60c4a..c0595818e 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -37,6 +37,7 @@
#include "empathy-location-manager.h"
#include "empathy-conf.h"
+#include "libempathy/empathy-account-manager.h"
#include "libempathy/empathy-enum-types.h"
#include "libempathy/empathy-location.h"
#include "libempathy/empathy-contact-factory.h"
@@ -59,6 +60,7 @@ typedef struct {
#endif
gboolean reduce_accuracy;
gdouble reduce_value;
+ EmpathyAccountManager *account_manager;
} EmpathyLocationManagerPriv;
static void location_manager_finalize (GObject *object);
@@ -82,6 +84,10 @@ static void resource_cb (EmpathyConf *conf, const gchar *key,
static void accuracy_cb (EmpathyConf *conf, const gchar *key,
gpointer user_data);
#endif
+static void account_connection_changed_cb (EmpathyAccountManager *manager,
+ McAccount *account, TpConnectionStatusReason reason,
+ TpConnectionStatus current, TpConnectionStatus previous,
+ gpointer *location_manager);
G_DEFINE_TYPE (EmpathyLocationManager, empathy_location_manager, G_TYPE_OBJECT);
@@ -113,7 +119,7 @@ publish_location (EmpathyLocationManager *location_manager,
guint connection_status = -1;
gboolean can_publish;
EmpathyConf *conf = empathy_conf_get ();
- EmpathyContactFactory *factory = empathy_contact_factory_new ();
+ EmpathyContactFactory *factory = empathy_contact_factory_dup_singleton ();
priv = GET_PRIV (location_manager);
@@ -155,16 +161,17 @@ publish_location_to_all_accounts (EmpathyLocationManager *location_manager,
}
static void
-account_status_changed_cb (MissionControl *mc,
- TpConnectionStatus status,
- McPresence presence,
- TpConnectionStatusReason reason,
- const gchar *unique_name,
- gpointer *location_manager)
+account_connection_changed_cb (EmpathyAccountManager *manager,
+ McAccount *account,
+ TpConnectionStatusReason reason,
+ TpConnectionStatus current,
+ TpConnectionStatus previous,
+ gpointer *location_manager)
{
- DEBUG ("Account %s changed status to %d", unique_name, status);
- McAccount *account = mc_account_lookup (unique_name);
- if (account && status == TP_CONNECTION_STATUS_CONNECTED)
+ DEBUG ("Account %s changed status from %d to %d", mc_account_get_display_name (account),
+ previous, current);
+
+ if (account && current == TP_CONNECTION_STATUS_CONNECTED)
publish_location (EMPATHY_LOCATION_MANAGER (location_manager), account,
FALSE);
}
@@ -178,7 +185,7 @@ empathy_location_manager_init (EmpathyLocationManager *location_manager)
location_manager->priv = priv;
priv->is_setup = FALSE;
- priv->mc = empathy_mission_control_new ();
+ priv->mc = empathy_mission_control_dup_singleton ();
priv->location = g_hash_table_new_full (g_direct_hash, g_direct_equal,
g_free, (GDestroyNotify) tp_g_value_slice_free);
@@ -202,8 +209,10 @@ empathy_location_manager_init (EmpathyLocationManager *location_manager)
publish_cb (conf, EMPATHY_PREFS_LOCATION_PUBLISH, location_manager);
// Setup account status callbacks
- priv->token = empathy_connect_to_account_status_changed (priv->mc,
- G_CALLBACK (account_status_changed_cb), location_manager, NULL);
+ priv->account_manager = empathy_account_manager_dup_singleton ();
+ g_signal_connect (priv->account_manager,
+ "account-connection-changed",
+ G_CALLBACK (account_connection_changed_cb), location_manager);
}
@@ -215,6 +224,7 @@ location_manager_finalize (GObject *object)
priv = GET_PRIV (object);
DEBUG ("finalize: %p", object);
+ g_object_unref (priv->account_manager);
G_OBJECT_CLASS (empathy_location_manager_parent_class)->finalize (object);
}