aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorJonny Lamb <jonnylamb@gnome.org>2009-10-25 01:52:02 +0800
committerJonny Lamb <jonnylamb@gnome.org>2009-10-25 01:52:02 +0800
commitc4fdd8511467729baed7df2db9b40d8eea16a38a (patch)
tree5e0503e420d369490a3c410aeb7e2ed5555da431 /libempathy
parent3109ed5adee0f039b9010f23ae6cd84ef464a046 (diff)
downloadgsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.tar
gsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.tar.gz
gsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.tar.bz2
gsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.tar.lz
gsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.tar.xz
gsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.tar.zst
gsoc2013-empathy-c4fdd8511467729baed7df2db9b40d8eea16a38a.zip
idle: use the TpAccount pointer as key to the hash table, and remove values on disconnect
https://bugzilla.gnome.org/show_bug.cgi?id=599169#c2 Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-idle.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 7f68b7947..2d2021054 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -454,15 +454,13 @@ account_status_changed_cb (TpAccount *account,
EmpathyIdlePriv *priv = GET_PRIV (idle);
GTimeVal val;
- if (new_status != TP_CONNECTION_STATUS_CONNECTED) {
- return;
+ if (new_status == TP_CONNECTION_STATUS_CONNECTED) {
+ g_get_current_time (&val);
+ g_hash_table_insert (priv->connect_times, account,
+ GINT_TO_POINTER (val.tv_sec));
+ } else if (new_status == TP_CONNECTION_STATUS_DISCONNECTED) {
+ g_hash_table_remove (priv->connect_times, account);
}
-
- g_get_current_time (&val);
-
- g_hash_table_insert (priv->connect_times,
- g_strdup (tp_proxy_get_object_path (account)),
- GINT_TO_POINTER (val.tv_sec));
}
static void
@@ -534,8 +532,7 @@ empathy_idle_init (EmpathyIdle *idle)
priv->state_change_signal_id = g_signal_connect (priv->connectivity,
"state-change", G_CALLBACK (idle_state_change_cb), idle);
- priv->connect_times = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free, NULL);
+ priv->connect_times = g_hash_table_new (g_direct_hash, g_direct_equal);
}
EmpathyIdle *
@@ -729,8 +726,7 @@ empathy_idle_account_is_just_connected (EmpathyIdle *idle,
return FALSE;
}
- ptr = g_hash_table_lookup (priv->connect_times,
- tp_proxy_get_object_path (account));
+ ptr = g_hash_table_lookup (priv->connect_times, account);
if (ptr == NULL) {
return FALSE;