aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorPatryk Zawadzki <patrys@pld-linux.org>2009-06-19 19:50:11 +0800
committerPatryk Zawadzki <patrys@pld-linux.org>2009-06-19 19:50:11 +0800
commit3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc (patch)
tree2e99ec7df4174a44fb16628fadc70d9840820a8d /libempathy-gtk
parent5f638d0e0cb77b0dbc59782eb8b80b1763a4c81b (diff)
downloadgsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.tar
gsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.tar.gz
gsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.tar.bz2
gsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.tar.lz
gsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.tar.xz
gsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.tar.zst
gsoc2013-empathy-3eb439ded3d3bd5e644b82b9cec910e0ad5b23fc.zip
Support fallback avatars provided by adium themes
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index edbdbcd04..97a1bdf45 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -50,6 +50,8 @@ typedef struct {
GList *message_queue;
gchar *path;
gchar *default_avatar_filename;
+ gchar *default_incoming_avatar_filename;
+ gchar *default_outgoing_avatar_filename;
gchar *template_html;
gchar *basedir;
gchar *in_content_html;
@@ -114,6 +116,20 @@ theme_adium_load (EmpathyThemeAdium *theme)
g_file_get_contents (file, &priv->status_html, &priv->status_len, NULL);
g_free (file);
+ file = g_build_filename (priv->basedir, "Incoming", "buddy_icon.png", NULL);
+ if (g_file_test (file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ priv->default_incoming_avatar_filename = file;
+ } else {
+ g_free (file);
+ }
+
+ file = g_build_filename (priv->basedir, "Outgoing", "buddy_icon.png", NULL);
+ if (g_file_test (file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ priv->default_outgoing_avatar_filename = file;
+ } else {
+ g_free (file);
+ }
+
css_path = g_build_filename (priv->basedir, "main.css", NULL);
/* There is 2 formats for Template.html: The old one has 4 parameters,
@@ -495,12 +511,19 @@ theme_adium_append_message (EmpathyChatView *view,
avatar_filename = avatar->filename;
}
if (!avatar_filename) {
- if (!priv->default_avatar_filename) {
- priv->default_avatar_filename =
- empathy_filename_from_icon_name ("stock_person",
- GTK_ICON_SIZE_DIALOG);
+ if (empathy_contact_is_user (sender)) {
+ avatar_filename = priv->default_outgoing_avatar_filename;
+ } else {
+ avatar_filename = priv->default_incoming_avatar_filename;
+ }
+ if (!avatar_filename) {
+ if (!priv->default_avatar_filename) {
+ priv->default_avatar_filename =
+ empathy_filename_from_icon_name ("stock_person",
+ GTK_ICON_SIZE_DIALOG);
+ }
+ avatar_filename = priv->default_avatar_filename;
}
- avatar_filename = priv->default_avatar_filename;
}
/* Get the right html/func to add the message */
@@ -700,6 +723,8 @@ theme_adium_finalize (GObject *object)
g_free (priv->out_content_html);
g_free (priv->out_nextcontent_html);
g_free (priv->default_avatar_filename);
+ g_free (priv->default_incoming_avatar_filename);
+ g_free (priv->default_outgoing_avatar_filename);
g_free (priv->path);
G_OBJECT_CLASS (empathy_theme_adium_parent_class)->finalize (object);