1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
diff -r -c sylpheed-0.8.3claws.orig/src/messageview.c sylpheed-0.8.3claws/src/messageview.c
--- sylpheed-0.8.3claws.orig/src/messageview.c 23 Aug 2002 06:52:15
+++ sylpheed-0.8.3claws/src/messageview.c 29 Sep 2002 08:16:45
@@ -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);
diff -r -c sylpheed-0.8.3claws.orig/src/messageview.h sylpheed-0.8.3claws/src/messageview.h
--- sylpheed-0.8.3claws.orig/src/messageview.h 23 Aug 2002 06:52:15
+++ sylpheed-0.8.3claws/src/messageview.h 29 Sep 2002 08:16:45
@@ -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;
diff -r -c sylpheed-0.8.3claws.orig/src/mimeview.c sylpheed-0.8.3claws/src/mimeview.c
--- sylpheed-0.8.3claws.orig/src/mimeview.c 22 Sep 2002 10:53:49
+++ sylpheed-0.8.3claws/src/mimeview.c 29 Sep 2002 08:16:45
@@ -25,6 +25,7 @@
#include <glib.h>
#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkx.h>
#include <gtk/gtknotebook.h>
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkctree.h>
@@ -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);
diff -r -c sylpheed-0.8.3claws.orig/src/mimeview.h sylpheed-0.8.3claws/src/mimeview.h
--- sylpheed-0.8.3claws.orig/src/mimeview.h 22 Sep 2002 10:53:44
+++ sylpheed-0.8.3claws/src/mimeview.h 29 Sep 2002 08:16:45
@@ -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;
|