}
headerview_show(messageview->headerview, messageview->msginfo);
+ messageview_set_position(messageview, 0);
+
textview_set_all_headers(messageview->mimeview->textview,
messageview->all_headers);
g_free(subject);
}
- messageview_set_position(messageview, 0);
-
main_create_mailing_list_menu(messageview->mainwin, messageview->msginfo);
if (messageview->msginfo->extradata
}
if (messageview->updating) {
- debug_print("uh oh, better not touch that now\n");
+ debug_print("uh oh, better not touch that now (fetching)\n");
+ messageview->deferred_destroy = TRUE;
+ gtk_widget_hide(messageview->window);
+ return;
+ }
+
+ if (messageview->mimeview->textview
+ && messageview->mimeview->textview->loading) {
+ debug_print("uh oh, better not touch that now (loading text)\n");
messageview->deferred_destroy = TRUE;
+ messageview->mimeview->textview->stop_loading = TRUE;
gtk_widget_hide(messageview->window);
return;
}
main_window_cursor_normal(summaryview->mainwin);
return FALSE;
}
+
gboolean summary_show(SummaryView *summaryview, FolderItem *item)
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
summary_status_show(summaryview);
}
+typedef struct _PostponedSelectData
+{
+ GtkCTree *ctree;
+ GtkCTreeNode *row;
+ gint column;
+ SummaryView *summaryview;
+} PostponedSelectData;
+
+static gboolean summary_select_retry(void *data)
+{
+ PostponedSelectData *psdata = (PostponedSelectData *)data;
+ debug_print("trying again\n");
+ summary_selected(psdata->ctree, psdata->row,
+ psdata->column, psdata->summaryview);
+ g_free(psdata);
+ return FALSE;
+}
+
static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
gint column, SummaryView *summaryview)
{
MsgInfo *msginfo;
gboolean marked_unread = FALSE;
+ if (summary_is_locked(summaryview)
+ && !GTK_SCTREE(ctree)->selecting_range
+ && summaryview->messageview->mimeview
+ && summaryview->messageview->mimeview->type == MIMEVIEW_TEXT
+ && summaryview->messageview->mimeview->textview->loading) {
+ PostponedSelectData *data = g_new0(PostponedSelectData, 1);
+ summaryview->messageview->mimeview->textview->stop_loading = TRUE;
+
+ data->ctree = ctree;
+ data->row = row;
+ data->column = column;
+ data->summaryview = summaryview;
+ debug_print("postponing open of message till end of load\n");
+ g_timeout_add(100, summary_select_retry, data);
+ return;
+ }
if (summary_is_locked(summaryview)
|| GTK_SCTREE(ctree)->selecting_range) {
return;
void textview_show_message(TextView *textview, MimeInfo *mimeinfo,
const gchar *file)
{
+ textview->loading = TRUE;
+ textview->stop_loading = FALSE;
+
textview_clear(textview);
textview_add_parts(textview, mimeinfo);
textview_set_position(textview, 0);
+
+ textview->loading = FALSE;
+ textview->stop_loading = FALSE;
}
void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
if ((mimeinfo->type == MIMETYPE_MULTIPART) ||
((mimeinfo->type == MIMETYPE_MESSAGE) && !g_ascii_strcasecmp(mimeinfo->subtype, "rfc822"))) {
+ textview->loading = TRUE;
+ textview->stop_loading = FALSE;
+
textview_clear(textview);
textview_add_parts(textview, mimeinfo);
+
+ textview->loading = FALSE;
+ textview->stop_loading = FALSE;
END_TIMING();
return;
}
+ textview->loading = TRUE;
+ textview->stop_loading = FALSE;
if (fseek(fp, mimeinfo->offset, SEEK_SET) < 0)
perror("fseek");
textview_add_parts(textview, mimeinfo);
else
textview_write_body(textview, mimeinfo);
+
+ textview->loading = FALSE;
+ textview->stop_loading = FALSE;
END_TIMING();
}
charcount = gtk_text_buffer_get_char_count(buffer);
gtk_text_buffer_get_end_iter(buffer, &iter);
+ if (textview->stop_loading) {
+ return;
+ }
if (mimeinfo->type == MIMETYPE_MULTIPART) {
END_TIMING();
return;
ClickableText *uri;
gchar *uri_str;
START_TIMING("inserting image");
+
filename = procmime_get_tmp_file_name(mimeinfo);
if (procmime_get_part(filename, mimeinfo) < 0) {
g_object_unref(pixbuf);
g_free(filename);
END_TIMING();
+ GTK_EVENTS_FLUSH();
}
} else if (mimeinfo->type == MIMETYPE_TEXT) {
if (prefs_common.display_header && (charcount > 0))
CodeConverter *conv;
const gchar *charset, *p, *cmd;
GSList *cur;
+ int lines = 0;
if (textview->messageview->forced_charset)
charset = textview->messageview->forced_charset;
}
close(pfd[1]);
tmpfp = fdopen(pfd[0], "rb");
- while (fgets(buf, sizeof(buf), tmpfp))
+ while (fgets(buf, sizeof(buf), tmpfp)) {
textview_write_line(textview, buf, conv);
+
+ lines++;
+ if (lines % 500 == 0)
+ GTK_EVENTS_FLUSH();
+ if (textview->stop_loading) {
+ fclose(tmpfp);
+ waitpid(pid, pfd, 0);
+ unlink(fname);
+ return;
+ }
+ }
+
fclose(tmpfp);
waitpid(pid, pfd, 0);
unlink(fname);
} else {
textview_default:
+ lines = 0;
tmpfp = g_fopen(mimeinfo->data.filename, "rb");
fseek(tmpfp, mimeinfo->offset, SEEK_SET);
debug_print("Viewing text content of type: %s (length: %d)\n", mimeinfo->subtype, mimeinfo->length);
while ((ftell(tmpfp) < mimeinfo->offset + mimeinfo->length) &&
- (fgets(buf, sizeof(buf), tmpfp) != NULL))
+ (fgets(buf, sizeof(buf), tmpfp) != NULL)) {
textview_write_line(textview, buf, conv);
+ lines++;
+ if (lines % 500 == 0)
+ GTK_EVENTS_FLUSH();
+ if (textview->stop_loading) {
+ fclose(tmpfp);
+ return;
+ }
+ }
fclose(tmpfp);
}
conv_code_converter_destroy(conv);
procmime_force_encoding(0);
+ lines = 0;
for (cur = textview->uri_list; cur; cur = cur->next) {
ClickableText *uri = (ClickableText *)cur->data;
if (!uri->is_quote)
if (!prefs_common.hide_quotes ||
uri->quote_level+1 < prefs_common.hide_quotes) {
textview_toggle_quote(textview, uri, TRUE);
+ lines++;
+ if (lines % 500 == 0)
+ GTK_EVENTS_FLUSH();
+ if (textview->stop_loading) {
+ return;
+ }
}
}
}
{
SC_HTMLParser *parser;
gchar *str;
+ gint lines = 0;
parser = sc_html_parser_new(fp, conv);
g_return_if_fail(parser != NULL);
textview_write_link(textview, str, parser->href, NULL);
} else
textview_write_line(textview, str, NULL);
+ lines++;
+ if (lines % 500 == 0)
+ GTK_EVENTS_FLUSH();
+ if (textview->stop_loading) {
+ return;
+ }
}
textview_write_line(textview, "\n", NULL);
sc_html_parser_destroy(parser);
{
ERTFParser *parser;
gchar *str;
+ gint lines = 0;
parser = ertf_parser_new(fp, conv);
g_return_if_fail(parser != NULL);
while ((str = ertf_parse(parser)) != NULL) {
textview_write_line(textview, str, NULL);
+ lines++;
+ if (lines % 500 == 0)
+ GTK_EVENTS_FLUSH();
+ if (textview->stop_loading) {
+ return;
+ }
}
ertf_parser_destroy(parser);
GdkEventMotion *event,
TextView *textview)
{
+ if (textview->loading)
+ return FALSE;
textview_uri_update(textview, event->x, event->y);
gdk_window_get_pointer(widget->window, NULL, NULL, NULL);
GdkEventCrossing *event,
TextView *textview)
{
+ if (textview->loading)
+ return FALSE;
textview_uri_update(textview, -1, -1);
return FALSE;
gint wx, wy;
GdkWindow *window;
+ if (textview->loading)
+ return FALSE;
+
window = gtk_text_view_get_window(GTK_TEXT_VIEW(widget),
GTK_TEXT_WINDOW_TEXT);