telepathy-mission-control: account-addressing: fire PropertiesChanged on URISchemes change

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Wed Jan 9 05:04:17 PST 2013


Module: telepathy-mission-control
Branch: master
Commit: 9c038fb370c25a2fb87fd80e71b4591cb81c5fa5
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=9c038fb370c25a2fb87fd80e71b4591cb81c5fa5

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Mon Jan  7 16:18:09 2013 +0100

account-addressing: fire PropertiesChanged on URISchemes change

---

 src/mcd-account-addressing.c        |    9 +++++++++
 tests/twisted/account/addressing.py |   18 +++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/mcd-account-addressing.c b/src/mcd-account-addressing.c
index d5604cb..19d622d 100644
--- a/src/mcd-account-addressing.c
+++ b/src/mcd-account-addressing.c
@@ -60,6 +60,7 @@ addressing_set_uri_scheme_association (TpSvcAccountInterfaceAddressing *iface,
     {
       GPtrArray *new_schemes = g_ptr_array_new ();
       gchar **s;
+      GHashTable *changed;
 
       if (association)
         {
@@ -81,6 +82,14 @@ addressing_set_uri_scheme_association (TpSvcAccountInterfaceAddressing *iface,
       mcd_storage_set_strv (storage, account, SCHEMES,
           (const gchar * const *) new_schemes->pdata, FALSE);
 
+      changed = tp_asv_new (
+          "URISchemes", G_TYPE_STRV, new_schemes->pdata,
+          NULL);
+
+      tp_svc_dbus_properties_emit_properties_changed (self,
+          TP_IFACE_ACCOUNT_INTERFACE_ADDRESSING, changed, NULL);
+
+      g_hash_table_unref (changed);
       g_ptr_array_unref (new_schemes);
     }
 
diff --git a/tests/twisted/account/addressing.py b/tests/twisted/account/addressing.py
index 7032a81..e303c93 100755
--- a/tests/twisted/account/addressing.py
+++ b/tests/twisted/account/addressing.py
@@ -57,8 +57,24 @@ def test(q, bus, mc):
     uri_schemes = get_schemes (account_props)
     assertEquals (uri_schemes, ['mailto'])
 
-    # remove association to produce empty list 
+    q.expect('dbus-signal', signal='PropertiesChanged',
+        predicate=(lambda e:
+            e.args[0] == cs.ACCOUNT_IFACE_ADDRESSING and
+            set(e.args[1]['URISchemes']) == set(['mailto'])))
+
+    # add a second association
+    address_iface.SetURISchemeAssociation ('telnet', True)
+    uri_schemes = get_schemes (account_props)
+    assertSameSets (['mailto','telnet',], uri_schemes)
+
+    q.expect('dbus-signal', signal='PropertiesChanged',
+        predicate=(lambda e:
+            e.args[0] == cs.ACCOUNT_IFACE_ADDRESSING and
+            set(e.args[1]['URISchemes']) == set(['telnet', 'mailto'])))
+
+    # remove associations to produce empty list
     address_iface.SetURISchemeAssociation ('mailto', False)
+    address_iface.SetURISchemeAssociation ('telnet', False)
     uri_schemes = get_schemes (account_props)
     assertEquals (uri_schemes, [])
 



More information about the telepathy-commits mailing list