]> git.0d.be Git - empathy.git/commitdiff
CallWindow: add the remote user name and presence to the toolbar
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Fri, 22 Jul 2011 16:14:12 +0000 (17:14 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 28 Jul 2011 08:00:38 +0000 (09:00 +0100)
src/empathy-call-window.c

index 9e1a47e456145258e806272b381a1f673465699f..e84f41fb9704d787ed18b4048298c5eb636603fd 100644 (file)
@@ -123,6 +123,7 @@ struct _EmpathyCallWindowPriv
   GtkWidget *video_container;
   GtkWidget *remote_user_avatar_widget;
   GtkWidget *remote_user_avatar_toolbar;
   GtkWidget *video_container;
   GtkWidget *remote_user_avatar_widget;
   GtkWidget *remote_user_avatar_toolbar;
+  GtkWidget *remote_user_name_toolbar;
   GtkWidget *sidebar;
   GtkWidget *volume_item;
   GtkWidget *status_label;
   GtkWidget *sidebar;
   GtkWidget *volume_item;
   GtkWidget *status_label;
@@ -300,6 +301,21 @@ empathy_call_window_setup_toolbars (EmpathyCallWindow *self)
   gtk_widget_show (GTK_WIDGET (tool_item));
   gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
 
   gtk_widget_show (GTK_WIDGET (tool_item));
   gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
 
+  /* Set the remote name */
+  tool_item = gtk_tool_item_new ();
+  priv->remote_user_name_toolbar = gtk_label_new (NULL);
+  gtk_container_add (GTK_CONTAINER (tool_item),
+      priv->remote_user_name_toolbar);
+  gtk_widget_show_all (GTK_WIDGET (tool_item));
+  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
+
+  /* Add some space between the image and the name */
+  tool_item = gtk_separator_tool_item_new ();
+  gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item),
+      FALSE);
+  gtk_widget_show (GTK_WIDGET (tool_item));
+  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), tool_item, 0);
+
   /* Set the remote avatar */
   tool_item = gtk_tool_item_new ();
   priv->remote_user_avatar_toolbar = gtk_image_new ();
   /* Set the remote avatar */
   tool_item = gtk_tool_item_new ();
   priv->remote_user_avatar_toolbar = gtk_image_new ();
@@ -1238,11 +1254,35 @@ set_window_title (EmpathyCallWindow *self)
     }
 }
 
     }
 }
 
+static void
+set_remote_user_name (EmpathyCallWindow *self,
+  EmpathyContact *contact)
+{
+  const gchar *alias = empathy_contact_get_alias (contact);
+  const gchar *status = empathy_contact_get_status (contact);
+  gchar *label;
+
+  label = g_strdup_printf ("%s\n<small>%s</small>", alias, status);
+  gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_name_toolbar),
+      label);
+  g_free (label);
+}
+
 static void
 contact_name_changed_cb (EmpathyContact *contact,
 static void
 contact_name_changed_cb (EmpathyContact *contact,
-    GParamSpec *pspec, EmpathyCallWindow *self)
+    GParamSpec *pspec,
+    EmpathyCallWindow *self)
 {
   set_window_title (self);
 {
   set_window_title (self);
+  set_remote_user_name (self, contact);
+}
+
+static void
+contact_presence_changed_cb (EmpathyContact *contact,
+    GParamSpec *pspec,
+    EmpathyCallWindow *self)
+{
+  set_remote_user_name (self, contact);
 }
 
 static void
 }
 
 static void
@@ -1292,8 +1332,12 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self,
       G_CALLBACK (contact_name_changed_cb), self);
   g_signal_connect (priv->contact, "notify::avatar",
     G_CALLBACK (contact_avatar_changed_cb), self);
       G_CALLBACK (contact_name_changed_cb), self);
   g_signal_connect (priv->contact, "notify::avatar",
     G_CALLBACK (contact_avatar_changed_cb), self);
+  /* FIXME: There's no EmpathyContact::presence yet */
+  g_signal_connect (priv->contact, "notify::presence",
+      G_CALLBACK (contact_presence_changed_cb), self);
 
   set_window_title (self);
 
   set_window_title (self);
+  set_remote_user_name (self, priv->contact);
 
   init_contact_avatar_with_size (priv->contact,
       priv->remote_user_avatar_widget,
 
   init_contact_avatar_with_size (priv->contact,
       priv->remote_user_avatar_widget,