[empathy: 42/59] idle: use the TpAccount pointer as key to the hash table, and remove values on disconnect
- From: Jonny Lamb <jonnylamb src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy: 42/59] idle: use the TpAccount pointer as key to the hash table, and remove values on disconnect
- Date: Mon, 2 Nov 2009 13:41:25 +0000 (UTC)
commit c4fdd8511467729baed7df2db9b40d8eea16a38a
Author: Jonny Lamb <jonnylamb gnome org>
Date: Sat Oct 24 18:52:02 2009 +0100
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>
libempathy/empathy-idle.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 7f68b79..2d20210 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]