From 7c57c72f88500615ceb60df6eebc8be178ae4901 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 11 Apr 2011 17:31:27 +0200 Subject: [PATCH] More use tp_proxy_add_interfaces() --- telepathy-glib/account.c | 23 +++-------------------- telepathy-glib/channel-dispatch-operation.c | 17 +---------------- telepathy-glib/channel.c | 17 +---------------- telepathy-glib/connection-manager.c | 18 +----------------- 4 files changed, 6 insertions(+), 69 deletions(-) diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c index 551d95f..d521986 100644 --- a/telepathy-glib/account.c +++ b/telepathy-glib/account.c @@ -464,27 +464,10 @@ _tp_account_update (TpAccount *account, TpConnectionStatus old_s = priv->connection_status; gboolean status_changed = FALSE; gboolean presence_changed = FALSE; + const gchar * const *interfaces; - if (g_hash_table_lookup (properties, "Interfaces") != NULL) - { - gchar **interfaces, **iter; - - interfaces = tp_asv_get_boxed (properties, "Interfaces", G_TYPE_STRV); - - for (iter = interfaces; *iter != NULL; iter++) - { - if (tp_dbus_check_valid_interface_name (*iter, NULL)) - { - GQuark q = g_quark_from_string (*iter); - - tp_proxy_add_interface_by_id ((TpProxy *) account, q); - } - else - { - DEBUG ("\t\tInterface %s not valid", *iter); - } - } - } + interfaces = tp_asv_get_boxed (properties, "Interfaces", G_TYPE_STRV); + tp_proxy_add_interfaces (proxy, interfaces); if (g_hash_table_lookup (properties, "ConnectionStatus") != NULL) { diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c index e1018c4..6170883 100644 --- a/telepathy-glib/channel-dispatch-operation.c +++ b/telepathy-glib/channel-dispatch-operation.c @@ -334,25 +334,10 @@ static void maybe_set_interfaces (TpChannelDispatchOperation *self, const gchar **interfaces) { - const gchar **iter; - if (interfaces == NULL) return; - for (iter = interfaces; *iter != NULL; iter++) - { - DEBUG ("- %s", *iter); - - if (tp_dbus_check_valid_interface_name (*iter, NULL)) - { - GQuark q = g_quark_from_string (*iter); - tp_proxy_add_interface_by_id ((TpProxy *) self, q); - } - else - { - DEBUG ("\tInterface %s not valid, ignoring it", *iter); - } - } + tp_proxy_add_interfaces ((TpProxy *) self, interfaces); g_hash_table_insert (self->priv->immutable_properties, g_strdup (TP_PROP_CHANNEL_DISPATCH_OPERATION_INTERFACES), diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c index 2270a67..21bfc3f 100644 --- a/telepathy-glib/channel.c +++ b/telepathy-glib/channel.c @@ -558,25 +558,10 @@ static void _tp_channel_maybe_set_interfaces (TpChannel *self, const gchar **interfaces) { - const gchar **iter; - if (interfaces == NULL) return; - for (iter = interfaces; *iter != NULL; iter++) - { - DEBUG ("- %s", *iter); - - if (tp_dbus_check_valid_interface_name (*iter, NULL)) - { - GQuark q = g_quark_from_string (*iter); - tp_proxy_add_interface_by_id ((TpProxy *) self, q); - } - else - { - DEBUG ("\tInterface %s not valid, ignoring it", *iter); - } - } + tp_proxy_add_interfaces ((TpProxy *) self, interfaces); g_hash_table_insert (self->priv->channel_properties, g_strdup (TP_PROP_CHANNEL_INTERFACES), diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c index e359988..fb1a5c4 100644 --- a/telepathy-glib/connection-manager.c +++ b/telepathy-glib/connection-manager.c @@ -708,23 +708,7 @@ static void tp_connection_manager_add_interfaces (TpConnectionManager *self, const gchar * const * interfaces) { - if (interfaces == NULL) - return; - - for (; *interfaces != NULL; interfaces++) - { - if (tp_dbus_check_valid_interface_name (*interfaces, NULL)) - { - GQuark q = g_quark_from_string (*interfaces); - - tp_proxy_add_interface_by_id ((TpProxy *) self, q); - } - else - { - DEBUG ("Ignoring invalid interface on %s: %s", - tp_proxy_get_object_path (self), *interfaces); - } - } + tp_proxy_add_interfaces ((TpProxy *) self, interfaces); } static void -- 1.7.4.1