From 7e7a60c59f7e07612cdbc5e547dbb9a1151834ab Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sun, 20 May 2012 19:59:29 +0200 Subject: Call window: Ellipsize alias and status If the user alias is too long both the hangup and the dialpad buttons get pushed into a drop-down menu. Even worse when the alias doesn't fit, it just isn't shown at all anymore. Given the username is already printed in the title and the user tends to know who they're calling with, ellipsizing the alias isn't an issue. Which has the nice side-effect of keeping the hangup and dialpad buttons on the toolbar in all cases like they should be. Unfortunately as pango doesn't ellipsize if it still has enough height left to put more lines in. So put the alias and status in seperate labels in a vbox which isn't set to fill. --- src/empathy-call-window.c | 22 +++++++++++++-------- src/empathy-call-window.ui | 48 ++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 564504f99..1301f96d1 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -161,6 +161,7 @@ struct _EmpathyCallWindowPriv GtkWidget *remote_user_avatar_widget; GtkWidget *remote_user_avatar_toolbar; GtkWidget *remote_user_name_toolbar; + GtkWidget *remote_user_status_toolbar; GtkWidget *status_label; GtkWidget *hangup_button; GtkWidget *audio_call_button; @@ -1564,6 +1565,7 @@ empathy_call_window_init (EmpathyCallWindow *self) "errors_vbox", &priv->errors_vbox, "pane", &priv->pane, "remote_user_name_toolbar", &priv->remote_user_name_toolbar, + "remote_user_status_toolbar", &priv->remote_user_status_toolbar, "remote_user_avatar_toolbar", &priv->remote_user_avatar_toolbar, "status_label", &priv->status_label, "audiocall", &priv->audio_call_button, @@ -1873,16 +1875,20 @@ set_remote_user_name (EmpathyCallWindow *self, { const gchar *alias = empathy_contact_get_alias (contact); const gchar *status = empathy_contact_get_status (contact); - gchar *label; - if (status != NULL) - label = g_strdup_printf ("%s\n%s", alias, status); - else - label = g_strdup (alias); + gtk_label_set_text (GTK_LABEL (self->priv->remote_user_name_toolbar), alias); + + if (status != NULL) { + gchar *markup; - gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_name_toolbar), - label); - g_free (label); + markup = g_markup_printf_escaped ("%s", status); + gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_status_toolbar), + markup); + g_free (markup); + } else { + gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_status_toolbar), + ""); + } } static void diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index 2158b2b83..2caa242b8 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -164,27 +164,37 @@ False True - - True - + True - - True + + + + True + PANGO_ELLIPSIZE_END + 0 + + + False + + + + + True + PANGO_ELLIPSIZE_END + 0 + + + False + + - - - - True - - - True - + True @@ -193,9 +203,6 @@ call-stop Hang up current call - - False - @@ -203,9 +210,6 @@ camera-web Start a video call - - True - @@ -213,9 +217,6 @@ call-start Start an audio call - - True - @@ -224,9 +225,6 @@ input-dialpad Display the dialpad - - True - -- cgit v1.2.3