From: Jonny Lamb Date: Tue, 8 Jul 2008 10:58:19 +0000 (+0000) Subject: Added support for the chat window to show the avatar as the icon. Fixes bug #526892... X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=b09d614f327b2eb13d2cbb8a39df9c1b5f7310d9 Added support for the chat window to show the avatar as the icon. Fixes bug #526892 (Jonny Lamb) Signed-off-by: Jonny Lamb svn path=/trunk/; revision=1205 --- diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in index 1963de98..00cfdef9 100644 --- a/data/empathy.schemas.in +++ b/data/empathy.schemas.in @@ -246,6 +246,20 @@ + + /schemas/apps/empathy/conversation/avatar_in_icon + /apps/empathy/conversation/avatar_in_icon + empathy + bool + false + + Empathy should use the avatar of the contact as the chat window icon + + Whether or not Empathy should use the avatar of the contact as the chat window icon. + + + + /schemas/apps/empathy/hints/close_main_window /apps/empathy/hints/close_main_window diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h index fb0c5bca..307e25db 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 8be64a3d..7a993d6b 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); + } } }