2005-09-14 [paul] 1.9.14cvs26
[claws.git] / src / textview.c
index 4a1876b542de2c2e79b8fe9caeb25573e01a79c2..c5a512baa57e3fd3170358e81b469667b6347280 100644 (file)
@@ -339,7 +339,7 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
 
        if (!bold_font_desc) {
                bold_font_desc = pango_font_description_from_string
-                       (BOLD_FONT);
+                       (NORMAL_FONT);
                pango_font_description_set_weight
                        (bold_font_desc, PANGO_WEIGHT_BOLD);
        }
@@ -738,7 +738,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
                charset = textview->messageview->forced_charset;
        else
                charset = procmime_mimeinfo_get_parameter(mimeinfo, "charset");
-
+printf("charset %s\n", charset);
        textview_set_font(textview, charset);
 
        conv = conv_code_converter_new(charset);
@@ -1111,10 +1111,39 @@ void textview_set_all_headers(TextView *textview, gboolean all_headers)
        textview->show_all_headers = all_headers;
 }
 
+#define CHANGE_TAG_FONT(tagname, font) { \
+       tag = gtk_text_tag_table_lookup(tags, tagname); \
+       if (tag) \
+               g_object_set(G_OBJECT(tag), "font-desc", font, NULL); \
+}
+
 void textview_set_font(TextView *textview, const gchar *codeset)
 {
+       GtkTextTag *tag;
+       GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
+       GtkTextTagTable *tags = gtk_text_buffer_get_tag_table(buffer);
+       
+       if (NORMAL_FONT) {
+               PangoFontDescription *font_desc, *bold_font_desc;
+               font_desc = pango_font_description_from_string
+                                               (NORMAL_FONT);
+               bold_font_desc = pango_font_description_from_string
+                                               (NORMAL_FONT);
+               if (font_desc) {
+                       gtk_widget_modify_font(textview->text, font_desc);
+                       CHANGE_TAG_FONT("header", font_desc);
+                       pango_font_description_free(font_desc);
+               }
+               if (bold_font_desc) {
+                       pango_font_description_set_weight
+                               (bold_font_desc, PANGO_WEIGHT_BOLD);
+                       CHANGE_TAG_FONT("header_title", bold_font_desc);
+                       pango_font_description_free(bold_font_desc);
+               }
+       }
+
        if (prefs_common.textfont) {
-               PangoFontDescription *font_desc = NULL;
+               PangoFontDescription *font_desc;
 
                font_desc = pango_font_description_from_string
                                                (prefs_common.textfont);
@@ -1957,6 +1986,7 @@ static void open_image_cb (TextView *textview, guint action, void *data)
        const gchar *def_cmd;
        const gchar *p;
        gchar *filename = NULL;
+       gchar *tmp_filename = NULL;
 
        if (uri == NULL)
                return;
@@ -1974,6 +2004,10 @@ static void open_image_cb (TextView *textview, guint action, void *data)
 
        subst_for_filename(filename);
 
+       tmp_filename = g_filename_from_uri(uri->uri, NULL, NULL);
+       copy_file(tmp_filename, filename, FALSE);
+       g_free(tmp_filename);
+
        cmd = prefs_common.mime_image_viewer;
        def_cmd = default_cmdline;