[gnome-chat] embed: Show the avatar in the status area



commit 201158bd6a65ada37d8969f0e22c40ac494c3c7e
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Sep 11 18:01:03 2013 +0200

    embed: Show the avatar in the status area
    
    This uses TpawAvatarChooser.

 src/chat-embed.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/chat-embed.c b/src/chat-embed.c
index 3a1116e..b7f9303 100644
--- a/src/chat-embed.c
+++ b/src/chat-embed.c
@@ -23,6 +23,7 @@
 
 #include <telepathy-glib/telepathy-glib.h>
 #include <telepathy-logger/telepathy-logger.h>
+#include <tp-account-widgets/tpaw-avatar-chooser.h>
 
 #include "chat-application.h"
 #include "chat-conversation-view.h"
@@ -39,12 +40,15 @@ struct _ChatEmbedPrivate
   GHashTable *conversations;
   GtkSizeGroup *size_group_bottom;
   GtkSizeGroup *size_group_left;
+  GtkWidget *avatar_chooser;
   GtkWidget *conversations_list;
   GtkWidget *current_view;
   GtkWidget *conversations_stack;
   GtkWidget *main_input_area;
   GtkWidget *sidebar_frame;
   GtkWidget *status_area;
+  GtkWidget *status_area_grid0;
+  GtkWidget *status_area_grid1;
   GtkWidget *status_area_nickname;
   GtkWidget *status_area_presence_icon;
   GtkWidget *status_area_presence_message;
@@ -133,6 +137,18 @@ chat_embed_row_activated (ChatEmbed *self, GtkListBoxRow *row)
   contact = g_object_get_data (G_OBJECT (row), "chat-conversations-list-contact");
   account = tp_contact_get_account (contact);
 
+  if (priv->avatar_chooser != NULL)
+    gtk_widget_destroy (priv->avatar_chooser);
+  priv->avatar_chooser = tpaw_avatar_chooser_new (account);
+  gtk_button_set_relief (GTK_BUTTON (priv->avatar_chooser), GTK_RELIEF_NONE);
+  gtk_grid_attach_next_to (GTK_GRID (priv->status_area_grid0),
+                           priv->avatar_chooser,
+                           priv->status_area_grid1,
+                           GTK_POS_LEFT,
+                           2,
+                           2);
+  gtk_widget_show (priv->avatar_chooser);
+
   nickname = tp_account_get_nickname (account);
   markup = g_markup_printf_escaped ("<b>%s</b>", nickname);
   gtk_label_set_markup (GTK_LABEL (priv->status_area_nickname), markup);
@@ -291,6 +307,8 @@ chat_embed_class_init (ChatEmbedClass *class)
   gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, main_input_area);
   gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, sidebar_frame);
   gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, status_area);
+  gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, status_area_grid0);
+  gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, status_area_grid1);
   gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, status_area_nickname);
   gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, status_area_presence_icon);
   gtk_widget_class_bind_template_child_private (widget_class, ChatEmbed, status_area_presence_message);


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