summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2012-04-26 10:54:52 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2012-05-03 14:42:35 +0100
commit43f46c026068c4a150a1b819d71a2a6b38306327 (patch)
treee073707dcfd58d5941626c1d1e17353541e6642e
parent2cbb7ad58e270682a476e12012098ae6b97fb0e9 (diff)
future-account: add set_icon_name and test it
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--telepathy-glib/future-account.c38
-rw-r--r--telepathy-glib/future-account.h3
-rw-r--r--tests/dbus/future-account.c16
3 files changed, 57 insertions, 0 deletions
diff --git a/telepathy-glib/future-account.c b/telepathy-glib/future-account.c
index c061f3233..326131ef6 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 8aef7ac25..5415f1196 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 be33e76e7..9f0db691f 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