aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-roster-item.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-21 22:02:39 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-14 15:21:46 +0800
commit902f0c33eda521800d562e47575ff966ee87b56b (patch)
tree9b04156c37cd4edaf96d9c86fd6dfd3d3022320a /libempathy-gtk/empathy-roster-item.c
parentc0a7480104a667565782b0740ac9f48a94832488 (diff)
downloadgsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.tar
gsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.tar.gz
gsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.tar.bz2
gsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.tar.lz
gsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.tar.xz
gsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.tar.zst
gsoc2013-empathy-902f0c33eda521800d562e47575ff966ee87b56b.zip
Center the alias if no presence message is displayed
Diffstat (limited to 'libempathy-gtk/empathy-roster-item.c')
-rw-r--r--libempathy-gtk/empathy-roster-item.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-roster-item.c b/libempathy-gtk/empathy-roster-item.c
index f98f961d0..75b87510d 100644
--- a/libempathy-gtk/empathy-roster-item.c
+++ b/libempathy-gtk/empathy-roster-item.c
@@ -149,7 +149,22 @@ update_presence_msg (EmpathyRosterItem *self)
msg = folks_presence_details_get_presence_message (
FOLKS_PRESENCE_DETAILS (self->priv->individual));
- gtk_label_set_text (GTK_LABEL (self->priv->presence_msg), msg);
+ if (tp_str_empty (msg))
+ {
+ /* Just display the alias in the center of the row */
+ gtk_misc_set_alignment (GTK_MISC (self->priv->alias), 0, 0.5);
+
+ gtk_widget_hide (self->priv->presence_msg);
+ }
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (self->priv->presence_msg), msg);
+
+ gtk_misc_set_alignment (GTK_MISC (self->priv->alias), 0, 0.75);
+ gtk_misc_set_alignment (GTK_MISC (self->priv->presence_msg), 0, 0.25);
+
+ gtk_widget_show (self->priv->presence_msg);
+ }
}
static void
@@ -273,14 +288,12 @@ empathy_roster_item_init (EmpathyRosterItem *self)
/* Alias */
self->priv->alias = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (self->priv->alias), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box), self->priv->alias, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (self), box, TRUE, TRUE, 0);
/* Presence */
self->priv->presence_msg = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (self->priv->presence_msg), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box), self->priv->presence_msg, TRUE, TRUE, 0);
gtk_widget_show_all (box);