[Commits] [SCM] claws branch, master, updated. 3.16.0-27-gc10fc9f

mones at claws-mail.org mones at claws-mail.org
Mon Feb 5 21:18:25 CET 2018


The branch, master has been updated
       via  c10fc9f7b7e6e45a80adb4083d5aafa61d415380 (commit)
       via  8363e45874756e3aeb1fed74bcd60206b5cfe2a7 (commit)
      from  6f04970280311f128df2098cd949ab5adb77dae4 (commit)

Summary of changes:
 src/compose.c                     |   22 +-
 src/foldersel.c                   |    2 +-
 src/folderview.c                  |    4 +-
 src/gtk/about.c                   |    4 +-
 src/gtk/gtkutils.c                |    4 +-
 src/gtk/logwindow.c               |   16 +-
 src/gtk/quicksearch.c             |    8 +-
 src/gtk/spell_entry.c             |    8 +-
 src/mainwindow.c                  |    4 +-
 src/plugins/vcalendar/vcalendar.c |    2 +-
 src/prefs_common.c                |  124 +++++------
 src/prefs_common.h                |   74 ++++---
 src/prefs_msg_colors.c            |  413 ++++++++++++++-----------------------
 src/prefs_spelling.c              |    4 +-
 src/textview.c                    |   28 +--
 15 files changed, 312 insertions(+), 405 deletions(-)


- Log -----------------------------------------------------------------
commit c10fc9f7b7e6e45a80adb4083d5aafa61d415380
Author: Ricardo Mones <ricardo at mones.org>
Date:   Mon Feb 5 21:15:42 2018 +0100

    Refactor colors handling with more arrays
    
    This also makes possible to add more colors easily.

diff --git a/src/prefs_msg_colors.c b/src/prefs_msg_colors.c
index 4d6223e..10c94d9 100644
--- a/src/prefs_msg_colors.c
+++ b/src/prefs_msg_colors.c
@@ -45,16 +45,8 @@
 	(str) ? (str) : ""
 
 static struct MessageColorButtons {
-	GtkWidget *btn_quote_level1;
-	GtkWidget *btn_quote_level2;
-	GtkWidget *btn_quote_level3;
-	GtkWidget *btn_quote_level1_bg;
-	GtkWidget *btn_quote_level2_bg;
-	GtkWidget *btn_quote_level3_bg;
-	GtkWidget *btn_uri;
-	GtkWidget *btn_tgt_folder;
-	GtkWidget *btn_signature;
-	GtkWidget *btn_color_new;
+	/* program colors */
+	GtkWidget *color[COL_LAST_COLOR_INDEX];
 	/* custom colors */
 	GtkWidget *custom_color[COLORLABELS];
 } color_buttons;
@@ -74,6 +66,8 @@ typedef struct _MsgColorsPage
 } MsgColorsPage;
 
 static GtkWidget *color_dialog;
+static const gchar *color_dialog_title[COL_LAST_COLOR_INDEX];
+static gboolean color_dialog_title_init = FALSE;
 
 static void quote_color_set_dialog		(GtkWidget	*widget,
 						 gpointer	 data);
@@ -89,6 +83,28 @@ static void set_button_bg_color			(GtkWidget	*widget,
 static void prefs_msg_colors_reset_custom_colors(GtkWidget *widget,
 						 gpointer	 data);
 
+#define COLOR_BUTTON_PACK_START(gtkbox, colorid, tooltiptext) \
+	color_buttons.color[colorid] = gtk_button_new_with_label ("\x20\xE2\x80\x83\x20"); \
+	gtk_widget_show (color_buttons.color[colorid]); \
+	gtk_box_pack_start (GTK_BOX(gtkbox), color_buttons.color[colorid], FALSE, FALSE, 0); \
+	gtk_widget_set_tooltip_text (GTK_WIDGET(color_buttons.color[colorid]), tooltiptext)
+
+#define COLOR_BUTTON_PACK_END(gtkbox, colorid, tooltiptext) \
+	color_buttons.color[colorid] = gtk_button_new_with_label ("\x20\xE2\x80\x83\x20"); \
+	gtk_widget_show (color_buttons.color[colorid]); \
+	gtk_box_pack_end (GTK_BOX(gtkbox), color_buttons.color[colorid], FALSE, FALSE, 0); \
+	gtk_widget_set_tooltip_text (GTK_WIDGET(color_buttons.color[colorid]), tooltiptext)
+
+#define COLOR_LABEL_PACK_START(gtkbox, colorid, labeltext) \
+	label[colorid] = gtk_label_new (labeltext); \
+	gtk_widget_show (label[colorid]); \
+	gtk_box_pack_start (GTK_BOX(gtkbox), label[colorid], FALSE, FALSE, 0)
+
+#define COLOR_LABEL_PACK_END(gtkbox, colorid, labeltext) \
+	label[colorid] = gtk_label_new (labeltext); \
+	gtk_widget_show (label[colorid]); \
+	gtk_box_pack_end (GTK_BOX(gtkbox), label[colorid], FALSE, FALSE, 0)
+
 static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window, 
 			       	    gpointer data)
 {
@@ -101,19 +117,10 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkWidget *label_quote_level1;
 	GtkWidget *label_quote_level2;
 	GtkWidget *label_quote_level3;
-	GtkWidget *label_quote_color1;
-	GtkWidget *label_quote_color2;
-	GtkWidget *label_quote_color3;
 	GtkWidget *checkbtn_enable_bgcolors;
-	GtkWidget *label_quote_bgcolor1;
-	GtkWidget *label_quote_bgcolor2;
-	GtkWidget *label_quote_bgcolor3;
-	GtkWidget *lable_uri;
-	GtkWidget *label_signature;
-	GtkWidget *label_tgt_folder;
 	GtkWidget *checkbtn_recycle_colors;
 	GtkWidget *hbox;
-	GtkWidget *label_color_new;
+	GtkWidget *label[COL_LAST_COLOR_INDEX];
 	GtkWidget *frame_msg;
 	GtkWidget *frame_folder;
 	GtkWidget *frame_quote;
@@ -160,7 +167,7 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	gtk_widget_show (vbox_quotebg);
 	vbox3 = gtkut_get_options_frame(vbox2, &frame_quote, _("Quote"));
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, frame_quote);
-	
+
 	gtk_box_pack_start (GTK_BOX (vbox3), hbox_quote, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (hbox_quote), vbox_quotefg, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (hbox_quote), vbox_quotebg, FALSE, TRUE, 0);
@@ -186,20 +193,13 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 			    FALSE, FALSE, 0);
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_quote_level1);
 
-	label_quote_color1 = gtk_label_new (_("Text"));
-	gtk_widget_show(label_quote_color1);
-  	gtk_box_pack_end (GTK_BOX(hbox), label_quote_color1, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_quote_color1);
-		
-	color_buttons.btn_quote_level1 = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_quote_level1);
-  	gtk_box_pack_end (GTK_BOX(hbox), color_buttons.btn_quote_level1, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, color_buttons.btn_quote_level1);
+	COLOR_LABEL_PACK_END(hbox, COL_QUOTE_LEVEL1, _("Text"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label[COL_QUOTE_LEVEL1]);
 
-	CLAWS_SET_TIP(color_buttons.btn_quote_level1,
-			     C_("Tooltip", "Pick color for 1st level text"));
+	COLOR_BUTTON_PACK_END(hbox, COL_QUOTE_LEVEL1,
+			      C_("Tooltip", "Pick color for 1st level text"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors,
+			       color_buttons.color[COL_QUOTE_LEVEL1]);
 
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
@@ -211,20 +211,13 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 			    FALSE, FALSE, 0);
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_quote_level2);
 
-	label_quote_color2 = gtk_label_new (_("Text"));
-	gtk_widget_show(label_quote_color2);
-  	gtk_box_pack_end (GTK_BOX(hbox), label_quote_color2, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_quote_color2);
-
-	color_buttons.btn_quote_level2 = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_quote_level2);
-  	gtk_box_pack_end (GTK_BOX(hbox), color_buttons.btn_quote_level2, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, color_buttons.btn_quote_level2);
+	COLOR_LABEL_PACK_END(hbox, COL_QUOTE_LEVEL2, _("Text"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label[COL_QUOTE_LEVEL2]);
 
-	CLAWS_SET_TIP(color_buttons.btn_quote_level2,
-			     C_("Tooltip", "Pick color for 2nd level text"));
+	COLOR_BUTTON_PACK_END(hbox, COL_QUOTE_LEVEL2,
+			      C_("Tooltip", "Pick color for 2nd level text"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors,
+			       color_buttons.color[COL_QUOTE_LEVEL2]);
 
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
@@ -236,20 +229,13 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 			    FALSE, FALSE, 0);
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_quote_level3);
 
-	label_quote_color3 = gtk_label_new (_("Text"));
-	gtk_widget_show(label_quote_color3);
-  	gtk_box_pack_end (GTK_BOX(hbox), label_quote_color3, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_quote_color3);
+	COLOR_LABEL_PACK_END(hbox, COL_QUOTE_LEVEL3, _("Text"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label[COL_QUOTE_LEVEL3]);
 
-	color_buttons.btn_quote_level3 = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_quote_level3);
-  	gtk_box_pack_end (GTK_BOX(hbox), color_buttons.btn_quote_level3, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, color_buttons.btn_quote_level3);
-
-	CLAWS_SET_TIP(color_buttons.btn_quote_level3,
-			     C_("Tooltip", "Pick color for 3rd level text"));
+	COLOR_BUTTON_PACK_END(hbox, COL_QUOTE_LEVEL3,
+			      C_("Tooltip", "Pick color for 3rd level text"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors,
+			       color_buttons.color[COL_QUOTE_LEVEL3]);
 
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
@@ -263,97 +249,64 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	gtk_widget_show (hbox);
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, hbox);
 	gtk_box_pack_start (GTK_BOX (vbox_quotebg), hbox, FALSE, TRUE, 0);
-	
-	color_buttons.btn_quote_level1_bg = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_quote_level1_bg);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_quote_level1_bg, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, color_buttons.btn_quote_level1_bg);
 
-	CLAWS_SET_TIP(color_buttons.btn_quote_level1_bg,
-			     C_("Tooltip", "Pick color for 1st level text background"));
+	COLOR_BUTTON_PACK_START(hbox, COL_QUOTE_LEVEL1_BG,
+				C_("Tooltip", "Pick color for 1st level text background"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors,
+			       color_buttons.color[COL_QUOTE_LEVEL1_BG]);
 
-	label_quote_bgcolor1 = gtk_label_new (_("Background"));
-	gtk_widget_show(label_quote_bgcolor1);
-  	gtk_box_pack_start (GTK_BOX(hbox), label_quote_bgcolor1, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, label_quote_bgcolor1);
+	COLOR_LABEL_PACK_START(hbox, COL_QUOTE_LEVEL1_BG, _("Background"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, label[COL_QUOTE_LEVEL1_BG]);
 
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, hbox);
 	gtk_box_pack_start (GTK_BOX (vbox_quotebg), hbox, FALSE, TRUE, 0);
-	
-	color_buttons.btn_quote_level2_bg = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_quote_level2_bg);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_quote_level2_bg, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, color_buttons.btn_quote_level2_bg);
 
-	CLAWS_SET_TIP(color_buttons.btn_quote_level2_bg,
-			     C_("Tooltip", "Pick color for 2nd level text background"));
+	COLOR_BUTTON_PACK_START(hbox, COL_QUOTE_LEVEL2_BG,
+				C_("Tooltip", "Pick color for 2nd level text background"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors,
+			       color_buttons.color[COL_QUOTE_LEVEL2_BG]);
+
+	COLOR_LABEL_PACK_START(hbox, COL_QUOTE_LEVEL2_BG, _("Background"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, label[COL_QUOTE_LEVEL2_BG]);
 
-	label_quote_bgcolor2 = gtk_label_new (_("Background"));
-	gtk_widget_show(label_quote_bgcolor2);
-  	gtk_box_pack_start (GTK_BOX(hbox), label_quote_bgcolor2, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, label_quote_bgcolor2);
-	
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
 	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, hbox);
 	gtk_box_pack_start (GTK_BOX (vbox_quotebg), hbox, FALSE, TRUE, 0);
-	
-	color_buttons.btn_quote_level3_bg = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_quote_level3_bg);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_quote_level3_bg, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, color_buttons.btn_quote_level3_bg);
 
-	CLAWS_SET_TIP(color_buttons.btn_quote_level3_bg,
-			     C_("Tooltip", "Pick color for 3rd level text background"));
+	COLOR_BUTTON_PACK_START(hbox, COL_QUOTE_LEVEL3_BG,
+				C_("Tooltip", "Pick color for 3rd level text background"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors,
+			       color_buttons.color[COL_QUOTE_LEVEL3_BG]);
+
+	COLOR_LABEL_PACK_START(hbox, COL_QUOTE_LEVEL3_BG, _("Background"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, label[COL_QUOTE_LEVEL3_BG]);
 
-	label_quote_bgcolor3 = gtk_label_new (_("Background"));
-	gtk_widget_show(label_quote_bgcolor3);
-  	gtk_box_pack_start (GTK_BOX(hbox), label_quote_bgcolor3, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_bgcolors, label_quote_bgcolor3);
-	
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
 	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
 
-	color_buttons.btn_uri = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_uri);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_uri, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, color_buttons.btn_uri);
-
-	CLAWS_SET_TIP(color_buttons.btn_uri,
-			     C_("Tooltip", "Pick color for links"));
+	COLOR_BUTTON_PACK_START(hbox, COL_URI,
+				C_("Tooltip", "Pick color for links"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors,
+			       color_buttons.color[COL_URI]);
 
-	lable_uri = gtk_label_new (_("URI link"));
-	gtk_widget_show(lable_uri);
-  	gtk_box_pack_start (GTK_BOX(hbox), lable_uri, FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, lable_uri);
+	COLOR_LABEL_PACK_START(hbox, COL_URI, _("URI link"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label[COL_URI]);
 
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
 	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
 
-	color_buttons.btn_signature = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_signature);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_signature, 
-			    FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, color_buttons.btn_signature);
-
-	CLAWS_SET_TIP(color_buttons.btn_signature,
-			     C_("Tooltip", "Pick color for signatures"));
+	COLOR_BUTTON_PACK_START(hbox, COL_SIGNATURE,
+				C_("Tooltip", "Pick color for signatures"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors,
+			       color_buttons.color[COL_SIGNATURE]);
 
-	label_signature = gtk_label_new (_("Signatures"));
-	gtk_widget_show(label_signature);
-  	gtk_box_pack_start (GTK_BOX(hbox), label_signature, FALSE, FALSE, 0);
-	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label_signature);
+	COLOR_LABEL_PACK_START(hbox, COL_SIGNATURE, _("Signatures"));
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_colors, label[COL_SIGNATURE]);
 
 	vbox2 = gtkut_get_options_frame(vbox1, &frame_folder, _("Folder list"));
 
@@ -361,35 +314,24 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	gtk_widget_show (hbox);
 	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
 
-	color_buttons.btn_tgt_folder = GTKUT_COLOR_BUTTON();
-	gtk_widget_show(color_buttons.btn_tgt_folder);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_tgt_folder, 
-			    FALSE, FALSE, 0);
-
-	CLAWS_SET_TIP(color_buttons.btn_tgt_folder,
-			     _("Pick color for Target folder. "
-			       "Target folder is used when the option 'Execute immediately "
-			       "when moving or deleting messages' is turned off"));
+	COLOR_BUTTON_PACK_START(hbox, COL_TGT_FOLDER,
+				C_("Tooltip", "Pick color for Target folder. "
+				   "Target folder is used when the option "
+				   "'Execute immediately when moving or "
+				   "deleting messages' is turned off"));
 
-	label_tgt_folder = gtk_label_new (_("Target folder"));
-	gtk_widget_show(label_tgt_folder);
-  	gtk_box_pack_start (GTK_BOX(hbox), label_tgt_folder, FALSE, FALSE, 0);
+	COLOR_LABEL_PACK_START(hbox, COL_TGT_FOLDER, _("Target folder"));
 
 	hbox = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox);
 	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
 
-	color_buttons.btn_color_new = GTKUT_COLOR_BUTTON();
-	gtk_widget_show (color_buttons.btn_color_new);
-  	gtk_box_pack_start (GTK_BOX(hbox), color_buttons.btn_color_new,
-			    FALSE, FALSE, 0);
-
-	CLAWS_SET_TIP(color_buttons.btn_color_new,
-			     _("Pick color for folders containing new messages"));
+	COLOR_BUTTON_PACK_START(hbox, COL_NEW,
+				C_("Tooltip", "Pick color for folders "
+				   "containing new messages"));
 
-	label_color_new = gtk_label_new (_("Folder containing new messages"));
- 	gtk_widget_show(label_color_new);
- 	gtk_box_pack_start (GTK_BOX(hbox), label_color_new, FALSE, FALSE, 0);
+	COLOR_LABEL_PACK_START(hbox, COL_NEW,
+			       _("Folder containing new messages"));
 
 	/* custom colors */
 	vbox_custom_colors = gtk_vbox_new (FALSE, VSPACING_NARROW);
@@ -475,7 +417,6 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 		g_free(tooltip_entry_text);
 	}
 
-
 	hbox_reset_custom_colors = gtk_hbox_new(FALSE, VBOX_BORDER);
 	gtk_widget_show (hbox_reset_custom_colors);
 	gtk_box_pack_start(GTK_BOX (vbox_custom_colors), hbox_reset_custom_colors,
@@ -486,26 +427,15 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	gtk_box_pack_start(GTK_BOX(hbox_reset_custom_colors), btn_reset_custom_colors,
 		FALSE, FALSE, 0);
 
-	g_signal_connect(G_OBJECT(color_buttons.btn_quote_level1), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "LEVEL1");
-	g_signal_connect(G_OBJECT(color_buttons.btn_quote_level2), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "LEVEL2");
-	g_signal_connect(G_OBJECT(color_buttons.btn_quote_level3), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "LEVEL3");
-	g_signal_connect(G_OBJECT(color_buttons.btn_quote_level1_bg), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "LEVEL1BG");
-	g_signal_connect(G_OBJECT(color_buttons.btn_quote_level2_bg), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "LEVEL2BG");
-	g_signal_connect(G_OBJECT(color_buttons.btn_quote_level3_bg), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "LEVEL3BG");
-	g_signal_connect(G_OBJECT(color_buttons.btn_uri), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "URI");
-	g_signal_connect(G_OBJECT(color_buttons.btn_tgt_folder), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "TGTFLD");
-	g_signal_connect(G_OBJECT(color_buttons.btn_signature), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "SIGNATURE");
-	g_signal_connect(G_OBJECT(color_buttons.btn_color_new), "clicked",
-			 G_CALLBACK(quote_color_set_dialog), "NEW");
+	/* program colors */
+	for (c = 0; c < COL_LAST_COLOR_INDEX; c++) {
+		if (color_buttons.color[c] != NULL) {
+			g_signal_connect(G_OBJECT(color_buttons.color[c]),
+					 "clicked",
+					 G_CALLBACK(quote_color_set_dialog),
+					 GINT_TO_POINTER(COLORLABELS + c));
+		}
+	}
 	/* custom colors */
 	for (c = 0; c < COLORLABELS; c++) {
 		g_signal_connect(G_OBJECT(color_buttons.custom_color[c]), "clicked",
@@ -515,26 +445,13 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	g_signal_connect(G_OBJECT(btn_reset_custom_colors), "clicked",
 			 G_CALLBACK(prefs_msg_colors_reset_custom_colors), prefs_msg_colors);
 
-	set_button_bg_color(color_buttons.btn_quote_level1,
-			    prefs_common.color[COL_QUOTE_LEVEL1]);
-	set_button_bg_color(color_buttons.btn_quote_level2,
-			    prefs_common.color[COL_QUOTE_LEVEL2]);
-	set_button_bg_color(color_buttons.btn_quote_level3,
-			    prefs_common.color[COL_QUOTE_LEVEL3]);
-	set_button_bg_color(color_buttons.btn_quote_level1_bg,
-			    prefs_common.color[COL_QUOTE_LEVEL1_BG]);
-	set_button_bg_color(color_buttons.btn_quote_level2_bg,
-			    prefs_common.color[COL_QUOTE_LEVEL2_BG]);
-	set_button_bg_color(color_buttons.btn_quote_level3_bg,
-			    prefs_common.color[COL_QUOTE_LEVEL3_BG]);
-	set_button_bg_color(color_buttons.btn_uri,
-			    prefs_common.color[COL_URI]);
-	set_button_bg_color(color_buttons.btn_tgt_folder,
-			    prefs_common.color[COL_TGT_FOLDER]);
-	set_button_bg_color(color_buttons.btn_signature,
-			    prefs_common.color[COL_SIGNATURE]);
-	set_button_bg_color(color_buttons.btn_color_new,
-			    prefs_common.color[COL_NEW]);
+	/* program colors */
+	for (c = 0; c < COL_LAST_COLOR_INDEX; c++) {
+		if (color_buttons.color[c] != NULL) {
+			set_button_bg_color(color_buttons.color[c],
+					    prefs_common.color[c]);
+		}
+	}
 	/* custom colors */
 	for (c = 0; c < COLORLABELS; c++) {
 		set_button_bg_color(color_buttons.custom_color[c],
@@ -562,6 +479,37 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 	prefs_msg_colors->page.widget = notebook;
 }
 
+#undef COLOR_BUTTON_PACK_START
+#undef COLOR_BUTTON_PACK_END
+#undef COLOR_LABEL_PACK_START
+#undef COLOR_LABEL_PACK_END
+
+static void initialize_color_dialog_title()
+{
+	color_dialog_title[COL_QUOTE_LEVEL1] =
+		C_("Dialog title", "Pick color for 1st level text");
+	color_dialog_title[COL_QUOTE_LEVEL2] =
+		C_("Dialog title", "Pick color for 2nd level text");
+	color_dialog_title[COL_QUOTE_LEVEL3] =
+		C_("Dialog title", "Pick color for 3rd level text");
+	color_dialog_title[COL_QUOTE_LEVEL1_BG] =
+		C_("Dialog title", "Pick color for 1st level text background");
+	color_dialog_title[COL_QUOTE_LEVEL2_BG] =
+		C_("Dialog title", "Pick color for 2nd level text background");
+	color_dialog_title[COL_QUOTE_LEVEL3_BG] =
+		C_("Dialog title", "Pick color for 3rd level text background");
+	color_dialog_title[COL_URI] =
+		C_("Dialog title", "Pick color for links");
+	color_dialog_title[COL_TGT_FOLDER] =
+		C_("Dialog title", "Pick color for target folder");
+	color_dialog_title[COL_SIGNATURE] =
+		C_("Dialog title", "Pick color for signatures");
+	color_dialog_title[COL_NEW] =
+		C_("Dialog title", "Pick color for folder");
+
+	color_dialog_title_init = TRUE;
+}
+
 static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
 {
 	gchar *type = (gchar *)data;
@@ -571,12 +519,13 @@ static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
 	GtkColorSelectionDialog *dialog;
 	GtkWidget *button_ok;
 	GtkWidget *button_cancel;
-	gint c;
+	gint c, ctype;
 
+	ctype = GPOINTER_TO_INT(type);
 	/* custom colors */
 	/* leave the extra space at the end of the title, this is for translators' convenience */
 	for (c = 0; c < COLORLABELS; c++) {
-		if (GPOINTER_TO_INT(type) == c) {
+		if (ctype == c) {
 			/* TRANSLATORS: 'color %d' refers to the filtering/processing 
 			   rule name and should not be translated */
 			title = g_strdup_printf(C_("Dialog title", "Pick color for 'color %d'"), c+1);
@@ -585,39 +534,15 @@ static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
 		}
 	}
 	/* other colors */
+	if (!color_dialog_title_init)
+		initialize_color_dialog_title();
+
 	if (c == COLORLABELS) {
-		if(g_ascii_strcasecmp(type, "LEVEL1") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for 1st level text"));
-			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL1];
-		} else if(g_ascii_strcasecmp(type, "LEVEL2") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for 2nd level text"));
-			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL2];
-		} else if(g_ascii_strcasecmp(type, "LEVEL3") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for 3rd level text"));
-			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL3];
-		} else if(g_ascii_strcasecmp(type, "LEVEL1BG") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for 1st level text background"));
-			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL1_BG];
-		} else if(g_ascii_strcasecmp(type, "LEVEL2BG") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for 2nd level text background"));
-			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL2_BG];
-		} else if(g_ascii_strcasecmp(type, "LEVEL3BG") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for 3rd level text background"));
-			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL3_BG];
-		} else if(g_ascii_strcasecmp(type, "URI") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for links"));
-			rgbvalue = prefs_common.color[COL_URI];
-		} else if(g_ascii_strcasecmp(type, "TGTFLD") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for target folder"));
-			rgbvalue = prefs_common.color[COL_TGT_FOLDER];
-		} else if(g_ascii_strcasecmp(type, "SIGNATURE") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for signatures"));
-			rgbvalue = prefs_common.color[COL_SIGNATURE];
-		} else if(g_ascii_strcasecmp(type, "NEW") == 0) {
-			title = g_strdup(C_("Dialog title", "Pick color for folder"));
-			rgbvalue = prefs_common.color[COL_NEW];
+		ctype -= COLORLABELS;
+		if (ctype < COL_LAST_COLOR_INDEX) {
+			title = g_strdup(color_dialog_title[ctype]);
+			rgbvalue = prefs_common.color[ctype];
 		} else {
-			/* Should never be called */
 			g_warning("Unrecognized datatype '%s' in quote_color_set_dialog", type);
 			return;
 		}
@@ -660,15 +585,15 @@ static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
 	GdkColor color;
 	gint rgbvalue;
 	gchar *type = (gchar *)data;
-	gint c;
+	gint c, ctype;
 
 	gtk_color_selection_get_current_color(colorsel, &color);
 	rgbvalue = gtkut_convert_gdk_color_to_int(&color);
 
-
+	ctype = GPOINTER_TO_INT(type);
 	/* custom colors */
 	for (c = 0; c < COLORLABELS; c++) {
-		if (GPOINTER_TO_INT(type) == c) {
+		if (ctype == c) {
 			prefs_common.custom_colorlabel[c].color = rgbvalue;
 			set_button_bg_color(color_buttons.custom_color[c], rgbvalue);
 			break;
@@ -676,39 +601,15 @@ static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
 	}
 	/* other colors */
 	if (c == COLORLABELS) {
-		if (g_ascii_strcasecmp(type, "LEVEL1") == 0) {
-			prefs_common.color[COL_QUOTE_LEVEL1] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_quote_level1, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "LEVEL2") == 0) {
-			prefs_common.color[COL_QUOTE_LEVEL2] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_quote_level2, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "LEVEL3") == 0) {
-			prefs_common.color[COL_QUOTE_LEVEL3] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_quote_level3, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "LEVEL1BG") == 0) {
-			prefs_common.color[COL_QUOTE_LEVEL1_BG] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_quote_level1_bg, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "LEVEL2BG") == 0) {
-			prefs_common.color[COL_QUOTE_LEVEL2_BG] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_quote_level2_bg, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "LEVEL3BG") == 0) {
-			prefs_common.color[COL_QUOTE_LEVEL3_BG] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_quote_level3_bg, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "URI") == 0) {
-			prefs_common.color[COL_URI] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_uri, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "TGTFLD") == 0) {
-			prefs_common.color[COL_TGT_FOLDER] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_tgt_folder, rgbvalue);
-			folderview_set_target_folder_color(prefs_common.color[COL_TGT_FOLDER]);
-		} else if (g_ascii_strcasecmp(type, "SIGNATURE") == 0) {
-			prefs_common.color[COL_SIGNATURE] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_signature, rgbvalue);
-		} else if (g_ascii_strcasecmp(type, "NEW") == 0) {
-			prefs_common.color[COL_NEW] = rgbvalue;
-			set_button_bg_color(color_buttons.btn_color_new, rgbvalue);
+		ctype -= COLORLABELS;
+		if (ctype < COL_LAST_COLOR_INDEX) {
+			prefs_common.color[ctype] = rgbvalue;
+			set_button_bg_color(color_buttons.color[ctype], rgbvalue);
+			if (ctype == COL_TGT_FOLDER) {
+				folderview_set_target_folder_color(prefs_common.color[ctype]);
+			}
 		} else {
-			g_printerr("Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type);
+			g_warning("Unrecognized datatype '%s' in quote_color_set_dialog_ok", type);
 		}
 	}
 

commit 8363e45874756e3aeb1fed74bcd60206b5cfe2a7
Author: Ricardo Mones <ricardo at mones.org>
Date:   Mon Feb 5 21:12:55 2018 +0100

    Move all colors into an array

diff --git a/src/compose.c b/src/compose.c
index 878e88c..ec66385 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -849,21 +849,21 @@ static void compose_create_tags(GtkTextView *text, Compose *compose)
 
 	if (prefs_common.enable_color) {
 		/* grab the quote colors, converting from an int to a GdkColor */
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL1],
 					       &quote_color1);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL2],
 					       &quote_color2);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level3_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL3],
 					       &quote_color3);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_bgcol,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL1_BG],
 					       &quote_bgcolor1);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_bgcol,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL2_BG],
 					       &quote_bgcolor2);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level3_bgcol,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL3_BG],
 					       &quote_bgcolor3);
-		gtkut_convert_int_to_gdk_color(prefs_common.signature_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_SIGNATURE],
 					       &signature_color);
-		gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
 					       &uri_color);
 	} else {
 		signature_color = quote_color1 = quote_color2 = quote_color3 = 
@@ -7757,9 +7757,9 @@ static Compose *compose_create(PrefsAccount *account,
 
 	cm_return_val_if_fail(account != NULL, NULL);
 
-	gtkut_convert_int_to_gdk_color(prefs_common.default_header_bgcolor,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DEFAULT_HEADER_BG],
 					   &default_header_bgcolor);
-	gtkut_convert_int_to_gdk_color(prefs_common.default_header_color,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DEFAULT_HEADER],
 					   &default_header_color);
 
 	debug_print("Creating compose window...\n");
@@ -8273,7 +8273,7 @@ static Compose *compose_create(PrefsAccount *account,
 			gtkaspell = gtkaspell_new(prefs_common.dictionary,
 						  prefs_common.alt_dictionary,
 						  conv_get_locale_charset_str(),
-						  prefs_common.misspelled_col,
+						  prefs_common.color[COL_MISSPELLED],
 						  prefs_common.check_while_typing,
 						  prefs_common.recheck_when_changing_dict,
 						  prefs_common.use_alternate,
diff --git a/src/foldersel.c b/src/foldersel.c
index 8435cbf..1953cf3 100644
--- a/src/foldersel.c
+++ b/src/foldersel.c
@@ -402,7 +402,7 @@ static void foldersel_append_item(GtkTreeStore *store, FolderItem *item,
 	static GdkColor color_noselect = {0, COLOR_DIM, COLOR_DIM, COLOR_DIM};
 	static GdkColor color_new;
 
-	gtkut_convert_int_to_gdk_color(prefs_common.color_new, &color_new);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &color_new);
 
 	name = folder_item_get_name(item);
 
diff --git a/src/folderview.c b/src/folderview.c
index ff84755..db17902 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -708,13 +708,13 @@ void folderview_init(FolderView *folderview)
 					(normal_style->font_desc);
 			normal_style->font_desc = font_desc;
 		}
-		gtkut_convert_int_to_gdk_color(prefs_common.color_new, &gdk_color);
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color);
 		normal_color_style = gtk_style_copy(normal_style);
 		normal_color_style->fg[GTK_STATE_NORMAL] = gdk_color;
 	}
 
 	if (!bold_style) {
-		gtkut_convert_int_to_gdk_color(prefs_common.color_new, &gdk_color);
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color);
 		bold_style = gtk_style_copy(gtk_widget_get_style(ctree));
 		if (prefs_common.derive_from_normal_font || !BOLD_FONT) {
 			PangoFontDescription *font_desc;
diff --git a/src/gtk/about.c b/src/gtk/about.c
index 890e2d7..d7dfbd1 100644
--- a/src/gtk/about.c
+++ b/src/gtk/about.c
@@ -118,7 +118,7 @@ static GtkWidget *about_create_child_page_info(void)
 	gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0);
 
 	/* textview link style (based upon main prefs) */
-	gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
 				(GdkColor*)&uri_color);
 	tag = gtk_text_buffer_create_tag(buffer, "link",
 				"foreground-gdk", &uri_color,
@@ -569,7 +569,7 @@ static GtkWidget *about_create_child_page_license(void)
 	ADD_TEXT("\n\n");
 
 	/* textview link style (based upon main prefs) */
-	gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
 			(GdkColor*)&uri_color);
 
 	tag = gtk_text_buffer_create_tag(buffer, "link",
diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c
index 14fa92e..1669191 100644
--- a/src/gtk/gtkutils.c
+++ b/src/gtk/gtkutils.c
@@ -1234,9 +1234,9 @@ GtkWidget *gtkut_get_link_btn(GtkWidget *window, const gchar *url, const gchar *
 	if (!url)
 		return NULL;
 
-	gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
 					       &uri_color[0]);
-	gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
 					       &uri_color[1]);
 
 	btn = gtk_button_new_with_label(label?label:url);
diff --git a/src/gtk/logwindow.c b/src/gtk/logwindow.c
index 07d9534..56b151f 100644
--- a/src/gtk/logwindow.c
+++ b/src/gtk/logwindow.c
@@ -162,14 +162,14 @@ void log_window_init(LogWindow *logwin)
 	GdkColor color[LOG_COLORS];
 	gint i;
 
-	gtkut_convert_int_to_gdk_color(prefs_common.log_msg_color, &color[0]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_warn_color, &color[1]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_error_color, &color[2]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_in_color, &color[3]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_out_color, &color[4]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_status_ok_color, &color[5]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_status_nok_color, &color[6]);
-	gtkut_convert_int_to_gdk_color(prefs_common.log_status_skip_color, &color[7]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_MSG], &color[0]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_WARN], &color[1]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_ERROR], &color[2]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_IN], &color[3]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_OUT], &color[4]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_STATUS_OK], &color[5]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_STATUS_NOK], &color[6]);
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_LOG_STATUS_SKIP], &color[7]);
 
 	logwin->msg_color = color[0];
 	logwin->warn_color = color[1];
diff --git a/src/gtk/quicksearch.c b/src/gtk/quicksearch.c
index 0e79a66..1c22e59 100644
--- a/src/gtk/quicksearch.c
+++ b/src/gtk/quicksearch.c
@@ -848,13 +848,13 @@ QuickSearch *quicksearch_new()
 	
 	update_extended_buttons(quicksearch);
 
-	gtkut_convert_int_to_gdk_color(prefs_common.qs_active_bgcolor,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QS_ACTIVE_BG],
 					   &qs_active_bgcolor);
-	gtkut_convert_int_to_gdk_color(prefs_common.qs_active_color,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QS_ACTIVE],
 					   &qs_active_color);
-	gtkut_convert_int_to_gdk_color(prefs_common.qs_error_bgcolor,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QS_ERROR_BG],
 					   &qs_error_bgcolor);
-	gtkut_convert_int_to_gdk_color(prefs_common.qs_error_color,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QS_ERROR],
 					   &qs_error_color);
 
 	return quicksearch;
diff --git a/src/gtk/spell_entry.c b/src/gtk/spell_entry.c
index 0578a6a..f49b259 100644
--- a/src/gtk/spell_entry.c
+++ b/src/gtk/spell_entry.c
@@ -354,15 +354,15 @@ static void entry_strsplit_utf8(GtkEntry *entry, gchar ***set, gint **starts, gi
 
 static void insert_misspelled_marker(ClawsSpellEntry *entry, guint start, guint end)
 {
-	guint16 red   = (guint16) (((gdouble)((prefs_common.misspelled_col & 
+	guint16 red   = (guint16) (((gdouble)((prefs_common.color[COL_MISSPELLED] &
 					0xff0000) >> 16) / 255.0) * 65535.0);
-	guint16 green = (guint16) (((gdouble)((prefs_common.misspelled_col & 
+	guint16 green = (guint16) (((gdouble)((prefs_common.color[COL_MISSPELLED] &
 					0x00ff00) >> 8) / 255.0) * 65535.0);
-	guint16 blue  = (guint16) (((gdouble) (prefs_common.misspelled_col & 
+	guint16 blue  = (guint16) (((gdouble) (prefs_common.color[COL_MISSPELLED] &
 					0x0000ff) / 255.0) * 65535.0);
 	PangoAttribute *fcolor, *ucolor, *unline;
 	
-	if(prefs_common.misspelled_col != 0) {
+	if(prefs_common.color[COL_MISSPELLED] != 0) {
 		fcolor = pango_attr_foreground_new(red, green, blue);
 		fcolor->start_index = start;
 		fcolor->end_index = end;
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 04e4c45..73b0097 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -2095,10 +2095,10 @@ MainWindow *main_window_create()
 	summaryview->color_dim.red = summaryview->color_dim.green =
 		summaryview->color_dim.blue = COLOR_DIM;
 
-	gtkut_convert_int_to_gdk_color(prefs_common.color_new,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW],
 				       &folderview->color_new);
 
-	gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_TGT_FOLDER],
 				       &folderview->color_op);
 
 	summaryview->color_important.red = 0;
diff --git a/src/plugins/vcalendar/vcalendar.c b/src/plugins/vcalendar/vcalendar.c
index 3b7e2f4..c8f1af1 100644
--- a/src/plugins/vcalendar/vcalendar.c
+++ b/src/plugins/vcalendar/vcalendar.c
@@ -1356,7 +1356,7 @@ void vcalendar_init(void)
 				(GSourceFunc)vcal_webcal_check, 
 				(gpointer)NULL);
 	if (prefs_common_get_prefs()->enable_color) {
-		gtkut_convert_int_to_gdk_color(prefs_common_get_prefs()->uri_col,
+		gtkut_convert_int_to_gdk_color(prefs_common_get_prefs()->color[COL_URI],
 				       &uri_color);
 	}
 
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 4b42e65..f9754bf 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -276,8 +276,8 @@ static PrefParam param[] = {
 	 NULL, NULL, NULL},
 	{"recheck_when_changing_dict", "TRUE", &prefs_common.recheck_when_changing_dict,
 	 P_BOOL, NULL, NULL, NULL},
-	{"misspelled_color", "#ff0000", &prefs_common.misspelled_col, P_COLOR,
-	 NULL, NULL, NULL},
+	{"misspelled_color", "#ff0000", &prefs_common.color[COL_MISSPELLED],
+	 P_COLOR, NULL, NULL, NULL},
 	{"use_both_dicts", "FALSE", &prefs_common.use_both_dicts, P_BOOL,
 	 NULL, NULL, NULL},
 
@@ -696,47 +696,47 @@ static PrefParam param[] = {
 	{"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL,
 	 NULL, NULL, NULL},
 
-	{"quote_level1_color", "#0000b3", &prefs_common.quote_level1_col, P_COLOR,
-	 NULL, NULL, NULL},
-	{"quote_level2_color", "#0000b3", &prefs_common.quote_level2_col, P_COLOR,
-	 NULL, NULL, NULL},
-	{"quote_level3_color", "#0000b3", &prefs_common.quote_level3_col, P_COLOR,
-	 NULL, NULL, NULL},
+	{"quote_level1_color", "#0000b3", &prefs_common.color[COL_QUOTE_LEVEL1],
+	 P_COLOR, NULL, NULL, NULL},
+	{"quote_level2_color", "#0000b3", &prefs_common.color[COL_QUOTE_LEVEL2],
+	 P_COLOR, NULL, NULL, NULL},
+	{"quote_level3_color", "#0000b3", &prefs_common.color[COL_QUOTE_LEVEL3],
+	 P_COLOR, NULL, NULL, NULL},
 	{"enable_bgcolor", "FALSE", &prefs_common.enable_bgcolor, P_BOOL,
 	 NULL, NULL, NULL},
-	{"quote_level1_bgcolor", "#cccccc", &prefs_common.quote_level1_bgcol, P_COLOR,
-	 NULL, NULL, NULL},
-	{"quote_level2_bgcolor", "#d4d4d4", &prefs_common.quote_level2_bgcol, P_COLOR,
-	 NULL, NULL, NULL},
-	{"quote_level3_bgcolor", "#dddddd", &prefs_common.quote_level3_bgcol, P_COLOR,
-	 NULL, NULL, NULL},
-	{"uri_color", "#007f00", &prefs_common.uri_col, P_COLOR,
-	 NULL, NULL, NULL},
-	{"emphasis_color", "#0000cf", &prefs_common.emphasis_col, P_COLOR,
-	 NULL, NULL, NULL},
-	{"target_folder_color", "#da1cca", &prefs_common.tgt_folder_col, P_COLOR,
-	 NULL, NULL, NULL},
-	{"signature_color", "#797979", &prefs_common.signature_col, P_COLOR,
-	 NULL, NULL, NULL},
+	{"quote_level1_bgcolor", "#cccccc", &prefs_common.color[COL_QUOTE_LEVEL1_BG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"quote_level2_bgcolor", "#d4d4d4", &prefs_common.color[COL_QUOTE_LEVEL2_BG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"quote_level3_bgcolor", "#dddddd", &prefs_common.color[COL_QUOTE_LEVEL3_BG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"uri_color", "#007f00", &prefs_common.color[COL_URI],
+	 P_COLOR, NULL, NULL, NULL},
+	{"emphasis_color", "#0000cf", &prefs_common.color[COL_EMPHASIS],
+	 P_COLOR, NULL, NULL, NULL},
+	{"target_folder_color", "#da1cca", &prefs_common.color[COL_TGT_FOLDER],
+	 P_COLOR, NULL, NULL, NULL},
+	{"signature_color", "#797979", &prefs_common.color[COL_SIGNATURE],
+	 P_COLOR, NULL, NULL, NULL},
 	{"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
 	 P_BOOL, NULL, NULL, NULL},
 
-	{"default_header_color", "#000000", &prefs_common.default_header_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"default_header_bgcolor", "#f5f6be", &prefs_common.default_header_bgcolor, P_COLOR,
-	 NULL, NULL, NULL},
-	{"tags_color", "#000000", &prefs_common.tags_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"tags_bgcolor", "#f5f6be", &prefs_common.tags_bgcolor, P_COLOR,
-	 NULL, NULL, NULL},
-	{"qs_active_color", "#000000", &prefs_common.qs_active_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"qs_active_bgcolor", "#f5f6be", &prefs_common.qs_active_bgcolor, P_COLOR,
-	 NULL, NULL, NULL},
-	{"qs_error_color", "#000000", &prefs_common.qs_error_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"qs_error_bgcolor", "#ff7070", &prefs_common.qs_error_bgcolor, P_COLOR,
-	 NULL, NULL, NULL},
+	{"default_header_color", "#000000", &prefs_common.color[COL_DEFAULT_HEADER],
+	 P_COLOR, NULL, NULL, NULL},
+	{"default_header_bgcolor", "#f5f6be", &prefs_common.color[COL_DEFAULT_HEADER_BG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"tags_color", "#000000", &prefs_common.color[COL_TAGS],
+	 P_COLOR, NULL, NULL, NULL},
+	{"tags_bgcolor", "#f5f6be", &prefs_common.color[COL_TAGS_BG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"qs_active_color", "#000000", &prefs_common.color[COL_QS_ACTIVE],
+	 P_COLOR, NULL, NULL, NULL},
+	{"qs_active_bgcolor", "#f5f6be", &prefs_common.color[COL_QS_ACTIVE_BG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"qs_error_color", "#000000", &prefs_common.color[COL_QS_ERROR],
+	 P_COLOR, NULL, NULL, NULL},
+	{"qs_error_bgcolor", "#ff7070", &prefs_common.color[COL_QS_ERROR_BG],
+	 P_COLOR, NULL, NULL, NULL},
 
 	{"display_header_pane", "FALSE", &prefs_common.display_header_pane,
 	 P_BOOL, NULL, NULL, NULL},
@@ -961,22 +961,22 @@ static PrefParam param[] = {
     	{"enable_log_status", "FALSE", &prefs_common.enable_log_status, P_BOOL,
 	 NULL, NULL, NULL},
 #endif
-	{"log_msg_color", "#00af00", &prefs_common.log_msg_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_warn_color", "#af0000", &prefs_common.log_warn_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_error_color", "#af0000", &prefs_common.log_error_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_in_color", "#000000", &prefs_common.log_in_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_out_color", "#0000ef", &prefs_common.log_out_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_status_ok_color", "#00af00", &prefs_common.log_status_ok_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_status_nok_color", "#0000af", &prefs_common.log_status_nok_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"log_status_skip_color", "#aa00aa", &prefs_common.log_status_skip_color, P_COLOR,
-	 NULL, NULL, NULL},
+	{"log_msg_color", "#00af00", &prefs_common.color[COL_LOG_MSG],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_warn_color", "#af0000", &prefs_common.color[COL_LOG_WARN],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_error_color", "#af0000", &prefs_common.color[COL_LOG_ERROR],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_in_color", "#000000", &prefs_common.color[COL_LOG_IN],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_out_color", "#0000ef", &prefs_common.color[COL_LOG_OUT],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_status_ok_color", "#00af00", &prefs_common.color[COL_LOG_STATUS_OK],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_status_nok_color", "#0000af", &prefs_common.color[COL_LOG_STATUS_NOK],
+	 P_COLOR, NULL, NULL, NULL},
+	{"log_status_skip_color", "#aa00aa", &prefs_common.color[COL_LOG_STATUS_SKIP],
+	 P_COLOR, NULL, NULL, NULL},
 
     {"enable_filtering_debug", "FALSE", &prefs_common.enable_filtering_debug, P_BOOL,
 	 NULL, NULL, NULL},
@@ -1000,8 +1000,8 @@ static PrefParam param[] = {
 	{"gtk_can_change_accels", "FALSE", &prefs_common.gtk_can_change_accels, P_BOOL,
 	 NULL, NULL, NULL},
 
-	{"color_new", "#0000b3", &prefs_common.color_new, P_COLOR,
-	 NULL, NULL, NULL},
+	{"color_new", "#0000b3", &prefs_common.color[COL_NEW],
+	 P_COLOR, NULL, NULL, NULL},
 
 	/* Some windows' sizes */
 	{"filteringwin_width", "500", &prefs_common.filteringwin_width, P_INT,
@@ -1229,12 +1229,12 @@ static PrefParam param[] = {
 	{"nav_history_length", "50", &prefs_common.nav_history_length, P_INT,
 	 NULL, NULL, NULL},
 
-	{"diff_added_color", "#008b8b", &prefs_common.diff_added_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"diff_deleted_color", "#6a5acd", &prefs_common.diff_deleted_color, P_COLOR,
-	 NULL, NULL, NULL},
-	{"diff_hunk_color", "#a52a2a", &prefs_common.diff_hunk_color, P_COLOR,
-	 NULL, NULL, NULL},
+	{"diff_added_color", "#008b8b", &prefs_common.color[COL_DIFF_ADDED],
+	 P_COLOR, NULL, NULL, NULL},
+	{"diff_deleted_color", "#6a5acd", &prefs_common.color[COL_DIFF_DELETED],
+	 P_COLOR, NULL, NULL, NULL},
+	{"diff_hunk_color", "#a52a2a", &prefs_common.color[COL_DIFF_HUNK],
+	 P_COLOR, NULL, NULL, NULL},
 
 	{"folder_search_wildcard", "TRUE", &prefs_common.folder_search_wildcard, P_BOOL,
 	 NULL, NULL, NULL},
diff --git a/src/prefs_common.h b/src/prefs_common.h
index 702db3d..e4b38a8 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -108,6 +108,42 @@ typedef enum
 	AVATARS_ENABLE_BOTH = 3
 } EnableAvatars;
 
+typedef enum
+{
+	COL_MISSPELLED,
+	COL_QUOTE_LEVEL1,
+	COL_QUOTE_LEVEL2,
+	COL_QUOTE_LEVEL3,
+	COL_QUOTE_LEVEL1_BG,
+	COL_QUOTE_LEVEL2_BG,
+	COL_QUOTE_LEVEL3_BG,
+	COL_URI,
+	COL_TGT_FOLDER,
+	COL_SIGNATURE,
+	COL_EMPHASIS,
+	COL_DEFAULT_HEADER,
+	COL_DEFAULT_HEADER_BG,
+	COL_TAGS,
+	COL_TAGS_BG,
+	COL_QS_ACTIVE,
+	COL_QS_ACTIVE_BG,
+	COL_QS_ERROR,
+	COL_QS_ERROR_BG,
+	COL_LOG_MSG,
+	COL_LOG_WARN,
+	COL_LOG_ERROR,
+	COL_LOG_IN,
+	COL_LOG_OUT,
+	COL_LOG_STATUS_OK,
+	COL_LOG_STATUS_NOK,
+	COL_LOG_STATUS_SKIP,
+	COL_NEW,
+	COL_DIFF_ADDED,
+	COL_DIFF_DELETED,
+	COL_DIFF_HUNK,
+	COL_LAST_COLOR_INDEX
+} ColorIndex;
+
 struct _PrefsCommon
 {
 	gint config_version;
@@ -184,7 +220,6 @@ struct _PrefsCommon
 	gboolean enable_aspell;
 	gchar *dictionary;
 	gchar *alt_dictionary;
-	gulong misspelled_col;
 	gboolean check_while_typing;
 	gboolean recheck_when_changing_dict;
 	gboolean use_alternate;
@@ -204,6 +239,9 @@ struct _PrefsCommon
 	/* custom colors */
 	ColorlabelPrefs custom_colorlabel[COLORLABELS];
 
+	/* program colors */
+	gulong color[COL_LAST_COLOR_INDEX];
+
 	/* image viewer */
 	gboolean display_img;
 	gboolean resize_img;
@@ -306,25 +344,7 @@ struct _PrefsCommon
 	/* Message */
 	gboolean enable_color;
 	gboolean enable_bgcolor;
-	gulong quote_level1_col;
-	gulong quote_level2_col;
-	gulong quote_level3_col;
-	gulong quote_level1_bgcol;
-	gulong quote_level2_bgcol;
-	gulong quote_level3_bgcol;
-	gulong uri_col;
-	gulong tgt_folder_col;
-	gulong signature_col;
-	gulong emphasis_col;
 	gboolean recycle_quote_colors;
-	gulong default_header_bgcolor;
-	gulong default_header_color;
-	gulong tags_bgcolor;
-	gulong tags_color;
-	gulong qs_active_bgcolor;
-	gulong qs_active_color;
-	gulong qs_error_bgcolor;
-	gulong qs_error_color;
 	gboolean display_header_pane;
 	gboolean display_header;
 	gboolean display_xface;
@@ -412,15 +432,6 @@ struct _PrefsCommon
 	gboolean enable_log_error;
 	gboolean enable_log_status;
 
-	gulong log_msg_color;
-	gulong log_warn_color;
-	gulong log_error_color;
-	gulong log_in_color;
-	gulong log_out_color;
-	gulong log_status_ok_color;
-	gulong log_status_nok_color;
-	gulong log_status_skip_color;
-
 	gboolean enable_filtering_debug;
 	gint filtering_debug_level;
 	gboolean enable_filtering_debug_inc;
@@ -454,8 +465,7 @@ struct _PrefsCommon
 	gint summary_quicksearch_recurse;
 	gint summary_quicksearch_dynamic;
 	gint summary_quicksearch_autorun;
-	gulong color_new;
-	
+
 	GList *summary_quicksearch_history;
 	GList *summary_search_from_history;
 	GList *summary_search_to_history;
@@ -544,10 +554,6 @@ struct _PrefsCommon
 
 	gint nav_history_length;
 
-	gulong diff_added_color;
-	gulong diff_deleted_color;
-	gulong diff_hunk_color;
-	
 	gboolean folder_search_wildcard;
 	gboolean address_search_wildcard;
 
diff --git a/src/prefs_msg_colors.c b/src/prefs_msg_colors.c
index 4b56eb0..4d6223e 100644
--- a/src/prefs_msg_colors.c
+++ b/src/prefs_msg_colors.c
@@ -516,25 +516,25 @@ static void prefs_msg_colors_create_widget(PrefsPage *_page, GtkWindow *window,
 			 G_CALLBACK(prefs_msg_colors_reset_custom_colors), prefs_msg_colors);
 
 	set_button_bg_color(color_buttons.btn_quote_level1,
-			    prefs_common.quote_level1_col);
+			    prefs_common.color[COL_QUOTE_LEVEL1]);
 	set_button_bg_color(color_buttons.btn_quote_level2,
-			    prefs_common.quote_level2_col);
+			    prefs_common.color[COL_QUOTE_LEVEL2]);
 	set_button_bg_color(color_buttons.btn_quote_level3,
-			    prefs_common.quote_level3_col);
+			    prefs_common.color[COL_QUOTE_LEVEL3]);
 	set_button_bg_color(color_buttons.btn_quote_level1_bg,
-			    prefs_common.quote_level1_bgcol);
+			    prefs_common.color[COL_QUOTE_LEVEL1_BG]);
 	set_button_bg_color(color_buttons.btn_quote_level2_bg,
-			    prefs_common.quote_level2_bgcol);
+			    prefs_common.color[COL_QUOTE_LEVEL2_BG]);
 	set_button_bg_color(color_buttons.btn_quote_level3_bg,
-			    prefs_common.quote_level3_bgcol);
+			    prefs_common.color[COL_QUOTE_LEVEL3_BG]);
 	set_button_bg_color(color_buttons.btn_uri,
-			    prefs_common.uri_col);
+			    prefs_common.color[COL_URI]);
 	set_button_bg_color(color_buttons.btn_tgt_folder,
-			    prefs_common.tgt_folder_col);
+			    prefs_common.color[COL_TGT_FOLDER]);
 	set_button_bg_color(color_buttons.btn_signature,
-			    prefs_common.signature_col);
+			    prefs_common.color[COL_SIGNATURE]);
 	set_button_bg_color(color_buttons.btn_color_new,
-			    prefs_common.color_new);
+			    prefs_common.color[COL_NEW]);
 	/* custom colors */
 	for (c = 0; c < COLORLABELS; c++) {
 		set_button_bg_color(color_buttons.custom_color[c],
@@ -588,34 +588,34 @@ static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
 	if (c == COLORLABELS) {
 		if(g_ascii_strcasecmp(type, "LEVEL1") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for 1st level text"));
-			rgbvalue = prefs_common.quote_level1_col;
+			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL1];
 		} else if(g_ascii_strcasecmp(type, "LEVEL2") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for 2nd level text"));
-			rgbvalue = prefs_common.quote_level2_col;
+			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL2];
 		} else if(g_ascii_strcasecmp(type, "LEVEL3") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for 3rd level text"));
-			rgbvalue = prefs_common.quote_level3_col;
+			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL3];
 		} else if(g_ascii_strcasecmp(type, "LEVEL1BG") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for 1st level text background"));
-			rgbvalue = prefs_common.quote_level1_bgcol;
+			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL1_BG];
 		} else if(g_ascii_strcasecmp(type, "LEVEL2BG") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for 2nd level text background"));
-			rgbvalue = prefs_common.quote_level2_bgcol;
+			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL2_BG];
 		} else if(g_ascii_strcasecmp(type, "LEVEL3BG") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for 3rd level text background"));
-			rgbvalue = prefs_common.quote_level3_bgcol;
+			rgbvalue = prefs_common.color[COL_QUOTE_LEVEL3_BG];
 		} else if(g_ascii_strcasecmp(type, "URI") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for links"));
-			rgbvalue = prefs_common.uri_col;
+			rgbvalue = prefs_common.color[COL_URI];
 		} else if(g_ascii_strcasecmp(type, "TGTFLD") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for target folder"));
-			rgbvalue = prefs_common.tgt_folder_col;
+			rgbvalue = prefs_common.color[COL_TGT_FOLDER];
 		} else if(g_ascii_strcasecmp(type, "SIGNATURE") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for signatures"));
-			rgbvalue = prefs_common.signature_col;
+			rgbvalue = prefs_common.color[COL_SIGNATURE];
 		} else if(g_ascii_strcasecmp(type, "NEW") == 0) {
 			title = g_strdup(C_("Dialog title", "Pick color for folder"));
-			rgbvalue = prefs_common.color_new;
+			rgbvalue = prefs_common.color[COL_NEW];
 		} else {
 			/* Should never be called */
 			g_warning("Unrecognized datatype '%s' in quote_color_set_dialog", type);
@@ -677,35 +677,35 @@ static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
 	/* other colors */
 	if (c == COLORLABELS) {
 		if (g_ascii_strcasecmp(type, "LEVEL1") == 0) {
-			prefs_common.quote_level1_col = rgbvalue;
+			prefs_common.color[COL_QUOTE_LEVEL1] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_quote_level1, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "LEVEL2") == 0) {
-			prefs_common.quote_level2_col = rgbvalue;
+			prefs_common.color[COL_QUOTE_LEVEL2] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_quote_level2, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "LEVEL3") == 0) {
-			prefs_common.quote_level3_col = rgbvalue;
+			prefs_common.color[COL_QUOTE_LEVEL3] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_quote_level3, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "LEVEL1BG") == 0) {
-			prefs_common.quote_level1_bgcol = rgbvalue;
+			prefs_common.color[COL_QUOTE_LEVEL1_BG] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_quote_level1_bg, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "LEVEL2BG") == 0) {
-			prefs_common.quote_level2_bgcol = rgbvalue;
+			prefs_common.color[COL_QUOTE_LEVEL2_BG] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_quote_level2_bg, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "LEVEL3BG") == 0) {
-			prefs_common.quote_level3_bgcol = rgbvalue;
+			prefs_common.color[COL_QUOTE_LEVEL3_BG] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_quote_level3_bg, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "URI") == 0) {
-			prefs_common.uri_col = rgbvalue;
+			prefs_common.color[COL_URI] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_uri, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "TGTFLD") == 0) {
-			prefs_common.tgt_folder_col = rgbvalue;
+			prefs_common.color[COL_TGT_FOLDER] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_tgt_folder, rgbvalue);
-			folderview_set_target_folder_color(prefs_common.tgt_folder_col);
+			folderview_set_target_folder_color(prefs_common.color[COL_TGT_FOLDER]);
 		} else if (g_ascii_strcasecmp(type, "SIGNATURE") == 0) {
-			prefs_common.signature_col = rgbvalue;
+			prefs_common.color[COL_SIGNATURE] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_signature, rgbvalue);
 		} else if (g_ascii_strcasecmp(type, "NEW") == 0) {
-			prefs_common.color_new = rgbvalue;
+			prefs_common.color[COL_NEW] = rgbvalue;
 			set_button_bg_color(color_buttons.btn_color_new, rgbvalue);
 		} else {
 			g_printerr("Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type);
diff --git a/src/prefs_spelling.c b/src/prefs_spelling.c
index 09cc94c..39f6533 100644
--- a/src/prefs_spelling.c
+++ b/src/prefs_spelling.c
@@ -264,7 +264,7 @@ static void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gp
 	g_signal_connect(G_OBJECT(misspelled_colorbtn), "clicked",
 			 G_CALLBACK(prefs_spelling_colorsel), prefs_spelling);
 
-	prefs_spelling->misspell_col = prefs_common.misspelled_col;
+	prefs_spelling->misspell_col = prefs_common.color[COL_MISSPELLED];
 	gtkut_set_widget_bgcolor_rgb(misspelled_colorbtn, prefs_spelling->misspell_col);
 
 	prefs_spelling->window			= GTK_WIDGET(window);
@@ -312,7 +312,7 @@ static void prefs_spelling_save(PrefsPage *_page)
 		gtkaspell_get_dictionary_menu_active_item(
 				GTK_COMBO_BOX(spelling->default_alt_dict_combo));
 
-	prefs_common.misspelled_col = spelling->misspell_col;
+	prefs_common.color[COL_MISSPELLED] = spelling->misspell_col;
 }
 
 static void prefs_spelling_destroy_widget(PrefsPage *_page)
diff --git a/src/textview.c b/src/textview.c
index c9be5d8..1a48788 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -565,31 +565,31 @@ static void textview_update_message_colors(TextView *textview)
 
 	if (prefs_common.enable_color) {
 		/* grab the quote colors, converting from an int to a GdkColor */
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL1],
 					       &quote_colors[0]);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL2],
 					       &quote_colors[1]);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level3_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL3],
 					       &quote_colors[2]);
-		gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_URI],
 					       &uri_color);
-		gtkut_convert_int_to_gdk_color(prefs_common.signature_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_SIGNATURE],
 					       &signature_color);
-		gtkut_convert_int_to_gdk_color(prefs_common.emphasis_col,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_EMPHASIS],
 					       &emphasis_color);
-		gtkut_convert_int_to_gdk_color(prefs_common.diff_added_color,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DIFF_ADDED],
 					       &diff_added_color);
-		gtkut_convert_int_to_gdk_color(prefs_common.diff_deleted_color,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DIFF_DELETED],
 					       &diff_deleted_color);
-		gtkut_convert_int_to_gdk_color(prefs_common.diff_hunk_color,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_DIFF_HUNK],
 					       &diff_hunk_color);
 	}
 	if (prefs_common.enable_color && prefs_common.enable_bgcolor) {
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_bgcol,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL1_BG],
 						   &quote_bgcolors[0]);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_bgcol,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL2_BG],
 						   &quote_bgcolors[1]);
-		gtkut_convert_int_to_gdk_color(prefs_common.quote_level3_bgcol,
+		gtkut_convert_int_to_gdk_color(prefs_common.color[COL_QUOTE_LEVEL3_BG],
 						   &quote_bgcolors[2]);
 		CHANGE_TAG_COLOR("quote0", &quote_colors[0], &quote_bgcolors[0]);
 		CHANGE_TAG_COLOR("quote1", &quote_colors[1], &quote_bgcolors[1]);
@@ -610,9 +610,9 @@ static void textview_update_message_colors(TextView *textview)
 	CHANGE_TAG_COLOR("diff-del-file", &diff_deleted_color, NULL);
 	CHANGE_TAG_COLOR("diff-hunk", &diff_hunk_color, NULL);
 
-	gtkut_convert_int_to_gdk_color(prefs_common.tags_bgcolor,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_TAGS_BG],
 					   &tags_bgcolor);
-	gtkut_convert_int_to_gdk_color(prefs_common.tags_color,
+	gtkut_convert_int_to_gdk_color(prefs_common.color[COL_TAGS],
 					   &tags_color);
 }
 #undef CHANGE_TAG_COLOR

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list