summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2012-04-26 10:38:00 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2012-05-03 14:42:35 +0100
commit2cbb7ad58e270682a476e12012098ae6b97fb0e9 (patch)
tree595c89dfdd1f568dd1302e488bd99f5f1f05b747
parent4b26fe68ba9be14d887d4f0a728cf3d71fc85c7d (diff)
future-account: add :properties GObject property
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--telepathy-glib/future-account.c20
-rw-r--r--tests/dbus/future-account.c26
2 files changed, 43 insertions, 3 deletions
diff --git a/telepathy-glib/future-account.c b/telepathy-glib/future-account.c
index 3e3ce7020..c061f3233 100644
--- a/telepathy-glib/future-account.c
+++ b/telepathy-glib/future-account.c
@@ -63,6 +63,7 @@ struct _TpFutureAccountPrivate {
gchar *display_name;
GHashTable *parameters;
+ GHashTable *properties;
};
G_DEFINE_TYPE (TpFutureAccount, tp_future_account, G_TYPE_OBJECT)
@@ -81,6 +82,7 @@ enum {
PROP_PROTOCOL,
PROP_DISPLAY_NAME,
PROP_PARAMETERS,
+ PROP_PROPERTIES,
N_PROPS
};
@@ -102,6 +104,8 @@ tp_future_account_constructed (GObject *object)
priv->parameters = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) tp_g_value_slice_free);
+ priv->properties = tp_asv_new (NULL, NULL);
+
if (chain_up != NULL)
chain_up (object);
}
@@ -131,6 +135,9 @@ tp_future_account_get_property (GObject *object,
case PROP_PARAMETERS:
g_value_set_boxed (value, self->priv->parameters);
break;
+ case PROP_PROPERTIES:
+ g_value_set_boxed (value, self->priv->properties);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -178,6 +185,7 @@ tp_future_account_dispose (GObject *object)
priv->dispose_has_run = TRUE;
tp_clear_pointer (&priv->parameters, g_hash_table_unref);
+ tp_clear_pointer (&priv->properties, g_hash_table_unref);
/* release any references held by the object here */
@@ -275,6 +283,18 @@ tp_future_account_class_init (TpFutureAccountClass *klass)
"Connection parameters of the account",
G_TYPE_HASH_TABLE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+
+ /**
+ * TpFutureAccount:properties:
+ *
+ * TODO
+ */
+ g_object_class_install_property (object_class, PROP_PROPERTIES,
+ g_param_spec_boxed ("properties",
+ "Properties",
+ "Account properties",
+ G_TYPE_HASH_TABLE,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}
/**
diff --git a/tests/dbus/future-account.c b/tests/dbus/future-account.c
index 291fac0d5..be33e76e7 100644
--- a/tests/dbus/future-account.c
+++ b/tests/dbus/future-account.c
@@ -64,7 +64,7 @@ test_new (Test *test,
}
static void
-test_properties (Test *test,
+test_gobject_properties (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
TpAccountManager *am;
@@ -128,6 +128,24 @@ test_parameters (Test *test,
g_hash_table_unref (params);
}
+static void
+test_properties (Test *test,
+ gconstpointer data G_GNUC_UNUSED)
+{
+ GHashTable *props;
+
+ test->account = tp_future_account_new (test->account_manager,
+ "gabble", "jabber");
+
+ g_object_get (test->account,
+ "properties", &props,
+ NULL);
+
+ g_assert_cmpuint (g_hash_table_size (props), ==, 0);
+
+ g_hash_table_unref (props);
+}
+
int
main (int argc,
char **argv)
@@ -140,10 +158,12 @@ main (int argc,
g_test_bug_base ("http://bugs.freedesktop.org/show_bug.cgi?id=");
g_test_add ("/future-account/new", Test, NULL, setup, test_new, teardown);
- g_test_add ("/future-account/properties", Test, NULL, setup,
- test_properties, teardown);
+ g_test_add ("/future-account/gobject-properties", Test, NULL, setup,
+ test_gobject_properties, teardown);
g_test_add ("/future-account/parameters", Test, NULL, setup,
test_parameters, teardown);
+ g_test_add ("/future-account/properties", Test, NULL, setup,
+ test_properties, teardown);
return g_test_run ();
}