[empathy/gnome-3-4] Call window: Ellipsize alias and status



commit 7e7a60c59f7e07612cdbc5e547dbb9a1151834ab
Author: Sjoerd Simons <sjoerd luon net>
Date:   Sun May 20 19:59:29 2012 +0200

    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(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 564504f..1301f96 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<small>%s</small>", 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 ("<small>%s</small>", 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 2158b2b..2caa242 100644
--- a/src/empathy-call-window.ui
+++ b/src/empathy-call-window.ui
@@ -164,27 +164,37 @@
                 <property name="draw">False</property>
                 <property name="visible">True</property>
               </object>
-              <packing>
-                <property name="homogeneous">True</property>
-              </packing>
             </child>
             <child>
+
               <object class="GtkToolItem" id="toolitem2">
                 <property name="visible">True</property>
                 <child>
-                  <object class="GtkLabel" id="remote_user_name_toolbar">
-                    <property name="visible">True</property>
+                  <object class="GtkVBox" id="uservbox">
+                  <child>
+                    <object class="GtkLabel" id="remote_user_name_toolbar">
+                      <property name="visible">True</property>
+                      <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+                      <property name="xalign">0</property>
+                    </object>
+                    <packing>
+                      <property name="fill">False</property>
+                    </packing>
+                  </child>
+                  <child>
+                    <object class="GtkLabel" id="remote_user_status_toolbar">
+                      <property name="visible">True</property>
+                      <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+                      <property name="xalign">0</property>
+                    </object>
+                    <packing>
+                      <property name="fill">False</property>
+                    </packing>
+                  </child>
                   </object>
                 </child>
               </object>
-            </child>
-            <child>
-              <object class="GtkToolItem" id="toolbar_space1">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-              </packing>
+              <packing> <property name="expand">True</property></packing>
             </child>
             <child>
               <object class="GtkToolButton" id="hangup">
@@ -193,9 +203,6 @@
                 <property name="icon_name">call-stop</property>
                 <property name="tooltip_text" translatable="yes">Hang up current call</property>
               </object>
-              <packing>
-                <property name="homogeneous">False</property>
-              </packing>
             </child>
             <child>
               <object class="GtkToolButton" id="videocall">
@@ -203,9 +210,6 @@
                 <property name="icon_name">camera-web</property>
                 <property name="tooltip_text" translatable="yes">Start a video call</property>
               </object>
-              <packing>
-                <property name="homogeneous">True</property>
-              </packing>
             </child>
             <child>
               <object class="GtkToolButton" id="audiocall">
@@ -213,9 +217,6 @@
                 <property name="icon_name">call-start</property>
                 <property name="tooltip_text" translatable="yes">Start an audio call</property>
               </object>
-              <packing>
-                <property name="homogeneous">True</property>
-              </packing>
             </child>
             <child>
               <object class="GtkToggleToolButton" id="dialpad">
@@ -224,9 +225,6 @@
                 <property name="icon_name">input-dialpad</property>
                 <property name="tooltip_text" translatable="yes">Display the dialpad</property>
               </object>
-              <packing>
-                <property name="homogeneous">True</property>
-              </packing>
             </child>
           </object>
           <packing>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]