Index: configure.in =================================================================== RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/configure.in,v retrieving revision 1.1058 diff -p -u -r1.1058 configure.in --- configure.in 25 Oct 2002 11:01:06 -0000 1.1058 +++ configure.in 25 Oct 2002 20:09:48 -0000 @@ -13,6 +13,7 @@ INTERFACE_AGE=0 BINARY_AGE=0 EXTRA_VERSION=claws54 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION +VERSION=$VERSION-dillo dnl set $target AC_CANONICAL_SYSTEM Index: src/messageview.c =================================================================== RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/messageview.c,v retrieving revision 1.53 diff -p -u -r1.53 messageview.c --- src/messageview.c 18 Oct 2002 10:40:25 -0000 1.53 +++ src/messageview.c 25 Oct 2002 20:09:49 -0000 @@ -120,6 +120,7 @@ MessageView *messageview_create(MainWind messageview->textview = textview; messageview->imageview = imageview; messageview->mimeview = mimeview; + messageview->plugview = gtk_socket_new(); messageview->noticeview = noticeview; return messageview; @@ -458,8 +459,8 @@ void messageview_show(MessageView *messa textview_set_all_headers(messageview->textview, all_headers); textview_set_all_headers(messageview->mimeview->textview, all_headers); - if (mimeinfo->mime_type != MIME_TEXT && - mimeinfo->mime_type != MIME_TEXT_HTML) { + if (mimeinfo->mime_type != MIME_TEXT /*&& + mimeinfo->mime_type != MIME_TEXT_HTML*/) { messageview_change_view_type(messageview, MVIEW_MIME); mimeview_show_message(messageview->mimeview, mimeinfo, file); } else { @@ -481,29 +482,51 @@ static void messageview_change_view_type { TextView *textview = messageview->textview; MimeView *mimeview = messageview->mimeview; + GtkWidget *plugview = messageview->plugview; if (messageview->type == type) return; if (type == MVIEW_MIME) { - gtkut_container_remove - (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), - GTK_WIDGET_PTR(textview)); + if (messageview->type == MVIEW_TEXT) + gtkut_container_remove + (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), + GTK_WIDGET_PTR(textview)); + else if (messageview->type == MVIEW_PLUG) + gtkut_container_remove + (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), + GTK_WIDGET_PTR(plugview)); gtk_box_pack_start(GTK_BOX(messageview->vbox), GTK_WIDGET_PTR(mimeview), TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(mimeview->vbox), GTK_WIDGET_PTR(textview)); } else if (type == MVIEW_TEXT) { - gtkut_container_remove - (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), - GTK_WIDGET_PTR(mimeview)); - + if (messageview->type == MVIEW_MIME) + gtkut_container_remove + (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), + GTK_WIDGET_PTR(mimeview)); + else if (messageview->type == MVIEW_PLUG) + gtkut_container_remove + (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), + GTK_WIDGET_PTR(plugview)); + if (mimeview->vbox == GTK_WIDGET_PTR(textview)->parent) gtkut_container_remove(GTK_CONTAINER(mimeview->vbox), GTK_WIDGET_PTR(textview)); gtk_box_pack_start(GTK_BOX(messageview->vbox), GTK_WIDGET_PTR(textview), TRUE, TRUE, 0); - } else + } else if (type == MVIEW_PLUG) { + if (messageview->type == MVIEW_MIME) + gtkut_container_remove + (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), + GTK_WIDGET_PTR(mimeview)); + else if (messageview->type == MVIEW_TEXT) + gtkut_container_remove + (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)), + GTK_WIDGET_PTR(textview)); + gtk_box_pack_start(GTK_BOX(messageview->vbox), + GTK_WIDGET_PTR(plugview), TRUE, TRUE, 0); + } else return; messageview->type = type; @@ -528,6 +551,7 @@ void messageview_destroy(MessageView *me textview_destroy(messageview->textview); imageview_destroy(messageview->imageview); mimeview_destroy(messageview->mimeview); + gtk_widget_destroy(messageview->plugview); noticeview_destroy(messageview->noticeview); g_free(messageview); Index: src/messageview.h =================================================================== RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/messageview.h,v retrieving revision 1.11 diff -p -u -r1.11 messageview.h --- src/messageview.h 23 Aug 2002 06:52:15 -0000 1.11 +++ src/messageview.h 25 Oct 2002 20:09:49 -0000 @@ -36,7 +36,8 @@ typedef struct _MessageView MessageView; typedef enum { MVIEW_TEXT, - MVIEW_MIME + MVIEW_MIME, + MVIEW_PLUG } MessageType; struct _MessageView @@ -51,6 +52,7 @@ struct _MessageView TextView *textview; ImageView *imageview; MimeView *mimeview; + GtkWidget *plugview; NoticeView *noticeview; MainWindow *mainwin; Index: src/mimeview.c =================================================================== RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/mimeview.c,v retrieving revision 1.40 diff -p -u -r1.40 mimeview.c --- src/mimeview.c 22 Sep 2002 10:53:49 -0000 1.40 +++ src/mimeview.c 25 Oct 2002 20:09:49 -0000 @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -53,7 +54,6 @@ #include "prefs_common.h" #include "rfc2015.h" #include "pgptext.h" - typedef enum { COL_MIMETYPE = 0, @@ -215,6 +215,7 @@ MimeView *mimeview_create(void) mimeview->popupmenu = popupmenu; mimeview->popupfactory = popupfactory; mimeview->type = -1; + mimeview->plugview = NULL; return mimeview; } @@ -346,6 +347,10 @@ void mimeview_show_message(MimeView *mim void mimeview_destroy(MimeView *mimeview) { procmime_mimeinfo_free_all(mimeview->mimeinfo); + if (mimeview->plugview) { + printf("MIMVIEW destroyg %08x\n", mimeview->plugview); + gtk_widget_destroy(mimeview->plugview); + } g_free(mimeview->file); g_free(mimeview); } @@ -472,13 +477,67 @@ static void mimeview_show_image_part(Mim g_free(filename); } +static gint plugview_destroyed(GtkObject *o, gpointer data) +{ + MimeView *m = (MimeView *) data; + printf("Destroy thingie %08x (%08x)\n", m->plugview, o); + m->plugview = NULL; + return TRUE; +} + +static void mimeview_show_dillo_part(MimeView *mimeview, MimeInfo *partinfo) +{ + gchar *filename; + + if (!partinfo) return; + + filename = procmime_get_tmp_file_name(partinfo); + + if (procmime_get_part(filename, mimeview->file, partinfo) < 0) + alertpanel_error + (_("Can't get the part of multipart message.")); + else { + gchar *cmd; + /* Workaround for the GTK+ bug with handling scroll adjustments + * in GtkViewport */ + if (mimeview->plugview) + if (GTK_SOCKET(mimeview->plugview)->plug_window) { + gtk_widget_destroy(mimeview->plugview); + printf("Destroyed %08x\n", mimeview->plugview); + mimeview->plugview = NULL; + } + if (!mimeview->plugview) { + mimeview->plugview = gtk_socket_new(); + printf("Created %08x\n", mimeview->plugview); + gtk_signal_connect(GTK_OBJECT(mimeview->plugview), + "destroy", + GTK_SIGNAL_FUNC(plugview_destroyed), + mimeview); + } + mimeview_change_view_type(mimeview, MIMEVIEW_PLUG); + printf("SHowing %08x\n", mimeview->plugview); + gtk_widget_show(mimeview->plugview); + gtk_widget_realize(mimeview->plugview); + + cmd = g_strdup_printf("dillo -f -l -x %d \"%s\"", + GDK_WINDOW_XWINDOW(mimeview->plugview->window), + filename); + execute_command_line(cmd, TRUE); + g_free(cmd); + /*unlink(filename);*/ + } + + g_free(filename); +} static void mimeview_change_view_type(MimeView *mimeview, MimeViewType type) { TextView *textview = mimeview->textview; ImageView *imageview = mimeview->imageview; + GtkWidget *plugview = mimeview->plugview; GList *children; - if (mimeview->type == type) return; + if (mimeview->type == type && type != MIMEVIEW_PLUG) return; + printf("Changing... to "); children = gtk_container_children(GTK_CONTAINER(mimeview->mime_vbox)); if (children) { @@ -489,10 +548,17 @@ static void mimeview_change_view_type(Mi switch (type) { case MIMEVIEW_IMAGE: + printf("Changing... to IMAGE\n"); gtk_container_add(GTK_CONTAINER(mimeview->mime_vbox), GTK_WIDGET_PTR(imageview)); break; + case MIMEVIEW_PLUG: + printf("Changing... to PLUG\n"); + gtk_container_add(GTK_CONTAINER(mimeview->mime_vbox), + mimeview->plugview); + break; case MIMEVIEW_TEXT: + printf("Changing... to TEXT\n"); gtk_container_add(GTK_CONTAINER(mimeview->mime_vbox), GTK_WIDGET_PTR(textview)); break; @@ -509,7 +575,11 @@ static void mimeview_clear(MimeView *mim procmime_mimeinfo_free_all(mimeview->mimeinfo); mimeview->mimeinfo = NULL; - + + printf("Clearing...\n"); + if (mimeview->plugview) + gtk_widget_destroy(mimeview->plugview); + gtk_clist_clear(clist); textview_clear(mimeview->textview); imageview_clear(mimeview->imageview); @@ -545,7 +615,7 @@ static void mimeview_selected(GtkCTree * switch (partinfo->mime_type) { case MIME_TEXT: - case MIME_TEXT_HTML: + /*case MIME_TEXT_HTML:*/ case MIME_TEXT_ENRICHED: case MIME_MESSAGE_RFC822: case MIME_MULTIPART: @@ -563,6 +633,9 @@ static void mimeview_selected(GtkCTree * } break; #endif + case MIME_TEXT_HTML: + mimeview_show_dillo_part(mimeview, partinfo); + break; default: mimeview->textview->default_text = TRUE; mimeview_change_view_type(mimeview, MIMEVIEW_TEXT); Index: src/mimeview.h =================================================================== RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/mimeview.h,v retrieving revision 1.4 diff -p -u -r1.4 mimeview.h --- src/mimeview.h 22 Sep 2002 10:53:49 -0000 1.4 +++ src/mimeview.h 25 Oct 2002 20:09:49 -0000 @@ -35,7 +35,8 @@ typedef struct _MimeView MimeView; typedef enum { MIMEVIEW_TEXT, - MIMEVIEW_IMAGE + MIMEVIEW_IMAGE, + MIMEVIEW_PLUG } MimeViewType; struct _MimeView @@ -57,6 +58,7 @@ struct _MimeView TextView *textview; ImageView *imageview; + GtkWidget *plugview; MessageView *messageview;