[telepathy-mission-control/master] McdAccount Compat: add SetHasBeenOnline

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Apr 9 07:10:01 PDT 2009


---
 src/mcd-account-compat.c         |   13 ++++++++++++-
 test/twisted/test-account.py     |   13 +++++++++++++
 xml/Account_Interface_Compat.xml |    7 +++++++
 3 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/mcd-account-compat.c b/src/mcd-account-compat.c
index bd4e8fc..f52d808 100644
--- a/src/mcd-account-compat.c
+++ b/src/mcd-account-compat.c
@@ -153,11 +153,22 @@ const McdDBusProp account_compat_properties[] = {
     { 0 },
 };
 
+static void
+compat_set_has_been_online (McSvcAccountInterfaceCompat *iface,
+                            DBusGMethodInvocation *context)
+{
+    _mcd_account_set_has_been_online (MCD_ACCOUNT (iface));
+    mc_svc_account_interface_compat_return_from_set_has_been_online (context);
+}
+
 void
 account_compat_iface_init (McSvcAccountInterfaceCompatClass *iface,
                            gpointer iface_data)
 {
-    /* nothing to do */
+#define IMPLEMENT(x) mc_svc_account_interface_compat_implement_##x (\
+    iface, compat_##x)
+    IMPLEMENT (set_has_been_online);
+#undef IMPLEMENT
 }
 
 /**
diff --git a/test/twisted/test-account.py b/test/twisted/test-account.py
index 0108eaa..5a06ef7 100644
--- a/test/twisted/test-account.py
+++ b/test/twisted/test-account.py
@@ -101,6 +101,7 @@ def test(q, bus, mc):
         )
     assert account_props.Get(cs.ACCOUNT, 'Icon') == 'im-jabber'
 
+    assert account_props.Get(cs.ACCOUNT, 'HasBeenOnline') == False
     call_async(q, account_props, 'Set', cs.ACCOUNT, 'Nickname', 'Joe Bloggs')
     q.expect_many(
         EventPattern('dbus-signal',
@@ -112,6 +113,18 @@ def test(q, bus, mc):
         )
     assert account_props.Get(cs.ACCOUNT, 'Nickname') == 'Joe Bloggs'
 
+    call_async(q, dbus.Interface(account, cs.ACCOUNT_IFACE_NOKIA_COMPAT),
+            'SetHasBeenOnline')
+    q.expect_many(
+        EventPattern('dbus-signal',
+            path=account_path,
+            signal='AccountPropertyChanged',
+            interface=cs.ACCOUNT,
+            args=[{'HasBeenOnline': True}]),
+        EventPattern('dbus-return', method='SetHasBeenOnline'),
+        )
+    assert account_props.Get(cs.ACCOUNT, 'HasBeenOnline') == True
+
     # Delete the account
     assert account_iface.Remove() is None
     account_event, account_manager_event = q.expect_many(
diff --git a/xml/Account_Interface_Compat.xml b/xml/Account_Interface_Compat.xml
index af68a5b..1c5a51b 100644
--- a/xml/Account_Interface_Compat.xml
+++ b/xml/Account_Interface_Compat.xml
@@ -41,6 +41,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</
       </tp:docstring>
     </property>
 
+    <method name="SetHasBeenOnline">
+      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+        <p>Force MC to believe that this account has been put online
+          successfully at some point in the past.</p>
+      </tp:docstring>
+    </method>
+
   </interface>
 </node>
 <!-- vim:set sw=2 sts=2 et ft=xml: -->
-- 
1.5.6.5




More information about the telepathy-commits mailing list