]> git.0d.be Git - empathy.git/commitdiff
Call window: Ellipsize alias and status
authorSjoerd Simons <sjoerd@luon.net>
Sun, 20 May 2012 17:59:29 +0000 (19:59 +0200)
committerSjoerd Simons <sjoerd@luon.net>
Mon, 21 May 2012 11:54:00 +0000 (13:54 +0200)
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
src/empathy-call-window.ui

index 564504f994be42de18fe4776bcfc4e035afc07dd..1301f96d1f663efa8f060d28c02d280efb04d8cf 100644 (file)
@@ -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
index 2158b2b83b88a9c998a4f7e90006badefd464ba8..2caa242b88c128e9537e51f0a607641981a419b0 100644 (file)
                 <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">
                 <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">
                 <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">
                 <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">
                 <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>