[next] telepathy-mission-control: McdStorage: rewrite unique_name to avoid dbus_g_connection_lookup_g_object
Simon McVittie
smcv at kemper.freedesktop.org
Thu Apr 3 07:28:02 PDT 2014
Module: telepathy-mission-control
Branch: next
Commit: 705fa4b8ad68461023806610634cc71c6e0588f1
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=705fa4b8ad68461023806610634cc71c6e0588f1
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Fri Mar 21 17:58:22 2014 +0000
McdStorage: rewrite unique_name to avoid dbus_g_connection_lookup_g_object
If we don't have an account in the McdStorage, its object path won't
be in use.
---
src/mcd-storage.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index 9bb14ff..4e37214 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -328,9 +328,6 @@ unique_name (const McpAccountManager *ma,
McdStorage *self = MCD_STORAGE (ma);
gchar *esc_manager, *esc_protocol, *esc_base;
guint i;
- gsize base_len = strlen (TP_ACCOUNT_OBJECT_PATH_BASE);
- TpDBusDaemon *dbus = tp_client_factory_get_dbus_daemon (self->factory);
- DBusGConnection *connection = tp_proxy_get_dbus_connection (dbus);
esc_manager = tp_escape_as_identifier (manager);
esc_protocol = g_strdelimit (g_strdup (protocol), "-", '_');
@@ -338,20 +335,15 @@ unique_name (const McpAccountManager *ma,
for (i = 0; i < G_MAXUINT; i++)
{
- gchar *path = g_strdup_printf (
- TP_ACCOUNT_OBJECT_PATH_BASE "%s/%s/%s%u",
+ gchar *tail = g_strdup_printf ("%s/%s/%s%u",
esc_manager, esc_protocol, esc_base, i);
- if (!g_hash_table_contains (self->accounts, path + base_len) &&
- dbus_g_connection_lookup_g_object (connection, path) == NULL)
+ if (!g_hash_table_contains (self->accounts, tail))
{
- gchar *ret = g_strdup (path + base_len);
-
- g_free (path);
- return ret;
+ return tail;
}
- g_free (path);
+ g_free (tail);
}
return NULL;
More information about the telepathy-commits
mailing list