[telepathy-mission-control/master] MCD: stop implementing the Creation draft

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Sep 16 09:09:51 PDT 2009


Its functionality is now present in the standard AccountManager interface.
---
 src/mcd-account-manager.c                          |   62 ---------
 test/twisted/Makefile.am                           |    1 -
 .../account-manager/create-with-properties.py      |    1 -
 .../account-manager/old-create-with-properties.py  |  131 --------------------
 test/twisted/test-account.py                       |    1 -
 5 files changed, 0 insertions(+), 196 deletions(-)
 delete mode 100644 test/twisted/account-manager/old-create-with-properties.py

diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index 62d9cc4..c156861 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -50,7 +50,6 @@
 #include "mcd-misc.h"
 
 #include "_gen/interfaces.h"
-#include "_gen/svc-Account_Manager_Interface_Creation.h"
 
 #define WRITE_CONF_DELAY    500
 #define INITIAL_CONFIG_FILE_CONTENTS "# Telepathy accounts\n"
@@ -60,13 +59,10 @@
 
 static void account_manager_iface_init (TpSvcAccountManagerClass *iface,
 					gpointer iface_data);
-static void account_manager_creation_iface_init (
-    McSvcAccountManagerInterfaceCreationClass *iface, gpointer iface_data);
 static void properties_iface_init (TpSvcDBusPropertiesClass *iface,
 				   gpointer iface_data);
 
 static const McdDBusProp account_manager_properties[];
-static const McdDBusProp account_manager_creation_properties[];
 
 static const McdInterfaceData account_manager_interfaces[] = {
     MCD_IMPLEMENT_IFACE (tp_svc_account_manager_get_type,
@@ -75,9 +71,6 @@ static const McdInterfaceData account_manager_interfaces[] = {
     MCD_IMPLEMENT_IFACE (mc_svc_account_manager_interface_query_get_type,
 			 account_manager_query,
 			 MC_IFACE_ACCOUNT_MANAGER_INTERFACE_QUERY),
-    MCD_IMPLEMENT_IFACE (mc_svc_account_manager_interface_creation_get_type,
-			 account_manager_creation,
-			 MC_IFACE_ACCOUNT_MANAGER_INTERFACE_CREATION),
     { G_TYPE_INVALID, }
 };
 
@@ -379,28 +372,6 @@ set_new_account_properties (McdAccount *account,
 }
 
 static void
-create_account_with_properties_cb (McdAccountManager *account_manager,
-                                   McdAccount *account,
-                                   const GError *error,
-                                   gpointer user_data)
-{
-    DBusGMethodInvocation *context = user_data;
-    const gchar *object_path;
-
-    if (G_UNLIKELY (error))
-    {
-	dbus_g_method_return_error (context, (GError *)error);
-	return;
-    }
-
-    g_return_if_fail (MCD_IS_ACCOUNT (account));
-
-    object_path = mcd_account_get_object_path (account);
-    mc_svc_account_manager_interface_creation_return_from_create_account
-        (context, object_path);
-}
-
-static void
 complete_account_creation (McdAccount *account,
                            const GError *cb_error,
                            gpointer user_data)
@@ -614,35 +585,6 @@ account_manager_iface_init (TpSvcAccountManagerClass *iface,
 }
 
 static void
-account_manager_create_account_with_properties (
-    McSvcAccountManagerInterfaceCreation *self,
-    const gchar *manager,
-    const gchar *protocol,
-    const gchar *display_name,
-    GHashTable *parameters,
-    GHashTable *properties,
-    DBusGMethodInvocation *context)
-{
-    _mcd_account_manager_create_account (MCD_ACCOUNT_MANAGER (self),
-                                         manager, protocol, display_name,
-                                         parameters, properties,
-                                         create_account_with_properties_cb,
-                                         context,
-                                         NULL);
-}
-
-static void
-account_manager_creation_iface_init (McSvcAccountManagerInterfaceCreationClass *iface,
-				  gpointer iface_data)
-{
-#define IMPLEMENT(x, suffix) \
-    mc_svc_account_manager_interface_creation_implement_##x (\
-    iface, account_manager_##x##suffix)
-    IMPLEMENT(create_account, _with_properties);
-#undef IMPLEMENT
-}
-
-static void
 accounts_to_gvalue (GHashTable *accounts, gboolean valid, GValue *value)
 {
     static GType ao_type = G_TYPE_INVALID;
@@ -724,10 +666,6 @@ static const McdDBusProp account_manager_properties[] = {
     { 0 },
 };
 
-static const McdDBusProp account_manager_creation_properties[] = {
-    { 0 },
-};
-
 static void
 properties_iface_init (TpSvcDBusPropertiesClass *iface, gpointer iface_data)
 {
diff --git a/test/twisted/Makefile.am b/test/twisted/Makefile.am
index 54f56fb..1e8f701 100644
--- a/test/twisted/Makefile.am
+++ b/test/twisted/Makefile.am
@@ -6,7 +6,6 @@ TWISTED_BASIC_TESTS = \
 	account-manager/avatar.py \
 	account-manager/create-with-properties.py \
 	account-manager/nickname.py \
-	account-manager/old-create-with-properties.py \
 	account-manager/presence.py \
 	account-manager/reconnect.py \
 	account-manager/recover-from-disconnect.py \
diff --git a/test/twisted/account-manager/create-with-properties.py b/test/twisted/account-manager/create-with-properties.py
index 16035be..5f44452 100644
--- a/test/twisted/account-manager/create-with-properties.py
+++ b/test/twisted/account-manager/create-with-properties.py
@@ -28,7 +28,6 @@ def test(q, bus, mc):
     supported = properties.get('SupportedAccountProperties')
 
     # assert that current functionality exists
-    assert cs.AM_IFACE_CREATION_DRAFT in interfaces, interfaces
     assert cs.AM_IFACE_NOKIA_QUERY in interfaces, interfaces
 
     assert (cs.ACCOUNT + '.AutomaticPresence') in supported
diff --git a/test/twisted/account-manager/old-create-with-properties.py b/test/twisted/account-manager/old-create-with-properties.py
deleted file mode 100644
index 19763a0..0000000
--- a/test/twisted/account-manager/old-create-with-properties.py
+++ /dev/null
@@ -1,131 +0,0 @@
-import dbus
-import dbus.service
-
-from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
-        call_async
-from mctest import exec_test, create_fakecm_account
-import constants as cs
-
-def test(q, bus, mc):
-    # Get the AccountManager interface
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
-    account_manager_iface = dbus.Interface(account_manager, cs.AM)
-
-    # Introspect AccountManager for debugging purpose
-    account_manager_introspected = account_manager.Introspect(
-            dbus_interface=cs.INTROSPECTABLE_IFACE)
-    #print account_manager_introspected
-
-    # Check AccountManager has D-Bus property interface
-    properties = account_manager.GetAll(cs.AM,
-            dbus_interface=cs.PROPERTIES_IFACE)
-    assert properties is not None
-    assert properties.get('ValidAccounts') == [], \
-        properties.get('ValidAccounts')
-    assert properties.get('InvalidAccounts') == [], \
-        properties.get('InvalidAccounts')
-    interfaces = properties.get('Interfaces')
-    supported = properties.get('SupportedAccountProperties')
-
-    # assert that current functionality exists
-    assert cs.AM_IFACE_CREATION_DRAFT in interfaces, interfaces
-    assert cs.AM_IFACE_NOKIA_QUERY in interfaces, interfaces
-
-    assert (cs.ACCOUNT + '.AutomaticPresence') in supported
-    assert (cs.ACCOUNT + '.Enabled') in supported
-    assert (cs.ACCOUNT + '.Icon') in supported
-    assert (cs.ACCOUNT + '.Nickname') in supported
-    assert (cs.ACCOUNT + '.ConnectAutomatically') in supported
-    assert (cs.ACCOUNT_IFACE_AVATAR + '.Avatar') in supported
-    assert (cs.ACCOUNT_IFACE_NOKIA_COMPAT + '.Profile') in supported
-    assert (cs.ACCOUNT_IFACE_NOKIA_COMPAT + '.SecondaryVCardFields') in supported
-    assert (cs.ACCOUNT_IFACE_NOKIA_CONDITIONS + '.Condition') in supported
-
-    # FIXME: setting RequestedPresence at create time doesn't work yet
-    #assert (cs.ACCOUNT + '.RequestedPresence') in supported
-
-    params = dbus.Dictionary({"account": "anarki at example.com",
-        "password": "secrecy"}, signature='sv')
-
-    cm_name_ref = dbus.service.BusName(cs.tp_name_prefix +
-            '.ConnectionManager.fakecm', bus=bus)
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
-    creation_iface = dbus.Interface(account_manager,
-            cs.AM_IFACE_CREATION_DRAFT)
-
-    creation_properties = dbus.Dictionary({
-        cs.ACCOUNT + '.Enabled': True,
-        cs.ACCOUNT + '.AutomaticPresence': dbus.Struct((
-            dbus.UInt32(cs.PRESENCE_TYPE_BUSY),
-            'busy', 'Exploding'), signature='uss'),
-        cs.ACCOUNT + '.Icon': 'quake3arena',
-        cs.ACCOUNT + '.Nickname': 'AnArKi',
-        cs.ACCOUNT + '.ConnectAutomatically': True,
-        cs.ACCOUNT_IFACE_AVATAR + '.Avatar': (dbus.ByteArray('foo'),
-            'image/jpeg'),
-        cs.ACCOUNT_IFACE_NOKIA_COMPAT + '.Profile': 'openarena',
-        cs.ACCOUNT_IFACE_NOKIA_COMPAT + '.SecondaryVCardFields':
-            dbus.Array(['x-ioquake3', 'x-quake3'], signature='s'),
-        cs.ACCOUNT_IFACE_NOKIA_CONDITIONS + '.Condition':
-            dbus.Dictionary({ 'has-quad-damage': ':y' }, signature='ss'),
-        }, signature='sv')
-
-    call_async(q, creation_iface, 'CreateAccount',
-            'fakecm',
-            'fakeprotocol',
-            'fakeaccount',
-            params,
-            creation_properties)
-
-    # The spec has no order guarantee here.
-    # FIXME: MC ought to also introspect the CM and find out that the params
-    # are in fact sufficient
-
-    a_signal, am_signal, ret = q.expect_many(
-            EventPattern('dbus-signal',
-                signal='AccountPropertyChanged', interface=cs.ACCOUNT,
-                predicate=(lambda e: 'Valid' in e.args[0])),
-            EventPattern('dbus-signal', path=cs.AM_PATH,
-                signal='AccountValidityChanged', interface=cs.AM),
-            EventPattern('dbus-return', method='CreateAccount'),
-            )
-    account_path = ret.value[0]
-    assert am_signal.args == [account_path, True], am_signal.args
-    assert a_signal.args[0]['Valid'] == True, a_signal.args
-
-    assert account_path is not None
-
-    account = bus.get_object(
-        cs.tp_name_prefix + '.AccountManager',
-        account_path)
-    account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
-
-    properties = account_props.GetAll(cs.ACCOUNT)
-    assert properties.get('AutomaticPresence') == (cs.PRESENCE_TYPE_BUSY,
-            'busy', 'Exploding'), \
-        properties.get('AutomaticPresence')
-    assert properties.get('ConnectAutomatically') == True, \
-        properties.get('ConnectAutomatically')
-    assert properties.get('Enabled') == True, \
-        properties.get('Enabled')
-    assert properties.get('Icon') == 'quake3arena', \
-        properties.get('Icon')
-    assert properties.get('Nickname') == 'AnArKi', \
-        properties.get('Nickname')
-
-    properties = account_props.GetAll(cs.ACCOUNT_IFACE_AVATAR)
-    assert properties.get('Avatar') == ([ord('f'), ord('o'), ord('o')],
-            'image/jpeg')
-
-    properties = account_props.GetAll(cs.ACCOUNT_IFACE_NOKIA_COMPAT)
-    assert properties.get('Profile') == 'openarena'
-    assert sorted(properties.get('SecondaryVCardFields')) == \
-            ['x-ioquake3', 'x-quake3']
-
-    properties = account_props.GetAll(cs.ACCOUNT_IFACE_NOKIA_CONDITIONS)
-    assert properties.get('Condition') == {
-            'has-quad-damage': ':y',
-            }
-
-if __name__ == '__main__':
-    exec_test(test, {})
diff --git a/test/twisted/test-account.py b/test/twisted/test-account.py
index 3b610c5..3c7f4b3 100644
--- a/test/twisted/test-account.py
+++ b/test/twisted/test-account.py
@@ -27,7 +27,6 @@ def test(q, bus, mc):
     interfaces = properties.get('Interfaces')
 
     # assert that current functionality exists
-    assert cs.AM_IFACE_CREATION_DRAFT in interfaces, interfaces
     assert cs.AM_IFACE_NOKIA_QUERY in interfaces, interfaces
 
     params = dbus.Dictionary({"account": "someguy at example.com",
-- 
1.5.6.5




More information about the telepathy-commits mailing list