aboutsummaryrefslogtreecommitdiff
path: root/src/textview.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-14 07:11:52 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-14 07:11:52 +0000
commitbf62e6c1ba267028919f7a70cf4573a54395a58c (patch)
tree2cc2bce50f3f5691f9118100bbd80b95c29f87d4 /src/textview.c
parent7de265a4b5e72654a50b2af31e1e44858f39e8e4 (diff)
show error when writing body failed.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1162 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/textview.c')
-rw-r--r--src/textview.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/textview.c b/src/textview.c
index e9d33d59..89db0b52 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -89,14 +89,12 @@ static GdkColor emphasis_color = {
(gushort)0xcfff
};
-#if 0
static GdkColor error_color = {
(gulong)0,
(gushort)0xefff,
(gushort)0,
(gushort)0
};
-#endif
#if USE_GPGME
static GdkColor good_sig_color = {
@@ -365,6 +363,9 @@ static void textview_create_tags(TextView *textview)
gtk_text_buffer_create_tag(buffer, "emphasis",
"foreground-gdk", &emphasis_color,
NULL);
+ gtk_text_buffer_create_tag(buffer, "error",
+ "foreground-gdk", &error_color,
+ NULL);
#if USE_GPGME
gtk_text_buffer_create_tag(buffer, "good-signature",
"foreground-gdk", &good_sig_color,
@@ -803,18 +804,22 @@ static void textview_add_parts(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
}
}
-void textview_show_error(TextView *textview)
+static void textview_write_error(TextView *textview, const gchar *msg)
{
GtkTextBuffer *buffer;
GtkTextIter iter;
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
+ gtk_text_buffer_get_end_iter(buffer, &iter);
+ gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, msg, -1,
+ "error", NULL);
+}
+
+void textview_show_error(TextView *textview)
+{
textview_set_font(textview, NULL);
textview_clear(textview);
-
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
- gtk_text_buffer_get_start_iter(buffer, &iter);
- gtk_text_buffer_insert(buffer, &iter,
- _("This message can't be displayed.\n"), -1);
+ textview_write_error(textview, _("This message can't be displayed.\n"));
}
static void textview_write_body(TextView *textview, MimeInfo *mimeinfo,
@@ -835,6 +840,11 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo,
while (fgets(buf, sizeof(buf), tmpfp) != NULL)
textview_write_line(textview, buf, conv);
fclose(tmpfp);
+ } else {
+ textview_write_error
+ (textview,
+ _("The body text couldn't be displayed because "
+ "writing to temporary file failed.\n"));
}
conv_code_converter_destroy(conv);