[next] telepathy-glib: future-account: add set_icon_name and test it
Jonny Lamb
jonny at kemper.freedesktop.org
Fri May 11 02:41:33 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 43f46c026068c4a150a1b819d71a2a6b38306327
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=43f46c026068c4a150a1b819d71a2a6b38306327
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Thu Apr 26 10:54:52 2012 +0100
future-account: add set_icon_name and test it
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
telepathy-glib/future-account.c | 38 ++++++++++++++++++++++++++++++++++++++
telepathy-glib/future-account.h | 3 +++
tests/dbus/future-account.c | 16 ++++++++++++++++
3 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/telepathy-glib/future-account.c b/telepathy-glib/future-account.c
index c061f32..326131e 100644
--- a/telepathy-glib/future-account.c
+++ b/telepathy-glib/future-account.c
@@ -83,6 +83,7 @@ enum {
PROP_DISPLAY_NAME,
PROP_PARAMETERS,
PROP_PROPERTIES,
+ PROP_ICON_NAME,
N_PROPS
};
@@ -138,6 +139,9 @@ tp_future_account_get_property (GObject *object,
case PROP_PROPERTIES:
g_value_set_boxed (value, self->priv->properties);
break;
+ case PROP_ICON_NAME:
+ g_value_set_string (value, tp_asv_get_string (self->priv->properties, "Icon"));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -295,6 +299,19 @@ tp_future_account_class_init (TpFutureAccountClass *klass)
"Account properties",
G_TYPE_HASH_TABLE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+
+ /**
+ * TpFutureAccount:icon-name:
+ *
+ * The account's icon name. To change this propery, use
+ * tp_future_account_set_icon_name().
+ */
+ g_object_class_install_property (object_class, PROP_ICON_NAME,
+ g_param_spec_string ("icon-name",
+ "Icon",
+ "The account's icon name",
+ NULL,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}
/**
@@ -347,6 +364,27 @@ tp_future_account_set_display_name (TpFutureAccount *self,
}
/**
+ * tp_future_account_set_icon_name:
+ * @self: a #TpFutureAccount
+ * @icon: an icon name for the account
+ *
+ * Set the icon name for the new account @self to @icon.
+ */
+void
+tp_future_account_set_icon_name (TpFutureAccount *self,
+ const gchar *icon)
+{
+ TpFutureAccountPrivate *priv;
+
+ g_return_if_fail (TP_IS_FUTURE_ACCOUNT (self));
+ g_return_if_fail (icon != NULL);
+
+ priv = self->priv;
+
+ tp_asv_set_string (priv->properties, "Icon", icon);
+}
+
+/**
* tp_future_account_set_parameter:
* @self: a #TpFutureAccount
* @key: the parameter key
diff --git a/telepathy-glib/future-account.h b/telepathy-glib/future-account.h
index 8aef7ac..5415f11 100644
--- a/telepathy-glib/future-account.h
+++ b/telepathy-glib/future-account.h
@@ -65,6 +65,9 @@ TpFutureAccount * tp_future_account_new (TpAccountManager *account_manager,
void tp_future_account_set_display_name (TpFutureAccount *self,
const gchar *name);
+void tp_future_account_set_icon_name (TpFutureAccount *self,
+ const gchar *icon);
+
/* parameters */
void tp_future_account_set_parameter (TpFutureAccount *self,
const gchar *key, GVariant *value);
diff --git a/tests/dbus/future-account.c b/tests/dbus/future-account.c
index be33e76..9f0db69 100644
--- a/tests/dbus/future-account.c
+++ b/tests/dbus/future-account.c
@@ -133,6 +133,7 @@ test_properties (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
GHashTable *props;
+ gchar *icon_name;
test->account = tp_future_account_new (test->account_manager,
"gabble", "jabber");
@@ -144,6 +145,21 @@ test_properties (Test *test,
g_assert_cmpuint (g_hash_table_size (props), ==, 0);
g_hash_table_unref (props);
+
+ /* now set an icon and try again */
+ tp_future_account_set_icon_name (test->account, "user32.dll");
+
+ g_object_get (test->account,
+ "properties", &props,
+ "icon-name", &icon_name,
+ NULL);
+
+ g_assert_cmpuint (g_hash_table_size (props), ==, 1);
+ g_assert_cmpstr (tp_asv_get_string (props, "Icon"), ==, "user32.dll");
+ g_assert_cmpstr (icon_name, ==, "user32.dll");
+
+ g_hash_table_unref (props);
+ g_free (icon_name);
}
int
More information about the telepathy-commits
mailing list