Use new internal plugin for rendering avatars
[claws.git] / src / summaryview.c
index bbfc0230c4bab52698572671218ff07a7722b60e..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,8 +4683,8 @@ void summary_add_address(SummaryView *summaryview)
 {
        MsgInfo *msginfo, *full_msginfo;
        gchar *from;
-       GtkWidget *image = NULL;
        GdkPixbuf *picture = NULL;
+       AvatarRender *avatarr;
 
        msginfo = gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
                                              summaryview->selected);
@@ -4695,23 +4696,14 @@ void summary_add_address(SummaryView *summaryview)
        extract_address(from);
        
        full_msginfo = procmsg_msginfo_get_full_info(msginfo);
-       if (full_msginfo &&
-           full_msginfo->extradata &&
-           full_msginfo->extradata->face) {
-               image = face_get_from_header(full_msginfo->extradata->face);
-       } 
-#if HAVE_LIBCOMPFACE
-       else if (full_msginfo &&
-                full_msginfo->extradata &&
-                full_msginfo->extradata->xface) {
-               image = xface_get_from_header(full_msginfo->extradata->xface,
-                               &summaryview->ctree->style->white,
-                               summaryview->mainwin->window->window);  
-       }
-#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);
@@ -4720,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)