2007-12-18 [wwp] 3.2.0cvs4
authorTristan Chabredier <wwp@claws-mail.org>
Tue, 18 Dec 2007 08:20:55 +0000 (08:20 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Tue, 18 Dec 2007 08:20:55 +0000 (08:20 +0000)
* src/folderview.c
* src/headerview.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_fonts.c
* src/summaryview.c
* src/textview.c
* src/wizard.c
* src/common/defs.h
* src/gtk/gtkutils.c
Added prefs to set custom small and bold fonts
(might matter on some desktops, according to
DPI and font settings).

13 files changed:
ChangeLog
PATCHSETS
configure.ac
src/common/defs.h
src/folderview.c
src/gtk/gtkutils.c
src/headerview.c
src/prefs_common.c
src/prefs_common.h
src/prefs_fonts.c
src/summaryview.c
src/textview.c
src/wizard.c

index cc78fc0..3500623 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2007-12-18 [wwp]       3.2.0cvs4
+
+       * src/folderview.c
+       * src/headerview.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/prefs_fonts.c
+       * src/summaryview.c
+       * src/textview.c
+       * src/wizard.c
+       * src/common/defs.h
+       * src/gtk/gtkutils.c
+               Added prefs to set custom small and bold fonts
+               (might matter on some desktops, according to
+               DPI and font settings).
+
 2007-12-18 [colin]     3.2.0cvs3
 
        * src/prefs_logging.c
index 7d286b8..0c0b31e 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.14.2.46 -r 1.14.2.47 src/editaddress.c;  ) > 3.2.0cvs1.patchset
 ( cvs diff -u -r 1.1.4.45 -r 1.1.4.46 src/prefs_filtering_action.c;  ) > 3.2.0cvs2.patchset
 ( cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/prefs_logging.c;  ) > 3.2.0cvs3.patchset
+( cvs diff -u -r 1.207.2.193 -r 1.207.2.194 src/folderview.c;  cvs diff -u -r 1.8.2.26 -r 1.8.2.27 src/headerview.c;  cvs diff -u -r 1.204.2.158 -r 1.204.2.159 src/prefs_common.c;  cvs diff -u -r 1.103.2.102 -r 1.103.2.103 src/prefs_common.h;  cvs diff -u -r 1.4.2.21 -r 1.4.2.22 src/prefs_fonts.c;  cvs diff -u -r 1.395.2.345 -r 1.395.2.346 src/summaryview.c;  cvs diff -u -r 1.96.2.193 -r 1.96.2.194 src/textview.c;  cvs diff -u -r 1.1.2.64 -r 1.1.2.65 src/wizard.c;  cvs diff -u -r 1.9.2.44 -r 1.9.2.45 src/common/defs.h;  cvs diff -u -r 1.5.2.74 -r 1.5.2.75 src/gtk/gtkutils.c;  ) > 3.2.0cvs4.patchset
index f6b44c1..e421629 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=2
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=3
+EXTRA_VERSION=4
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 814b91f..d512d77 100644 (file)
 #define SESSION_TIMEOUT_INTERVAL       60      /* sec */
 #define MAX_HISTORY_SIZE               32
 
+#define BOLD_FONT prefs_common.boldfont
 #define NORMAL_FONT prefs_common.normalfont
 #define SMALL_FONT     prefs_common.smallfont
 
index c7400d8..98eaa23 100644 (file)
@@ -736,8 +736,19 @@ void folderview_init(FolderView *folderview)
        if (!bold_style) {
                gtkut_convert_int_to_gdk_color(prefs_common.color_new, &gdk_color);
                bold_style = gtk_style_copy(gtk_widget_get_style(ctree));
-               pango_font_description_set_weight
-                       (bold_style->font_desc, PANGO_WEIGHT_BOLD);
+               if (prefs_common.derive_from_normal_font || !BOLD_FONT) {
+                       pango_font_description_set_weight
+                               (bold_style->font_desc, PANGO_WEIGHT_BOLD);
+               } else {
+                       PangoFontDescription *font_desc;
+                       font_desc = pango_font_description_from_string(BOLD_FONT);
+                       if (font_desc) {
+                               if (bold_style->font_desc)
+                                       pango_font_description_free
+                                               (bold_style->font_desc);
+                               bold_style->font_desc = font_desc;
+                       }
+               }
                bold_color_style = gtk_style_copy(bold_style);
                bold_color_style->fg[GTK_STATE_NORMAL] = gdk_color;
 
@@ -2678,29 +2689,40 @@ void folderview_set_target_folder_color(gint color_op)
        }
 }
 
-static gchar *last_font = NULL;
+static gchar *last_smallfont = NULL;
+static gchar *last_normalfont = NULL;
+static gchar *last_boldfont = NULL;
 void folderview_reflect_prefs_pixmap_theme(FolderView *folderview)
 {
        /* force reinit */
-       g_free(last_font);
-       last_font = NULL;
-       
+       g_free(last_smallfont);
+       last_smallfont = NULL;
+       g_free(last_normalfont);
+       last_normalfont = NULL;
+       g_free(last_boldfont);
+       last_boldfont = NULL;
 }
 
 void folderview_reflect_prefs(void)
 {
-       gboolean update_font = TRUE;
+       gboolean update_font = FALSE;
        FolderView *folderview = mainwindow_get_mainwindow()->folderview;
        FolderItem *item = folderview_get_selected_item(folderview);
        GtkAdjustment *pos = gtk_scrolled_window_get_vadjustment(
                                GTK_SCROLLED_WINDOW(folderview->scrolledwin));
        gint height = pos->value;
 
-       if (last_font && !strcmp(last_font, NORMAL_FONT))
-               update_font = FALSE;
-
-       g_free(last_font);
-       last_font = g_strdup(NORMAL_FONT);
+       if (!last_smallfont || strcmp(last_smallfont, SMALL_FONT) ||
+                       !last_normalfont || strcmp(last_normalfont, NORMAL_FONT) ||
+                       !last_boldfont || strcmp(last_boldfont, BOLD_FONT))
+               update_font = TRUE;
+
+       g_free(last_smallfont);
+       last_smallfont = g_strdup(SMALL_FONT);
+       g_free(last_normalfont);
+       last_normalfont = g_strdup(NORMAL_FONT);
+       g_free(last_boldfont);
+       last_boldfont = g_strdup(BOLD_FONT);
 
        if (update_font) {              
                normal_style = normal_color_style = bold_style = 
index 7348ad4..2cf68ed 100644 (file)
@@ -91,11 +91,17 @@ void gtkut_widget_set_small_font_size(GtkWidget *widget)
        g_return_if_fail(widget != NULL);
        g_return_if_fail(widget->style != NULL);
 
-       font_desc = pango_font_description_from_string(NORMAL_FONT);
-       size = pango_font_description_get_size(font_desc);
-       pango_font_description_set_size(font_desc, size * PANGO_SCALE_SMALL);
-       gtk_widget_modify_font(widget, font_desc);
-       pango_font_description_free(font_desc);
+       if (prefs_common.derive_from_normal_font || !SMALL_FONT) {
+               font_desc = pango_font_description_from_string(NORMAL_FONT);
+               size = pango_font_description_get_size(font_desc);
+               pango_font_description_set_size(font_desc, size * PANGO_SCALE_SMALL);
+               gtk_widget_modify_font(widget, font_desc);
+               pango_font_description_free(font_desc);
+       } else {
+               font_desc = pango_font_description_from_string(SMALL_FONT);
+               gtk_widget_modify_font(widget, font_desc);
+               pango_font_description_free(font_desc);
+       }
 }
 
 void gtkut_convert_int_to_gdk_color(gint rgbvalue, GdkColor *color)
index dcf9a3b..2945472 100644 (file)
@@ -167,12 +167,22 @@ void headerview_set_font(HeaderView *headerview)
        PangoFontDescription *boldfont = NULL;
        PangoFontDescription *normalfont = NULL;
        
-       if (!boldfont) {
-               normalfont = pango_font_description_from_string(NORMAL_FONT);
+       normalfont = pango_font_description_from_string(NORMAL_FONT);
+       if (normalfont) {
+               gtk_widget_modify_font(headerview->from_body_label, normalfont);
+               gtk_widget_modify_font(headerview->to_body_label, normalfont);
+               gtk_widget_modify_font(headerview->ng_body_label, normalfont);
+               gtk_widget_modify_font(headerview->subject_body_label, normalfont);
+               gtk_widget_modify_font(headerview->tags_body_label, normalfont);
+               pango_font_description_free(normalfont);
+       }
+
+       if (prefs_common.derive_from_normal_font || !BOLD_FONT) {
                boldfont = pango_font_description_from_string(NORMAL_FONT);
                pango_font_description_set_weight(boldfont, PANGO_WEIGHT_BOLD);
+       } else {
+               boldfont = pango_font_description_from_string(BOLD_FONT);
        }
-
        if (boldfont) {
                gtk_widget_modify_font(headerview->from_header_label, boldfont);
                gtk_widget_modify_font(headerview->to_header_label, boldfont);
@@ -180,13 +190,6 @@ void headerview_set_font(HeaderView *headerview)
                gtk_widget_modify_font(headerview->subject_header_label, boldfont);
                gtk_widget_modify_font(headerview->tags_header_label, boldfont);
                pango_font_description_free(boldfont);
-
-               gtk_widget_modify_font(headerview->from_body_label, normalfont);
-               gtk_widget_modify_font(headerview->to_body_label, normalfont);
-               gtk_widget_modify_font(headerview->ng_body_label, normalfont);
-               gtk_widget_modify_font(headerview->subject_body_label, normalfont);
-               gtk_widget_modify_font(headerview->tags_body_label, normalfont);
-               pango_font_description_free(normalfont);
        }
 }
 
index 9ff0d4b..3d9ee51 100644 (file)
@@ -102,6 +102,8 @@ static PrefParam param_os_specific[] = {
          &prefs_common.smallfont,              P_STRING, NULL, NULL, NULL},
        {"normal_font_gtk2",    "Sans 9",
          &prefs_common.normalfont,             P_STRING, NULL, NULL, NULL},
+       {"bold_font_gtk2",      "Sans 9 Bold",
+         &prefs_common.boldfont,               P_STRING, NULL, NULL, NULL},
        /* Message */
        {"attach_save_directory", NULL,
         &prefs_common.attach_save_dir, P_STRING, NULL, NULL, NULL},
@@ -324,6 +326,8 @@ static PrefParam param[] = {
          &SPECIFIC_PREFS.smallfont,            P_STRING, NULL, NULL, NULL},
        {"normal_font_gtk2",    "Sans 9",
          &SPECIFIC_PREFS.normalfont,           P_STRING, NULL, NULL, NULL},
+       {"bold_font_gtk2",      "Sans Bold 9",
+         &SPECIFIC_PREFS.boldfont,             P_STRING, NULL, NULL, NULL},
 #else
        {"widget_font_gtk2",    NULL,
          &SPECIFIC_PREFS.widgetfont,           P_STRING, NULL, NULL, NULL},
@@ -335,7 +339,15 @@ static PrefParam param[] = {
          &SPECIFIC_PREFS.smallfont,            P_STRING, NULL, NULL, NULL},
        {"normal_font_gtk2",    "Sans 8",
          &SPECIFIC_PREFS.normalfont,           P_STRING, NULL, NULL, NULL},
+       {"bold_font_gtk2",      "Sans Bold 8",
+         &SPECIFIC_PREFS.boldfont,             P_STRING, NULL, NULL, NULL},
 #endif
+
+       {"use_different_print_font", "FALSE", &prefs_common.use_different_print_font, P_BOOL,
+        NULL, NULL, NULL},
+       {"derive_from_normal_font", "TRUE", &prefs_common.derive_from_normal_font, P_BOOL,
+        NULL, NULL, NULL},
+
        /* custom colors */
        {"custom_color1", "#ff9900", &prefs_common.custom_colorlabel[0].color, P_COLOR,
         NULL, NULL, NULL},
@@ -710,9 +722,6 @@ static PrefParam param[] = {
        {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
         NULL, NULL, NULL},
 
-       {"use_different_print_font", "FALSE", &prefs_common.use_different_print_font, P_BOOL,
-        NULL, NULL, NULL},
-
        {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
         NULL, NULL, NULL},
        {"attach_save_directory", NULL,
index 819138b..ea61a41 100644 (file)
@@ -181,10 +181,13 @@ struct _PrefsCommon
        /* new fonts */
        gchar *widgetfont;
        gchar *textfont;
-        gchar *printfont;
+       gchar *printfont;
+       gchar *boldfont;
        gchar *normalfont;
        gchar *smallfont;
        gchar *titlefont;
+       gboolean use_different_print_font;
+       gboolean derive_from_normal_font;
 
        /* custom colors */
        ColorlabelPrefs custom_colorlabel[COLORLABELS];
@@ -306,7 +309,6 @@ struct _PrefsCommon
        gboolean respect_flowed_format;
 
        gboolean show_other_header;
-       gboolean use_different_print_font;
        GSList *disphdr_list;
 
        gboolean attach_desc;
index 573671d..db606b6 100644 (file)
@@ -42,8 +42,11 @@ typedef struct _FontsPage
 
        GtkWidget *window;              /* do not modify */
 
-       GtkWidget *entry_folderviewfont;
+       GtkWidget *entry_folderview_smallfont;
+       GtkWidget *entry_folderview_normalfont;
+       GtkWidget *entry_folderview_boldfont;
        GtkWidget *entry_messageviewfont;
+       GtkWidget *derive_from_normalfont_checkbutton;
 #if defined(USE_GNOMEPRINT) || GTK_CHECK_VERSION(2,10,0)
        GtkWidget *print_checkbutton;
        GtkWidget *entry_messageprintfont;
@@ -56,69 +59,141 @@ static void prefs_fonts_create_widget(PrefsPage *_page, GtkWindow *window,
        FontsPage *prefs_fonts = (FontsPage *) _page;
 
        GtkWidget *table;
-       GtkWidget *entry_folderviewfont;
+       GtkWidget *entry_folderview_smallfont;
+       GtkWidget *entry_folderview_normalfont;
+       GtkWidget *entry_folderview_boldfont;
        GtkWidget *entry_messageviewfont;
        GtkWidget *tmplabel;
 #if defined(USE_GNOMEPRINT) || GTK_CHECK_VERSION(2,10,0)
        GtkWidget *entry_messageprintfont;
        GtkWidget *print_checkbutton;
 #endif
+       GtkWidget *derive_from_normalfont_checkbutton;
        GtkWidget *vbox;
+       gint      row = 0;
 
-       table = gtk_table_new(7, 2, FALSE);
+       table = gtk_table_new(10, 2, FALSE);
        gtk_widget_show(table);
        gtk_container_set_border_width(GTK_CONTAINER(table), VBOX_BORDER);
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
 
+       /* normal font label */
        tmplabel = gtk_label_new (_("Folder and Message Lists"));
        gtk_widget_show (tmplabel);
-       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, 0, 1,
+       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, row, row+1,
                         (GtkAttachOptions) GTK_FILL,
                         (GtkAttachOptions) (0), 0, 0);
        gtk_label_set_justify(GTK_LABEL(tmplabel), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment(GTK_MISC(tmplabel), 1, 0.5);
 
-       entry_folderviewfont = gtk_font_button_new_with_font (prefs_common.normalfont);
-       g_object_set(G_OBJECT(entry_folderviewfont), 
+       /* normal font button */
+       entry_folderview_normalfont = gtk_font_button_new_with_font (prefs_common.normalfont);
+       g_object_set(G_OBJECT(entry_folderview_normalfont), 
                              "use-font", TRUE, 
                              NULL);
-       gtk_widget_show (entry_folderviewfont);
-       gtk_table_attach (GTK_TABLE (table), entry_folderviewfont, 1, 2, 0, 1,
+       gtk_widget_show (entry_folderview_normalfont);
+       gtk_table_attach (GTK_TABLE (table), entry_folderview_normalfont, 1, 2, row, row+1,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
+       row++;
 
+       /* message font label */
        tmplabel = gtk_label_new (_("Message"));
        gtk_widget_show (tmplabel);
-       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, 2, 3,
+       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, row, row+1,
                         (GtkAttachOptions) GTK_FILL,
                         (GtkAttachOptions) (0), 0, 0);
        gtk_label_set_justify(GTK_LABEL(tmplabel), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment(GTK_MISC(tmplabel), 1, 0.5);
 
+       /* message font button */
        entry_messageviewfont = gtk_font_button_new_with_font (prefs_common.textfont);
        g_object_set(G_OBJECT(entry_messageviewfont), 
                              "use-font", TRUE, 
                              NULL);
        gtk_widget_show (entry_messageviewfont);
-       gtk_table_attach (GTK_TABLE (table), entry_messageviewfont, 1, 2, 2, 3,
+       gtk_table_attach (GTK_TABLE (table), entry_messageviewfont, 1, 2, row, row+1,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
+       row++;
+
+       vbox = gtk_vbox_new(FALSE, VSPACING_NARROW);
+       gtk_widget_show(vbox);
+       gtk_table_attach (GTK_TABLE (table), vbox, 0, 4, row, row+1,
+                        (GtkAttachOptions) GTK_FILL,
+                        (GtkAttachOptions) (0), 0, 0);
+       row++;
+       
+       /* derive from normal font check button */
+       derive_from_normalfont_checkbutton = gtk_check_button_new_with_label(_("Derive small and bold fonts from Folder and Message Lists font"));
+       gtk_widget_show(derive_from_normalfont_checkbutton);
+       gtk_table_attach (GTK_TABLE (table), derive_from_normalfont_checkbutton, 0, 2, row, row+1,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(derive_from_normalfont_checkbutton),
+                prefs_common.derive_from_normal_font);
+       row++;
+
+       /* small font label */
+       tmplabel = gtk_label_new (_("Small"));
+       gtk_widget_show (tmplabel);
+       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, row, row+1,
+                        (GtkAttachOptions) GTK_FILL,
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_label_set_justify(GTK_LABEL(tmplabel), GTK_JUSTIFY_RIGHT);
+       gtk_misc_set_alignment(GTK_MISC(tmplabel), 1, 0.5);
+       SET_TOGGLE_SENSITIVITY_REVERSE (derive_from_normalfont_checkbutton, tmplabel);
+
+       /* small font button */
+       entry_folderview_smallfont = gtk_font_button_new_with_font (prefs_common.smallfont);
+       g_object_set(G_OBJECT(entry_folderview_smallfont), 
+                             "use-font", TRUE, 
+                             NULL);
+       gtk_widget_show (entry_folderview_smallfont);
+       gtk_table_attach (GTK_TABLE (table), entry_folderview_smallfont, 1, 2, row, row+1,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       SET_TOGGLE_SENSITIVITY_REVERSE (derive_from_normalfont_checkbutton, entry_folderview_smallfont);
+       row++;
+
+       /* bold font label */
+       tmplabel = gtk_label_new (_("Bold"));
+       gtk_widget_show (tmplabel);
+       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, row, row+1,
+                        (GtkAttachOptions) GTK_FILL,
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_label_set_justify(GTK_LABEL(tmplabel), GTK_JUSTIFY_RIGHT);
+       gtk_misc_set_alignment(GTK_MISC(tmplabel), 1, 0.5);
+       SET_TOGGLE_SENSITIVITY_REVERSE (derive_from_normalfont_checkbutton, tmplabel);
+
+       /* bold font button */
+       entry_folderview_boldfont = gtk_font_button_new_with_font (prefs_common.boldfont);
+       g_object_set(G_OBJECT(entry_folderview_boldfont), 
+                             "use-font", TRUE, 
+                             NULL);
+       gtk_widget_show (entry_folderview_boldfont);
+       gtk_table_attach (GTK_TABLE (table), entry_folderview_boldfont, 1, 2, row, row+1,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       SET_TOGGLE_SENSITIVITY_REVERSE (derive_from_normalfont_checkbutton, entry_folderview_boldfont);
+       row++;
 
 #if defined(USE_GNOMEPRINT) || GTK_CHECK_VERSION(2,10,0)
        /* print check button */
        print_checkbutton = gtk_check_button_new_with_label(_("Use different font for printing"));
        gtk_widget_show(print_checkbutton);
-       gtk_table_attach (GTK_TABLE (table), print_checkbutton, 0, 2, 4, 5,
+       gtk_table_attach (GTK_TABLE (table), print_checkbutton, 0, 2, row, row+1,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(print_checkbutton),
                 prefs_common.use_different_print_font);
+       row++;
 
        /* print font label */
        tmplabel = gtk_label_new (_("Message Printing"));
        gtk_widget_show (tmplabel);
-       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, 6, 7,
+       gtk_table_attach (GTK_TABLE (table), tmplabel, 0, 1, row, row+1,
                         (GtkAttachOptions) GTK_FILL,
                         (GtkAttachOptions) (0), 0, 0);
        gtk_label_set_justify(GTK_LABEL(tmplabel), GTK_JUSTIFY_RIGHT);
@@ -131,21 +206,19 @@ static void prefs_fonts_create_widget(PrefsPage *_page, GtkWindow *window,
                              "use-font", TRUE, 
                              NULL);
        gtk_widget_show (entry_messageprintfont);
-       gtk_table_attach (GTK_TABLE (table), entry_messageprintfont, 1, 2, 6, 7,
+       gtk_table_attach (GTK_TABLE (table), entry_messageprintfont, 1, 2, row, row+1,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        SET_TOGGLE_SENSITIVITY (print_checkbutton, entry_messageprintfont);
+       row++;
 #endif
 
-       vbox = gtk_vbox_new(FALSE, VSPACING_NARROW);
-       gtk_widget_show(vbox);
-       gtk_table_attach (GTK_TABLE (table), vbox, 0, 4, 4, 5,
-                        (GtkAttachOptions) GTK_FILL,
-                        (GtkAttachOptions) (0), 0, 0);
-       
        prefs_fonts->window                     = GTK_WIDGET(window);
-       prefs_fonts->entry_folderviewfont       = entry_folderviewfont;
+       prefs_fonts->entry_folderview_smallfont = entry_folderview_smallfont;
+       prefs_fonts->entry_folderview_normalfont = entry_folderview_normalfont;
+       prefs_fonts->entry_folderview_boldfont   = entry_folderview_boldfont;
        prefs_fonts->entry_messageviewfont      = entry_messageviewfont;
+       prefs_fonts->derive_from_normalfont_checkbutton = derive_from_normalfont_checkbutton;
 #if defined(USE_GNOMEPRINT) || GTK_CHECK_VERSION(2,10,0)
        prefs_fonts->entry_messageprintfont     = entry_messageprintfont;
        prefs_fonts->print_checkbutton          = print_checkbutton;
@@ -158,18 +231,25 @@ static void prefs_fonts_save(PrefsPage *_page)
 {
        FontsPage *fonts = (FontsPage *) _page;
 
+       g_free(prefs_common.boldfont);
+       prefs_common.boldfont = g_strdup(gtk_font_button_get_font_name
+               (GTK_FONT_BUTTON(fonts->entry_folderview_boldfont)));
+
        g_free(prefs_common.normalfont);
        prefs_common.normalfont = g_strdup(gtk_font_button_get_font_name
-               (GTK_FONT_BUTTON(fonts->entry_folderviewfont)));
+               (GTK_FONT_BUTTON(fonts->entry_folderview_normalfont)));
                
        g_free(prefs_common.smallfont);         
        prefs_common.smallfont  = g_strdup(gtk_font_button_get_font_name
-               (GTK_FONT_BUTTON(fonts->entry_folderviewfont)));
+               (GTK_FONT_BUTTON(fonts->entry_folderview_smallfont)));
 
        g_free(prefs_common.textfont);          
        prefs_common.textfont   = g_strdup(gtk_font_button_get_font_name
                (GTK_FONT_BUTTON(fonts->entry_messageviewfont)));
 
+       prefs_common.derive_from_normal_font = gtk_toggle_button_get_active
+                       (GTK_TOGGLE_BUTTON(fonts->derive_from_normalfont_checkbutton));
+
 #if defined(USE_GNOMEPRINT) || GTK_CHECK_VERSION(2,10,0)
        g_free(prefs_common.printfont);         
        prefs_common.printfont   = g_strdup(gtk_font_button_get_font_name
index 21855ab..d1536a1 100644 (file)
@@ -863,20 +863,30 @@ static void summary_set_fonts(SummaryView *summaryview)
        gint size;
 
        font_desc = pango_font_description_from_string(NORMAL_FONT);
-       gtk_widget_modify_font(summaryview->ctree, font_desc);
-       pango_font_description_free(font_desc);
+       if (font_desc) {
+               gtk_widget_modify_font(summaryview->ctree, font_desc);
+               pango_font_description_free(font_desc);
+       }
 
        if (!bold_style) {
                bold_style = gtk_style_copy
                        (gtk_widget_get_style(summaryview->ctree));
-               font_desc = pango_font_description_from_string(NORMAL_FONT);
-               if (font_desc) {
-                       pango_font_description_free(bold_style->font_desc);
-                       bold_style->font_desc = font_desc;
+
+               if (prefs_common.derive_from_normal_font || !BOLD_FONT) {
+                       font_desc = pango_font_description_from_string(NORMAL_FONT);
+                       if (font_desc) {
+                               pango_font_description_free(bold_style->font_desc);
+                               bold_style->font_desc = font_desc;
+                       }
+                       pango_font_description_set_weight
+                                       (bold_style->font_desc, PANGO_WEIGHT_BOLD);
+               } else {
+                       font_desc = pango_font_description_from_string(BOLD_FONT);
+                       if (font_desc) {
+                               pango_font_description_free(bold_style->font_desc);
+                               bold_style->font_desc = font_desc;
+                       }
                }
-               
-               pango_font_description_set_weight
-                               (bold_style->font_desc, PANGO_WEIGHT_BOLD);
                bold_marked_style = gtk_style_copy(bold_style);
                bold_marked_style->fg[GTK_STATE_NORMAL] =
                        summaryview->color_marked;
@@ -885,15 +895,21 @@ static void summary_set_fonts(SummaryView *summaryview)
                        summaryview->color_dim;
        }
 
-       font_desc = pango_font_description_new();
-       size = pango_font_description_get_size
-               (summaryview->ctree->style->font_desc);
-       pango_font_description_set_size(font_desc, size * PANGO_SCALE_SMALL);
-       gtk_widget_modify_font(summaryview->statlabel_folder, font_desc);
-       gtk_widget_modify_font(summaryview->statlabel_select, font_desc);
-       gtk_widget_modify_font(summaryview->statlabel_msgs, font_desc);
-       /* ici */
-       pango_font_description_free(font_desc);
+       if (prefs_common.derive_from_normal_font || !SMALL_FONT) {
+               font_desc = pango_font_description_new();
+               size = pango_font_description_get_size
+                       (summaryview->ctree->style->font_desc);
+               pango_font_description_set_size(font_desc, size * PANGO_SCALE_SMALL);
+       } else {
+               font_desc = pango_font_description_from_string(SMALL_FONT);
+       }
+       if (font_desc) {
+               gtk_widget_modify_font(summaryview->statlabel_folder, font_desc);
+               gtk_widget_modify_font(summaryview->statlabel_select, font_desc);
+               gtk_widget_modify_font(summaryview->statlabel_msgs, font_desc);
+               pango_font_description_free(font_desc);
+       }
+
 }
 
 static void summary_set_folder_pixmap(SummaryView *summaryview, StockPixmap icon)
@@ -2660,20 +2676,27 @@ void summary_reflect_tags_changes(SummaryView *summaryview)
 
 void summary_reflect_prefs(void)
 {
-       static gchar *last_font = NULL;
-       gboolean update_font = TRUE;
+       static gchar *last_smallfont = NULL;
+       static gchar *last_normalfont = NULL;
+       static gchar *last_boldfont = NULL;
+       gboolean update_font = FALSE;
        SummaryView *summaryview = NULL;
 
        if (!mainwindow_get_mainwindow())
                return;
        summaryview = mainwindow_get_mainwindow()->summaryview;
 
-       if (last_font && !strcmp(last_font, NORMAL_FONT))
-               update_font = FALSE;
-
-       g_free(last_font);
-       
-       last_font = g_strdup(NORMAL_FONT);
+       if (!last_smallfont || strcmp(last_smallfont, SMALL_FONT) ||
+                       !last_normalfont || strcmp(last_normalfont, NORMAL_FONT) ||
+                       !last_boldfont || strcmp(last_boldfont, BOLD_FONT))
+               update_font = TRUE;
+
+       g_free(last_smallfont);
+       last_smallfont = g_strdup(SMALL_FONT);
+       g_free(last_normalfont);
+       last_normalfont = g_strdup(NORMAL_FONT);
+       g_free(last_boldfont);
+       last_boldfont = g_strdup(BOLD_FONT);
 
        if (update_font) {      
                bold_style = bold_marked_style = bold_deleted_style = 
index 4cb919f..07403b7 100644 (file)
@@ -378,10 +378,15 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
                        (NORMAL_FONT);
 
        if (!bold_font_desc) {
-               bold_font_desc = pango_font_description_from_string
-                       (NORMAL_FONT);
-               pango_font_description_set_weight
-                       (bold_font_desc, PANGO_WEIGHT_BOLD);
+               if (prefs_common.derive_from_normal_font || !BOLD_FONT) {
+                       bold_font_desc = pango_font_description_from_string
+                               (NORMAL_FONT);
+                       pango_font_description_set_weight
+                               (bold_font_desc, PANGO_WEIGHT_BOLD);
+               } else {
+                       bold_font_desc = pango_font_description_from_string
+                               (BOLD_FONT);
+               }
        }
 
        buffer = gtk_text_view_get_buffer(text);
@@ -462,6 +467,10 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
                          G_CALLBACK(textview_uri_button_pressed), textview);
        g_signal_connect(G_OBJECT(tag), "event",
                          G_CALLBACK(textview_uri_button_pressed), textview);
+/*     if (font_desc)
+               pango_font_description_free(font_desc);
+       if (bold_font_desc)
+               pango_font_description_free(bold_font_desc);*/
  }
 
 void textview_init(TextView *textview)
@@ -1615,25 +1624,29 @@ 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);
+       PangoFontDescription *font_desc, *bold_font_desc;
+
+       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);
+               CHANGE_TAG_FONT("hlink", font_desc);
+               pango_font_description_free(font_desc);
+       }
+       if (prefs_common.derive_from_normal_font || !BOLD_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);
-                       CHANGE_TAG_FONT("hlink", font_desc);
-                       pango_font_description_free(font_desc);
-               }
-               if (bold_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);
-               }
+       } else {
+               bold_font_desc = pango_font_description_from_string
+                                               (BOLD_FONT);
+       }
+       if (bold_font_desc) {
+               CHANGE_TAG_FONT("header_title", bold_font_desc);
+               pango_font_description_free(bold_font_desc);
        }
 
        if (prefs_common.textfont) {
index e416720..f87d0fd 100644 (file)
@@ -452,6 +452,15 @@ static void initialize_fonts(WizardWindow *wizard)
                prefs_common.normalfont = new;
        }
        g_free(tmp);
+
+       tmp = g_strdup(prefs_common.boldfont);
+       if (strrchr(tmp, ' ')) {
+               *(strrchr(tmp, ' ')) = '\0';
+               new = g_strdup_printf("%s %d", tmp, size);
+               g_free(prefs_common.boldfont);
+               prefs_common.boldfont = new;
+       }
+       g_free(tmp);
 }
 
 #define XFACE "+}Axz@~a,-Yx?0Ysa|q}CLRH=89Y]\"')DSX^<6p\"d)'81yx5%G#u^o*7JG&[aPU0h1Ux.vb2yIjH83{5`/bVo|~nn/i83vE^E)qk-4W)_E.4Y=D*qvf/,Ci_=P<iY<M6"