[Telepathy-commits] [telepathy-gabble/master] check if the number of buddies/activities to add/remove is not zero
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:47 PDT 2008
20080728144505-7fe3f-f73498828c4bf9d7a7da9ca60f1f4f9e99f37242.gz
---
src/olpc-view.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/olpc-view.c b/src/olpc-view.c
index fba6ff4..85bd199 100644
--- a/src/olpc-view.c
+++ b/src/olpc-view.c
@@ -484,11 +484,13 @@ gabble_olpc_view_add_buddies (GabbleOlpcView *self,
TpHandleRepoIface *room_repo;
GArray *buddies_changed;
+ g_assert (buddies->len == buddies_properties->len);
+ if (buddies->len == 0)
+ return;
+
room_repo = tp_base_connection_get_handles ((TpBaseConnection *) priv->conn,
TP_HANDLE_TYPE_ROOM);
- g_assert (buddies->len == buddies_properties->len);
-
empty = g_array_new (FALSE, FALSE, sizeof (TpHandle));
buddies_changed = g_array_new (FALSE, FALSE, sizeof (TpHandle));
@@ -567,6 +569,9 @@ gabble_olpc_view_remove_buddies (GabbleOlpcView *self,
{
GArray *removed, *empty;
+ if (tp_handle_set_size (buddies) == 0)
+ return;
+
tp_handle_set_foreach (buddies,
(TpHandleSetMemberFunc) remove_buddy_foreach, self);
@@ -617,6 +622,9 @@ gabble_olpc_view_add_activities (GabbleOlpcView *self,
GabbleOlpcViewPrivate *priv = GABBLE_OLPC_VIEW_GET_PRIVATE (self);
GPtrArray *added, *empty;
+ if (g_hash_table_size (activities) == 0)
+ return;
+
tp_g_hash_table_update (priv->activities, activities, NULL, g_object_ref);
added = g_ptr_array_new ();
@@ -669,6 +677,9 @@ gabble_olpc_view_remove_activities (GabbleOlpcView *self,
guint i;
TpHandleRepoIface *contact_repo;
+ if (tp_handle_set_size (rooms) == 0)
+ return;
+
contact_repo = tp_base_connection_get_handles (
(TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
--
1.5.6.5
More information about the Telepathy-commits
mailing list