summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-04-22 15:23:20 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-04-23 19:23:52 +0100
commit4d3e0713ce1e00d42ee279a733115aca9befcd23 (patch)
tree51e94037894b33bace1788f5f3a503af6cb6f8c4
parent514edf719f95731c1e32aea21fa4f9a169b985ad (diff)
TpAccount: don't notify::connection unless something actually changed
Also, change connection_object_path if someone staples on a connection using tp_account_ensure_connection().
-rw-r--r--telepathy-glib/account.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index f6093aea3..eaa36574d 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -432,7 +432,12 @@ _tp_account_set_connection (TpAccount *account,
}
}
- g_object_notify (G_OBJECT (account), "connection");
+ if (tp_strdiff (priv->connection_object_path, path))
+ {
+ g_free (priv->connection_object_path);
+ priv->connection_object_path = g_strdup (path);
+ g_object_notify (G_OBJECT (account), "connection");
+ }
}
static void
@@ -601,19 +606,19 @@ _tp_account_update (TpAccount *account,
if (g_hash_table_lookup (properties, "Connection") != NULL)
{
- g_free (priv->connection_object_path);
-
- priv->connection_object_path =
- g_strdup (tp_asv_get_object_path (properties, "Connection"));
+ const gchar *path = tp_asv_get_object_path (properties, "Connection");
- if (priv->connection != NULL)
+ if (tp_strdiff (path, priv->connection_object_path))
{
- if (tp_strdiff (priv->connection_object_path,
- tp_proxy_get_object_path (priv->connection)))
+ g_free (priv->connection_object_path);
+
+ priv->connection_object_path = g_strdup (path);
+
+ if (priv->connection != NULL)
_tp_account_free_connection (account);
- }
- g_object_notify (G_OBJECT (account), "connection");
+ g_object_notify (G_OBJECT (account), "connection");
+ }
}
if (g_hash_table_lookup (properties, "ConnectAutomatically") != NULL)