summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-16 16:55:46 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-04-17 14:22:30 +0100
commit1ea36afc3ee47f1516dc6fa1f3001a66e75fd05f (patch)
tree10619334942267a336d65a2269ee7b04322b3cdf
parent767fc14eb59e0374e2c0a483f1fe421f810d0c23 (diff)
_tp_g_dbus_object_dup_interface_names_except: rename and remove arbitrary limit
-rw-r--r--telepathy-glib/base-connection.c5
-rw-r--r--telepathy-glib/base-protocol.c2
-rw-r--r--telepathy-glib/dbus-internal.h5
-rw-r--r--telepathy-glib/dbus.c29
4 files changed, 23 insertions, 18 deletions
diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index 3d284a6e1..eaa098c5f 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -676,8 +676,9 @@ tp_base_connection_interface_changed_cb (TpBaseConnection *self,
* every time, rather than doing anything intelligently diff-based. */
g_value_init (&value, G_TYPE_STRV);
g_value_take_boxed (&value,
- _tp_g_dbus_object_dup_interface_names (G_DBUS_OBJECT (self),
- TP_IFACE_CONNECTION, TP_IFACE_CONNECTION_INTERFACE_REQUESTS));
+ _tp_g_dbus_object_dup_interface_names_except (G_DBUS_OBJECT (self),
+ TP_IFACE_CONNECTION, TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
+ NULL));
g_object_set_property (G_OBJECT (self->priv->connection_skeleton),
"interfaces", &value);
g_value_unset (&value);
diff --git a/telepathy-glib/base-protocol.c b/telepathy-glib/base-protocol.c
index 99f2f3d72..e18507d78 100644
--- a/telepathy-glib/base-protocol.c
+++ b/telepathy-glib/base-protocol.c
@@ -1083,7 +1083,7 @@ protocol_properties_getter (GObject *object,
case PP_INTERFACES:
g_value_take_boxed (value,
- _tp_g_dbus_object_dup_interface_names (G_DBUS_OBJECT (self),
+ _tp_g_dbus_object_dup_interface_names_except (G_DBUS_OBJECT (self),
TP_IFACE_PROTOCOL, NULL));
break;
diff --git a/telepathy-glib/dbus-internal.h b/telepathy-glib/dbus-internal.h
index 114c55d39..264ce66ea 100644
--- a/telepathy-glib/dbus-internal.h
+++ b/telepathy-glib/dbus-internal.h
@@ -31,9 +31,8 @@ gboolean _tp_dbus_connection_get_name_owner (GDBusConnection *dbus_connection,
gint timeout_ms, const gchar *well_known_name, gchar **unique_name,
GError **error);
-GStrv _tp_g_dbus_object_dup_interface_names (GDBusObject *obj,
- const gchar *skip_class,
- const gchar *skip_type);
+GStrv _tp_g_dbus_object_dup_interface_names_except (GDBusObject *obj,
+ ...) G_GNUC_NULL_TERMINATED;
G_END_DECLS
diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 3026ec58a..4bc2c5912 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -1043,13 +1043,13 @@ tp_dbus_connection_unregister_object (GDBusConnection *dbus_connection,
}
GStrv
-_tp_g_dbus_object_dup_interface_names (GDBusObject *obj,
- const gchar *skip_class,
- const gchar *skip_type)
+_tp_g_dbus_object_dup_interface_names_except (GDBusObject *obj,
+ ...)
{
GList *ifaces = g_dbus_object_get_interfaces (obj);
GPtrArray *ret = g_ptr_array_new ();
GList *iter;
+ const gchar *skip;
for (iter = ifaces; iter != NULL; iter = iter->next)
{
@@ -1066,17 +1066,22 @@ _tp_g_dbus_object_dup_interface_names (GDBusObject *obj,
{
/* ignore org.freedesktop.DBus, which is implied/assumed */
}
- else if (skip_class != NULL && !tp_strdiff (skip_class, info->name))
- {
- /* ignore im.telepathy.v1.Channel or whatever */
- }
- else if (skip_type != NULL && !tp_strdiff (skip_type, info->name))
- {
- /* ignore im.telepathy.v1.Channel.Type.Call1 or whatever */
- }
else
{
- g_ptr_array_add (ret, g_strdup (info->name));
+ va_list ap;
+
+ va_start (ap, obj);
+
+ while ((skip = va_arg (ap, const gchar *)) != NULL)
+ {
+ if (!tp_strdiff (skip, info->name))
+ break;
+ }
+
+ va_end (ap);
+
+ if (skip == NULL)
+ g_ptr_array_add (ret, g_strdup (info->name));
}
}
else