Use new internal plugin for rendering avatars
[claws.git] / src / summaryview.c
index 3bd2ac0f6b07884870c48a3181d373376c128e0e..8da3900ea5d8e22bfd7049f806248075c2af056e 100644 (file)
@@ -81,6 +81,7 @@
 #include "edittags.h"
 #include "manual.h"
 #include "manage_window.h"
+#include "avatars.h"
 
 #define SUMMARY_COL_MARK_WIDTH         10
 #define SUMMARY_COL_STATUS_WIDTH       13
@@ -4682,9 +4683,8 @@ void summary_add_address(SummaryView *summaryview)
 {
        MsgInfo *msginfo, *full_msginfo;
        gchar *from;
-       GtkWidget *image = NULL;
        GdkPixbuf *picture = NULL;
-       gchar *face;
+       AvatarRender *avatarr;
 
        msginfo = gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
                                              summaryview->selected);
@@ -4696,21 +4696,14 @@ void summary_add_address(SummaryView *summaryview)
        extract_address(from);
        
        full_msginfo = procmsg_msginfo_get_full_info(msginfo);
-       face = procmsg_msginfo_get_avatar(full_msginfo, AVATAR_FACE);
-       if (face) {
-               image = face_get_from_header(face);
-       } 
-#if HAVE_LIBCOMPFACE
-       else {
-               gchar *xface = procmsg_msginfo_get_avatar(full_msginfo, AVATAR_XFACE);
-               if (xface) {
-                       image = xface_get_from_header(xface);
-               }
-       }
-#endif
+
+       avatarr = avatars_avatarrender_new(full_msginfo);
+       hooks_invoke(AVATAR_IMAGE_RENDER_HOOKLIST, avatarr);
+
        procmsg_msginfo_free(full_msginfo);
-       if (image)
-               picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+
+       if (avatarr->image)
+               picture = gtk_image_get_pixbuf(GTK_IMAGE(avatarr->image));
 
 #ifndef USE_NEW_ADDRBOOK
        addressbook_add_contact(msginfo->fromname, from, NULL, picture);
@@ -4719,8 +4712,7 @@ void summary_add_address(SummaryView *summaryview)
                debug_print( "addressbook_add_contact - added\n" );
        }
 #endif
-       if (image)
-               gtk_widget_destroy(image);
+       avatars_avatarrender_free(avatarr);
 }
 
 void summary_select_all(SummaryView *summaryview)