diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-05-25 18:40:19 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-14 15:21:47 +0800 |
commit | b8e35bdb2c7e11b37947754afdaef3cd05a68c13 (patch) | |
tree | 99d846aa06a264641f26d5a689666bf3d57a864e /libempathy-gtk | |
parent | 8f36eb3772ad0aca0a88e5181b22ec44430d1c64 (diff) | |
download | gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.tar gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.tar.gz gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.tar.bz2 gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.tar.lz gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.tar.xz gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.tar.zst gsoc2013-empathy-b8e35bdb2c7e11b37947754afdaef3cd05a68c13.zip |
roster-item: add 'alias' property
We need to know when the alias is changed to resort the view.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-roster-item.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-roster-item.c b/libempathy-gtk/empathy-roster-item.c index e9464cc32..d3138b780 100644 --- a/libempathy-gtk/empathy-roster-item.c +++ b/libempathy-gtk/empathy-roster-item.c @@ -17,6 +17,7 @@ enum { PROP_INDIVIDIUAL = 1, PROP_ONLINE, + PROP_ALIAS, N_PROPS }; @@ -43,6 +44,13 @@ struct _EmpathyRosterItemPriv gboolean online; }; +static const gchar * +get_alias (EmpathyRosterItem *self) +{ + return folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS ( + self->priv->individual)); +} + static void empathy_roster_item_get_property (GObject *object, guint property_id, @@ -59,6 +67,9 @@ empathy_roster_item_get_property (GObject *object, case PROP_ONLINE: g_value_set_boolean (value, self->priv->online); break; + case PROP_ALIAS: + g_value_set_string (value, get_alias (self)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -135,12 +146,9 @@ avatar_changed_cb (FolksIndividual *individual, static void update_alias (EmpathyRosterItem *self) { - const gchar *alias; + gtk_label_set_text (GTK_LABEL (self->priv->alias), get_alias (self)); - alias = folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS ( - self->priv->individual)); - - gtk_label_set_text (GTK_LABEL (self->priv->alias), alias); + g_object_notify (G_OBJECT (self), "alias"); } static void @@ -342,6 +350,12 @@ empathy_roster_item_class_init ( G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (oclass, PROP_ONLINE, spec); + spec = g_param_spec_string ("alias", "Alias", + "The Alias of the individual displayed in the widget", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (oclass, PROP_ALIAS, spec); + g_type_class_add_private (klass, sizeof (EmpathyRosterItemPriv)); } |