[Telepathy-commits] [telepathy-gabble/master] emit the BuddyInfo.ActivitiesChanged signal after View.BuddiesChanged so client knows where these buddies come from
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:46 PDT 2008
20080723152545-7fe3f-4e1b5234d399e6cd8464a292bc4c229246176d08.gz
---
src/olpc-view.c | 18 ++++++++++++++++--
tests/twisted/olpc/olpc-activity-search.py | 15 ++++++++-------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/olpc-view.c b/src/olpc-view.c
index 0668eda..d66a785 100644
--- a/src/olpc-view.c
+++ b/src/olpc-view.c
@@ -482,6 +482,7 @@ gabble_olpc_view_add_buddies (GabbleOlpcView *self,
guint i;
GArray *empty;
TpHandleRepoIface *room_repo;
+ GArray *buddies_changed;
room_repo = tp_base_connection_get_handles ((TpBaseConnection *) priv->conn,
TP_HANDLE_TYPE_ROOM);
@@ -489,6 +490,7 @@ gabble_olpc_view_add_buddies (GabbleOlpcView *self,
g_assert (buddies->len == buddies_properties->len);
empty = g_array_new (FALSE, FALSE, sizeof (TpHandle));
+ buddies_changed = g_array_new (FALSE, FALSE, sizeof (TpHandle));
/* store properties */
for (i = 0; i < buddies->len; i++)
@@ -524,14 +526,26 @@ gabble_olpc_view_add_buddies (GabbleOlpcView *self,
{
tp_handle_set_add (set, room);
- g_signal_emit (G_OBJECT (self),
- signals[BUDDY_ACTIVITIES_CHANGED], 0, handle);
+ /* We fire BuddyInfo.ActivitiesChanged signal after
+ * View.BuddiesChanged so client knows where these buddies
+ * come from */
+ g_array_append_val (buddies_changed, handle);
}
}
}
gabble_svc_olpc_view_emit_buddies_changed (self, buddies, empty);
+ for (i = 0; i < buddies_changed->len; i++)
+ {
+ TpHandle handle;
+
+ handle = g_array_index (buddies_changed, TpHandle, i);
+ g_signal_emit (G_OBJECT (self),
+ signals[BUDDY_ACTIVITIES_CHANGED], 0, handle);
+ }
+
+ g_array_free (buddies_changed, TRUE);
g_array_free (empty, TRUE);
}
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 437e86c..c9d1180 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -89,6 +89,10 @@ def test(q, bus, conn, stream):
interface='org.laptop.Telepathy.View',
args=[[('activity1', handles['room1'])], []])
+ # participants are added to view
+ q.expect('dbus-signal', signal='BuddiesChanged',
+ args=[[handles['lucien'], handles['jean']], []])
+
# participants are added to activity
q.expect_many(
EventPattern('dbus-signal', signal='ActivitiesChanged',
@@ -98,10 +102,6 @@ def test(q, bus, conn, stream):
interface='org.laptop.Telepathy.BuddyInfo',
args=[handles['jean'], [('activity1', handles['room1'])]]))
- # participants are added to view
- q.expect('dbus-signal', signal='BuddiesChanged',
- args=[[handles['lucien'], handles['jean']], []])
-
# check activities and buddies in view
check_view(view0_iface, conn, [('activity1', handles['room1'])],
['lucien at localhost', 'jean at localhost'])
@@ -262,6 +262,10 @@ def test(q, bus, conn, stream):
assert sorted(conn.InspectHandles(2, [handles['room4']])) == \
['room4 at conference.localhost']
+ # buddies are added to view
+ q.expect('dbus-signal', signal='BuddiesChanged',
+ args=[[handles['fernand'], handles['jean']], []])
+
# buddies are added to activity
q.expect_many(
EventPattern('dbus-signal', signal='ActivitiesChanged',
@@ -272,9 +276,6 @@ def test(q, bus, conn, stream):
args=[handles['jean'], [('activity1', handles['room1']),
('activity4', handles['room4'])]]))
- q.expect('dbus-signal', signal='BuddiesChanged',
- args=[[handles['fernand'], handles['jean']], []])
-
# check activities and buddies in view
check_view(view0_iface, conn, [
('activity1', handles['room1']), ('activity4', handles['room4'])],
--
1.5.6.5
More information about the Telepathy-commits
mailing list