aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2008-07-08 18:58:19 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-07-08 18:58:19 +0800
commitb09d614f327b2eb13d2cbb8a39df9c1b5f7310d9 (patch)
treea43b8ce20948715487476326ca4be6e75bf4c764
parent93978582b8a48175d4721b3d8fddce0d6d55b4fc (diff)
downloadgsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.tar
gsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.tar.gz
gsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.tar.bz2
gsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.tar.lz
gsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.tar.xz
gsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.tar.zst
gsoc2013-empathy-b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9.zip
Added support for the chat window to show the avatar as the icon. Fixes bug #526892 (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=1205
-rw-r--r--data/empathy.schemas.in14
-rw-r--r--libempathy-gtk/empathy-conf.h1
-rw-r--r--src/empathy-chat-window.c16
3 files changed, 30 insertions, 1 deletions
diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in
index 1963de981..00cfdef9d 100644
--- a/data/empathy.schemas.in
+++ b/data/empathy.schemas.in
@@ -247,6 +247,20 @@
</schema>
<schema>
+ <key>/schemas/apps/empathy/conversation/avatar_in_icon</key>
+ <applyto>/apps/empathy/conversation/avatar_in_icon</applyto>
+ <owner>empathy</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Empathy should use the avatar of the contact as the chat window icon</short>
+ <long>
+ Whether or not Empathy should use the avatar of the contact as the chat window icon.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/empathy/hints/close_main_window</key>
<applyto>/apps/empathy/hints/close_main_window</applyto>
<owner>empathy</owner>
diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h
index fb0c5bcad..307e25db0 100644
--- a/libempathy-gtk/empathy-conf.h
+++ b/libempathy-gtk/empathy-conf.h
@@ -54,6 +54,7 @@ struct _EmpathyConfClass {
#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES EMPATHY_PREFS_PATH "/conversation/spell_checker_languages"
#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED EMPATHY_PREFS_PATH "/conversation/spell_checker_enabled"
#define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR EMPATHY_PREFS_PATH "/conversation/nick_completion_char"
+#define EMPATHY_PREFS_CHAT_AVATAR_IN_ICON EMPATHY_PREFS_PATH "/conversation/avatar_in_icon"
#define EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS EMPATHY_PREFS_PATH "/ui/separate_chat_windows"
#define EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN EMPATHY_PREFS_PATH "/ui/main_window_hidden"
#define EMPATHY_PREFS_UI_AVATAR_DIRECTORY EMPATHY_PREFS_PATH "/ui/avatar_directory"
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 8be64a3d8..7a993d6bf 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -287,6 +287,9 @@ chat_window_update (EmpathyChatWindow *window)
gint page_num;
const gchar *name;
guint n_chats;
+ GdkPixbuf *icon;
+ EmpathyContact *remote_contact;
+ gboolean avatar_in_icon;
/* Get information */
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
@@ -323,7 +326,18 @@ chat_window_update (EmpathyChatWindow *window)
gtk_window_set_icon_name (GTK_WINDOW (priv->dialog),
EMPATHY_IMAGE_MESSAGE);
} else {
- gtk_window_set_icon_name (GTK_WINDOW (priv->dialog), NULL);
+ empathy_conf_get_bool (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_AVATAR_IN_ICON,
+ &avatar_in_icon);
+
+ if (n_chats == 1 && avatar_in_icon) {
+ remote_contact = empathy_chat_get_remote_contact (priv->current_chat);
+ icon = empathy_pixbuf_avatar_from_contact_scaled (remote_contact, 0, 0);
+ gtk_window_set_icon (GTK_WINDOW (priv->dialog), icon);
+ g_object_unref (icon);
+ } else {
+ gtk_window_set_icon_name (GTK_WINDOW (priv->dialog), NULL);
+ }
}
}