summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-01 20:22:56 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-02-09 13:05:33 +0000
commitf745ccc6d2fb1fcd3f8bb0c74a1f1d649f1a0870 (patch)
tree1ef9698dd1197bc5f5859776c2fe6fdc9f4af6ac
parentd60343f25c2fa949e8c0108e89b915c228e23654 (diff)
downloadtelepathy-glib-f745ccc6d2fb1fcd3f8bb0c74a1f1d649f1a0870.tar.gz
TpTestsSimpleAccount: add Avatar interface
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45554 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--tests/lib/simple-account.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/lib/simple-account.c b/tests/lib/simple-account.c
index ce08468fb..adc395cc8 100644
--- a/tests/lib/simple-account.c
+++ b/tests/lib/simple-account.c
@@ -26,6 +26,8 @@ G_DEFINE_TYPE_WITH_CODE (TpTestsSimpleAccount,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_ACCOUNT,
account_iface_init);
+ G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_ACCOUNT_INTERFACE_AVATAR,
+ NULL);
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_ACCOUNT_INTERFACE_ADDRESSING,
NULL);
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_ACCOUNT_INTERFACE_STORAGE,
@@ -63,7 +65,8 @@ enum
PROP_STORAGE_PROVIDER,
PROP_STORAGE_IDENTIFIER,
PROP_STORAGE_SPECIFIC_INFORMATION,
- PROP_STORAGE_RESTRICTIONS
+ PROP_STORAGE_RESTRICTIONS,
+ PROP_AVATAR
};
struct _TpTestsSimpleAccountPrivate
@@ -185,6 +188,21 @@ tp_tests_simple_account_get_property (GObject *object,
case PROP_URI_SCHEMES:
g_value_set_boxed (value, uri_schemes);
break;
+ case PROP_AVATAR:
+ {
+ GArray *arr = g_array_new (FALSE, FALSE, sizeof (char));
+
+ /* includes NUL for simplicity */
+ g_array_append_vals (arr, ":-)", 4);
+
+ g_value_take_boxed (value,
+ tp_value_array_build (2,
+ TP_TYPE_UCHAR_ARRAY, arr,
+ G_TYPE_STRING, "text/plain",
+ G_TYPE_INVALID));
+ g_array_unref (arr);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, spec);
break;
@@ -237,6 +255,11 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass)
{ NULL },
};
+ static TpDBusPropertiesMixinPropImpl avatar_props[] = {
+ { "Avatar", "avatar", NULL },
+ { NULL },
+ };
+
static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
{ TP_IFACE_ACCOUNT,
tp_dbus_properties_mixin_getter_gobject_properties,
@@ -255,6 +278,11 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass)
NULL,
aia_props
},
+ { TP_IFACE_ACCOUNT_INTERFACE_AVATAR,
+ tp_dbus_properties_mixin_getter_gobject_properties,
+ NULL,
+ avatar_props
+ },
{ NULL },
};
@@ -399,6 +427,13 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_URI_SCHEMES, param_spec);
+ param_spec = g_param_spec_boxed ("avatar",
+ "Avatar", "Avatar",
+ TP_STRUCT_TYPE_AVATAR,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class,
+ PROP_AVATAR, param_spec);
+
klass->dbus_props_class.interfaces = prop_interfaces;
tp_dbus_properties_mixin_class_init (object_class,
G_STRUCT_OFFSET (TpTestsSimpleAccountClass, dbus_props_class));