From c03fe2d657f8cabf333622794e4d5f8dddbe8568 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 9 Apr 2014 18:32:34 +0100 Subject: [PATCH 7/8] tp_group_mixin_get_members etc.: remove accessors for members tp_group_mixin_get_local_pending_members_with_info() uses a dbus-glib data type, and none of these are actually used in the five core CMs (they all track members separately in any case). Make them private if used in the implementation, or remove them entirely. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77190 --- .../telepathy-glib/telepathy-glib-sections.txt | 6 - telepathy-glib/group-mixin.c | 127 ++------------------- telepathy-glib/group-mixin.h | 15 --- telepathy-glib/versions/main-1.0.abi | 6 - 4 files changed, 7 insertions(+), 147 deletions(-) diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt index 38956d8..ed33c3e 100644 --- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt @@ -1787,12 +1787,6 @@ tp_group_mixin_get_self_handle tp_group_mixin_get_group_flags tp_group_mixin_add_members tp_group_mixin_remove_members -tp_group_mixin_get_members -tp_group_mixin_get_local_pending_members -tp_group_mixin_get_local_pending_members_with_info -tp_group_mixin_get_remote_pending_members -tp_group_mixin_get_all_members -tp_group_mixin_get_handle_owners tp_group_mixin_change_flags tp_group_mixin_change_members tp_group_mixin_add_handle_owner diff --git a/telepathy-glib/group-mixin.c b/telepathy-glib/group-mixin.c index 12f81eb..8c5308a 100644 --- a/telepathy-glib/group-mixin.c +++ b/telepathy-glib/group-mixin.c @@ -77,6 +77,13 @@ #include "debug-internal.h" +static gboolean tp_group_mixin_get_members (GObject *obj, + GArray **ret, GError **error); +static gboolean tp_group_mixin_get_local_pending_members_with_info ( + GObject *obj, GPtrArray **ret, GError **error); +static gboolean tp_group_mixin_get_remote_pending_members (GObject *obj, + GArray **ret, GError **error); + static const char * group_change_reason_str (guint reason) { @@ -733,28 +740,6 @@ tp_group_mixin_get_members (GObject *obj, return TRUE; } -/** - * tp_group_mixin_get_local_pending_members: (skip) - * @obj: An object implementing the group interface using this mixin - * @ret: Used to return a newly-allocated GArray of guint contact handles - * @error: Unused - * - * Get the group's local-pending members. - * - * Returns: %TRUE - */ -gboolean -tp_group_mixin_get_local_pending_members (GObject *obj, - GArray **ret, - GError **error) -{ - TpGroupMixin *mixin = TP_GROUP_MIXIN (obj); - - *ret = tp_handle_set_to_array (mixin->local_pending); - - return TRUE; -} - typedef struct { TpGroupMixin *mixin; GPtrArray *array; @@ -841,104 +826,6 @@ tp_group_mixin_get_remote_pending_members (GObject *obj, return TRUE; } -/** - * tp_group_mixin_get_all_members: (skip) - * @obj: An object implementing the group interface using this mixin - * @members: Used to return a newly-allocated GArray of guint representing - * the handles of the group's members - * @local_pending: Used to return a newly-allocated GArray of guint - * representing the handles of the group's local pending members - * @remote_pending: Used to return a newly-allocated GArray of guint - * representing the handles of the group's remote pending members - * @error: Unused - * - * Get the group's current and pending members. - * - * Returns: %TRUE - */ -gboolean -tp_group_mixin_get_all_members (GObject *obj, - GArray **members, - GArray **local_pending, - GArray **remote_pending, - GError **error) -{ - TpGroupMixin *mixin = TP_GROUP_MIXIN (obj); - - *members = tp_handle_set_to_array (mixin->members); - *local_pending = tp_handle_set_to_array (mixin->local_pending); - *remote_pending = tp_handle_set_to_array (mixin->remote_pending); - - return TRUE; -} - -/** - * tp_group_mixin_get_handle_owners: (skip) - * @obj: An object implementing the group interface with this mixin - * @handles: An array of guint representing locally valid handles - * @ret: Used to return an array of guint representing globally valid - * handles, or 0 where unavailable, if %TRUE is returned - * @error: Used to return an error if %FALSE is returned - * - * If the mixin has the flag %TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES, - * return the global owners of the given local handles, or 0 where - * unavailable. - * - * Returns: %TRUE (setting @ret) on success, %FALSE (setting @error) on - * failure - */ -gboolean -tp_group_mixin_get_handle_owners (GObject *obj, - const GArray *handles, - GArray **ret, - GError **error) -{ - TpGroupMixin *mixin = TP_GROUP_MIXIN (obj); - TpGroupMixinPrivate *priv = mixin->priv; - guint i; - - if ((mixin->group_flags & - TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES) == 0) - { - g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "channel doesn't have channel specific handles"); - - return FALSE; - } - - if (!tp_handles_are_valid (mixin->handle_repo, handles, FALSE, error)) - { - return FALSE; - } - - *ret = g_array_sized_new (FALSE, FALSE, sizeof (TpHandle), handles->len); - - for (i = 0; i < handles->len; i++) - { - TpHandle local_handle = g_array_index (handles, TpHandle, i); - TpHandle owner_handle; - - if (!tp_handle_set_is_member (mixin->members, local_handle)) - { - g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "handle %u is not a member", local_handle); - - g_array_unref (*ret); - *ret = NULL; - - return FALSE; - } - - owner_handle = GPOINTER_TO_UINT ( - g_hash_table_lookup (priv->handle_owners, - GUINT_TO_POINTER (local_handle))); - - g_array_append_val (*ret, owner_handle); - } - - return TRUE; -} - #define GFTS_APPEND_FLAG_IF_SET(flag) \ if (flags & flag) \ { \ diff --git a/telepathy-glib/group-mixin.h b/telepathy-glib/group-mixin.h index 1f2d7cb..677335e 100644 --- a/telepathy-glib/group-mixin.h +++ b/telepathy-glib/group-mixin.h @@ -187,21 +187,6 @@ gboolean tp_group_mixin_remove_members (GObject *obj, const GArray *contacts, const gchar *message, guint reason, GError **error); -gboolean tp_group_mixin_get_members (GObject *obj, - GArray **ret, GError **error); -gboolean tp_group_mixin_get_local_pending_members (GObject *obj, - GArray **ret, GError **error); -gboolean tp_group_mixin_get_local_pending_members_with_info (GObject *obj, - GPtrArray **ret, GError **error); -gboolean tp_group_mixin_get_remote_pending_members (GObject *obj, - GArray **ret, GError **error); -gboolean tp_group_mixin_get_all_members (GObject *obj, - GArray **members, GArray **local_pending, GArray **remote_pending, - GError **error); - -gboolean tp_group_mixin_get_handle_owners (GObject *obj, - const GArray *handles, GArray **ret, GError **error); - void tp_group_mixin_change_flags (GObject *obj, TpChannelGroupFlags add, TpChannelGroupFlags del); gboolean tp_group_mixin_change_members (GObject *obj, diff --git a/telepathy-glib/versions/main-1.0.abi b/telepathy-glib/versions/main-1.0.abi index b8ff454..f404e2d 100644 --- a/telepathy-glib/versions/main-1.0.abi +++ b/telepathy-glib/versions/main-1.0.abi @@ -866,15 +866,9 @@ tp_group_mixin_class_get_offset_quark tp_group_mixin_class_init tp_group_mixin_class_set_remove_with_reason_func tp_group_mixin_finalize -tp_group_mixin_get_all_members tp_group_mixin_get_dbus_property tp_group_mixin_get_group_flags -tp_group_mixin_get_handle_owners -tp_group_mixin_get_local_pending_members -tp_group_mixin_get_local_pending_members_with_info -tp_group_mixin_get_members tp_group_mixin_get_offset_quark -tp_group_mixin_get_remote_pending_members tp_group_mixin_get_self_handle tp_group_mixin_iface_init tp_group_mixin_init -- 1.9.1