From cf819e45d2b0cb5d0f2868a28dea84223692d152 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 8 May 2012 13:12:54 +0100 Subject: [PATCH] Remove non-standard Compat interface --- src/Makefile.am | 3 - src/mcd-account-compat.c | 160 -------------------- src/mcd-account-manager.c | 1 - src/mcd-account-priv.h | 9 -- src/mcd-account.c | 8 +- src/mcd.xml | 1 - tests/twisted/account-manager/account-basics.py | 34 ----- .../account-manager/create-with-properties.py | 7 - .../account-storage/default-keyring-storage.py | 6 - tests/twisted/account-storage/diverted-storage.py | 6 - tests/twisted/constants.py | 1 - tests/twisted/mctest.py | 2 +- xml/Account_Interface_Compat.xml | 65 -------- xml/Makefile.am | 1 - xml/nmc5.xml | 1 - 15 files changed, 4 insertions(+), 301 deletions(-) delete mode 100644 src/mcd-account-compat.c delete mode 100644 xml/Account_Interface_Compat.xml diff --git a/src/Makefile.am b/src/Makefile.am index 6038e25..62aeb51 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,7 +59,6 @@ mc_gen_headers = \ _gen/gtypes.h \ _gen/interfaces.h \ _gen/svc-Account_Interface_Addressing.h \ - _gen/svc-Account_Interface_Compat.h \ _gen/svc-Account_Interface_Conditions.h \ _gen/svc-Account_Interface_External_Password_Storage.h \ _gen/svc-Account_Interface_Hidden.h \ @@ -76,7 +75,6 @@ nodist_libmcd_convenience_la_SOURCES = \ _gen/signals-marshal.h \ _gen/signals-marshal.list \ _gen/svc-Account_Interface_Addressing.c \ - _gen/svc-Account_Interface_Compat.c \ _gen/svc-Account_Interface_Conditions.c \ _gen/svc-Account_Interface_External_Password_Storage.c \ _gen/svc-Account_Interface_Hidden.c \ @@ -156,7 +154,6 @@ endif # ! ENABLE_MCD_PLUGINS libmcd_convenience_la_SOURCES = \ mcd-account.c \ mcd-account-addressing.h \ - mcd-account-compat.c \ mcd-account-conditions.c \ mcd-account-config.h \ mcd-account-connection.c \ diff --git a/src/mcd-account-compat.c b/src/mcd-account-compat.c deleted file mode 100644 index 497fbe9..0000000 --- a/src/mcd-account-compat.c +++ /dev/null @@ -1,160 +0,0 @@ -/* vi: set et sw=4 ts=8 cino=t0,(0: */ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */ -/* - * This file is part of mission-control - * - * Copyright (C) 2008-2009 Nokia Corporation. - * Copyright (C) 2009 Collabora Ltd. - * - * Contact: Alberto Mardegan - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ -#include "config.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "mcd-account.h" -#include "mcd-account-priv.h" -#include "mcd-account-manager.h" -#include "mcd-misc.h" -#include "mcd-service.h" - -#define COMPAT_REQ_DATA "compat_req" - -typedef struct -{ - guint requestor_serial; - gchar *requestor_client_id; -} McdAccountCompatReq; - -static void -emit_compat_property_changed (McdAccount *account, const gchar *key, - const GValue *value) -{ - GHashTable *properties; - - properties = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (properties, (gpointer)key, (gpointer)value); - - mc_svc_account_interface_compat_emit_compat_property_changed (account, - properties); - g_hash_table_unref (properties); -} - -static void -get_avatar_file (TpSvcDBusProperties *self, const gchar *name, GValue *value) -{ - McdAccount *account = MCD_ACCOUNT (self); - gchar *string; - - string = _mcd_account_get_avatar_filename (account); - g_value_init (value, G_TYPE_STRING); - g_value_take_string (value, string); -} - -static gboolean -set_secondary_vcard_fields (TpSvcDBusProperties *self, const gchar *name, - const GValue *value, GError **error) -{ - McdAccount *account = MCD_ACCOUNT (self); - McdStorage *storage = _mcd_account_get_storage (account); - const gchar *account_name = mcd_account_get_unique_name (account); - GStrv fields; - const GValue *set = NULL; - - /* FIXME: some sort of validation beyond just the type? */ - - if (!G_VALUE_HOLDS (value, G_TYPE_STRV)) - { - g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "Expected string-array for SecondaryVCardFields, but " - "got %s", G_VALUE_TYPE_NAME (value)); - return FALSE; - } - - fields = g_value_get_boxed (value); - - if (fields != NULL) - set = value; - - mcd_storage_set_value (storage, account_name, name, set, FALSE); - mcd_storage_commit (storage, account_name); - - emit_compat_property_changed (account, name, value); - - return TRUE; -} - -static void -get_secondary_vcard_fields (TpSvcDBusProperties *self, const gchar *name, - GValue *value) -{ - McdAccount *account = MCD_ACCOUNT (self); - McdStorage *storage = _mcd_account_get_storage (account); - const gchar *account_name = mcd_account_get_unique_name (account); - GValue *fetched; - - g_value_init (value, G_TYPE_STRV); - fetched = - mcd_storage_dup_value (storage, account_name, name, G_TYPE_STRV, NULL); - - if (fetched != NULL) - { - GStrv fields = g_value_get_boxed (fetched); - - g_value_take_boxed (value, fields); - g_slice_free (GValue, fetched); - fetched = NULL; - } - else - { - g_value_take_boxed (value, NULL); - } -} - - -const McdDBusProp account_compat_properties[] = { - { "AvatarFile", NULL, get_avatar_file }, - { "SecondaryVCardFields", set_secondary_vcard_fields, get_secondary_vcard_fields }, - { 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) -{ -#define IMPLEMENT(x) mc_svc_account_interface_compat_implement_##x (\ - iface, compat_##x) - IMPLEMENT (set_has_been_online); -#undef IMPLEMENT -} diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c index 5ead904..1533d6f 100644 --- a/src/mcd-account-manager.c +++ b/src/mcd-account-manager.c @@ -1030,7 +1030,6 @@ get_supported_account_properties (TpSvcDBusProperties *svc, TP_IFACE_ACCOUNT ".RequestedPresence", TP_IFACE_ACCOUNT ".Supersedes", TP_IFACE_ACCOUNT_INTERFACE_AVATAR ".Avatar", - MC_IFACE_ACCOUNT_INTERFACE_COMPAT ".SecondaryVCardFields", MC_IFACE_ACCOUNT_INTERFACE_CONDITIONS ".Condition", NULL }; diff --git a/src/mcd-account-priv.h b/src/mcd-account-priv.h index 719ae6d..d856eed 100644 --- a/src/mcd-account-priv.h +++ b/src/mcd-account-priv.h @@ -37,7 +37,6 @@ /* auto-generated stubs */ #include "_gen/svc-Account_Interface_Addressing.h" -#include "_gen/svc-Account_Interface_Compat.h" #include "_gen/svc-Account_Interface_Conditions.h" #include "_gen/svc-Account_Interface_External_Password_Storage.h" #include "_gen/svc-Account_Interface_Hidden.h" @@ -85,7 +84,6 @@ G_GNUC_INTERNAL gchar *_mcd_account_get_avatar_token (McdAccount *account); G_GNUC_INTERNAL void _mcd_account_set_alias (McdAccount *account, const gchar *alias); -G_GNUC_INTERNAL gchar *_mcd_account_get_avatar_filename (McdAccount *account); G_GNUC_INTERNAL GPtrArray *_mcd_account_get_supersedes (McdAccount *self); G_GNUC_INTERNAL void _mcd_account_tp_connection_changed (McdAccount *account, @@ -121,13 +119,6 @@ _mcd_account_write_conf (McdAccount *account) mcd_storage_commit (storage, mcd_account_get_unique_name (account)); } -G_GNUC_INTERNAL void _mcd_account_compat_class_init (McdAccountClass *klass); - -extern const McdDBusProp account_compat_properties[]; - -void account_compat_iface_init (McSvcAccountInterfaceCompatClass *iface, - gpointer iface_data); - G_GNUC_INTERNAL void _mcd_account_connection_begin (McdAccount *account, gboolean user_initiated); G_GNUC_INTERNAL void _mcd_account_connection_class_init (McdAccountClass *klass); diff --git a/src/mcd-account.c b/src/mcd-account.c index 6521e17..9e9574e 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -87,9 +87,6 @@ static const McdInterfaceData account_interfaces[] = { MCD_IMPLEMENT_IFACE (tp_svc_account_interface_avatar_get_type, account_avatar, TP_IFACE_ACCOUNT_INTERFACE_AVATAR), - MCD_IMPLEMENT_IFACE (mc_svc_account_interface_compat_get_type, - account_compat, - MC_IFACE_ACCOUNT_INTERFACE_COMPAT), MCD_IMPLEMENT_IFACE (mc_svc_account_interface_conditions_get_type, account_conditions, MC_IFACE_ACCOUNT_INTERFACE_CONDITIONS), @@ -3704,6 +3701,8 @@ _mcd_account_set_avatar (McdAccount *account, const GArray *avatar, return TRUE; } +static gchar *_mcd_account_get_avatar_filename (McdAccount *account); + void _mcd_account_get_avatar (McdAccount *account, GArray **avatar, gchar **mime_type) @@ -4206,8 +4205,7 @@ _mcd_account_get_keyfile (McdAccount *account) return priv->keyfile; } -/* this is public because of mcd-account-compat */ -gchar * +static gchar * _mcd_account_get_avatar_filename (McdAccount *account) { McdAccountPrivate *priv = account->priv; diff --git a/src/mcd.xml b/src/mcd.xml index eb791c1..244f750 100644 --- a/src/mcd.xml +++ b/src/mcd.xml @@ -7,7 +7,6 @@ - diff --git a/tests/twisted/account-manager/account-basics.py b/tests/twisted/account-manager/account-basics.py index aceb7ae..b2ccc46 100644 --- a/tests/twisted/account-manager/account-basics.py +++ b/tests/twisted/account-manager/account-basics.py @@ -86,7 +86,6 @@ def test(q, bus, mc): interfaces = properties.get('Interfaces') assert cs.ACCOUNT_IFACE_AVATAR in interfaces, interfaces - assert cs.ACCOUNT_IFACE_NOKIA_COMPAT in interfaces, interfaces assert cs.ACCOUNT_IFACE_NOKIA_CONDITIONS in interfaces, interfaces # sanity check @@ -130,28 +129,6 @@ 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 - - call_async(q, account_props, 'Set', cs.ACCOUNT_IFACE_NOKIA_COMPAT, - 'SecondaryVCardFields', - ['x-badger', 'x-mushroom']) - # there's no change notification for the Compat properties - q.expect_many( - EventPattern('dbus-return', method='Set'), - ) - assert account_props.Get(cs.ACCOUNT_IFACE_NOKIA_COMPAT, - 'SecondaryVCardFields') == ['x-badger', 'x-mushroom'] - call_async(q, account_props, 'Set', cs.ACCOUNT_IFACE_NOKIA_CONDITIONS, 'Condition', dbus.Dictionary({':foo': 'bar'}, signature='ss')) @@ -206,15 +183,6 @@ def test(q, bus, mc): else: raise AssertionError('Setting %s with wrong type should fail' % p) - for p in ('SecondaryVCardFields'): - try: - account_props.Set(cs.ACCOUNT_IFACE_NOKIA_COMPAT, p, badly_typed) - except dbus.DBusException, e: - assert e.get_dbus_name() == cs.INVALID_ARGUMENT, \ - (p, e.get_dbus_name()) - else: - raise AssertionError('Setting %s with wrong type should fail' % p) - for p in ('Condition',): try: account_props.Set(cs.ACCOUNT_IFACE_NOKIA_CONDITIONS, p, @@ -233,8 +201,6 @@ def test(q, bus, mc): assert properties['Icon'] == 'im-jabber' properties = account_props.GetAll(cs.ACCOUNT_IFACE_AVATAR) assert properties['Avatar'] == ([], '') - properties = account_props.GetAll(cs.ACCOUNT_IFACE_NOKIA_COMPAT) - assert properties['SecondaryVCardFields'] == ['x-badger', 'x-mushroom'] # Delete the account assert account_iface.Remove() is None diff --git a/tests/twisted/account-manager/create-with-properties.py b/tests/twisted/account-manager/create-with-properties.py index ca3b50d..6b1b352 100644 --- a/tests/twisted/account-manager/create-with-properties.py +++ b/tests/twisted/account-manager/create-with-properties.py @@ -48,7 +48,6 @@ def test(q, bus, mc): 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 + '.SecondaryVCardFields') in supported assert (cs.ACCOUNT_IFACE_NOKIA_CONDITIONS + '.Condition') in supported assert (cs.ACCOUNT + '.RequestedPresence') in supported @@ -73,8 +72,6 @@ def test(q, bus, mc): cs.ACCOUNT + '.ConnectAutomatically': True, cs.ACCOUNT_IFACE_AVATAR + '.Avatar': (dbus.ByteArray('foo'), 'image/jpeg'), - 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'), cs.ACCOUNT + '.Supersedes': dbus.Array([ @@ -138,10 +135,6 @@ def test(q, bus, mc): assert properties.get('Avatar') == ([ord('f'), ord('o'), ord('o')], 'image/jpeg') - properties = account_props.GetAll(cs.ACCOUNT_IFACE_NOKIA_COMPAT) - 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', diff --git a/tests/twisted/account-storage/default-keyring-storage.py b/tests/twisted/account-storage/default-keyring-storage.py index a28bc7d..284fb77 100644 --- a/tests/twisted/account-storage/default-keyring-storage.py +++ b/tests/twisted/account-storage/default-keyring-storage.py @@ -140,16 +140,12 @@ def test(q, bus, mc): account_iface = dbus.Interface(account, cs.ACCOUNT) account_props = dbus.Interface(account, cs.PROPERTIES_IFACE) - nokia_compat = dbus.Interface(account, cs.ACCOUNT_IFACE_NOKIA_COMPAT) # Alter some miscellaneous r/w properties account_props.Set(cs.ACCOUNT, 'DisplayName', 'Work account') account_props.Set(cs.ACCOUNT, 'Icon', 'im-jabber') account_props.Set(cs.ACCOUNT, 'Nickname', 'Joe Bloggs') - nokia_compat.SetHasBeenOnline() - account_props.Set(cs.ACCOUNT_IFACE_NOKIA_COMPAT, - 'SecondaryVCardFields', ['x-badger', 'x-mushroom']) tell_mc_to_die(q, bus) @@ -162,8 +158,6 @@ def test(q, bus, mc): assert kf[group]['DisplayName'] == 'Work account', kf assert kf[group]['Icon'] == 'im-jabber', kf assert kf[group]['Nickname'] == 'Joe Bloggs', kf - assert kf[group]['HasBeenOnline'] == 'true', kf - assert kf[group]['SecondaryVCardFields'] == 'x-badger;x-mushroom;', kf # This works wherever the password is stored pwd = account_store('get', 'default', 'param-password') diff --git a/tests/twisted/account-storage/diverted-storage.py b/tests/twisted/account-storage/diverted-storage.py index 3720880..d645656 100644 --- a/tests/twisted/account-storage/diverted-storage.py +++ b/tests/twisted/account-storage/diverted-storage.py @@ -61,13 +61,9 @@ def test(q, bus, mc): account_iface = dbus.Interface(account, cs.ACCOUNT) account_props = dbus.Interface(account, cs.PROPERTIES_IFACE) - nokia_compat = dbus.Interface(account, cs.ACCOUNT_IFACE_NOKIA_COMPAT) # Alter some miscellaneous r/w properties - nokia_compat.SetHasBeenOnline() - account_props.Set(cs.ACCOUNT_IFACE_NOKIA_COMPAT, - 'SecondaryVCardFields', ['x-badger', 'x-mushroom']) account_props.Set(cs.ACCOUNT, 'Icon', 'im-jabber') account_props.Set(cs.ACCOUNT, 'DisplayName', 'Work account') account_props.Set(cs.ACCOUNT, 'Nickname', 'Joe Bloggs') @@ -84,8 +80,6 @@ def test(q, bus, mc): assert kf[group]['DisplayName'] == 'Work account', kf assert kf[group]['Icon'] == 'im-jabber', kf assert kf[group]['Nickname'] == 'Joe Bloggs', kf - assert kf[group]['HasBeenOnline'] == 'true', kf - assert kf[group]['SecondaryVCardFields'] == 'x-badger;x-mushroom;', kf # default keyfile should be empty ekf = keyfile_read(empty_key_file_name) diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py index 11587ad..e23e2bf 100644 --- a/tests/twisted/constants.py +++ b/tests/twisted/constants.py @@ -171,7 +171,6 @@ ACCOUNT = tp_name_prefix + '.Account' ACCOUNT_IFACE_AVATAR = ACCOUNT + '.Interface.Avatar' ACCOUNT_IFACE_ADDRESSING = ACCOUNT + '.Interface.Addressing' ACCOUNT_IFACE_HIDDEN = ACCOUNT + '.Interface.Hidden.DRAFT1' -ACCOUNT_IFACE_NOKIA_COMPAT = 'com.nokia.Account.Interface.Compat' ACCOUNT_IFACE_NOKIA_CONDITIONS = 'com.nokia.Account.Interface.Conditions' ACCOUNT_PATH_PREFIX = tp_path_prefix + '/Account/' diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py index cd1a853..88f0a14 100644 --- a/tests/twisted/mctest.py +++ b/tests/twisted/mctest.py @@ -1078,7 +1078,7 @@ class Account(servicetest.ProxyWrapper): def __init__(self, bus, account_path): servicetest.ProxyWrapper.__init__(self, bus.get_object(cs.AM, account_path), - cs.ACCOUNT, {'Compat': cs.ACCOUNT_IFACE_NOKIA_COMPAT}) + cs.ACCOUNT, {}) class ChannelDispatcher(servicetest.ProxyWrapper): def __init__(self, bus): diff --git a/xml/Account_Interface_Compat.xml b/xml/Account_Interface_Compat.xml deleted file mode 100644 index a71650c..0000000 --- a/xml/Account_Interface_Compat.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - Copyright (C) 2008 Nokia Corporation - -

This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version.

- -

This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details.

- -

You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

-
- - - -

The Compat interface holds properties necessary for maintaining the - libmissioncontrol compatible layer.

-
- - - -

The location of the avatar.

-
-
- - - -

List of secondary VCard fields.

-
-
- - - -

Force MC to believe that this account has been put online - successfully at some point in the past.

-
-
- - - - The values of one or more properties on this interface may have - changed. - - - - - A map from property names in this namespace (e.g. - SecondaryVCardFields) to - values. Properties whose values have not changed SHOULD be - omitted, but this need not be done. - - - - -
-
- diff --git a/xml/Makefile.am b/xml/Makefile.am index 9bd3177..a87966e 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -8,7 +8,6 @@ SPECS = \ Account_Manager_Interface_Hidden.xml \ Account_Manager_Interface_Query.xml \ Account_Interface_Addressing.xml \ - Account_Interface_Compat.xml \ Account_Interface_Conditions.xml \ Account_Interface_External_Password_Storage.xml \ Account_Interface_Hidden.xml \ diff --git a/xml/nmc5.xml b/xml/nmc5.xml index 212559f..9ecbcd0 100644 --- a/xml/nmc5.xml +++ b/xml/nmc5.xml @@ -5,7 +5,6 @@ Copyright (C) 2008 Nokia Corporation - -- 1.7.10