Move all colors into an array
[claws.git] / src / prefs_spelling.c
index 9c9b46b953d6728f056c770af9f5151dc75e6f8c..39f6533e6e9102ddd6b052ad70c5444f3b65a1a2 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2009 Hiroyuki Yamamoto & the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2002-2017 Hiroyuki Yamamoto & the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #if USE_ENCHANT
@@ -116,8 +116,6 @@ static void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gp
        GtkWidget *misspelled_hbox;
        GtkWidget *misspelled_colorbtn;
 
-       CLAWS_TIP_DECL();
-
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
@@ -155,7 +153,7 @@ static void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gp
        
        table = gtk_table_new(6, 4, FALSE);
        gtk_widget_show(table);
-       gtk_container_set_border_width(GTK_CONTAINER(table), 8);
+       gtk_container_set_border_width(GTK_CONTAINER(table), 0);
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
 
@@ -170,9 +168,8 @@ static void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gp
        gtk_misc_set_alignment(GTK_MISC(default_dict_label), 1, 0.5);
        
        default_dict_combo = gtkaspell_dictionary_combo_new(TRUE);
-       gtk_widget_set_size_request(default_dict_combo, 180, -1);
        gtk_table_attach (GTK_TABLE (table), default_dict_combo, 1, 2, 0, 1,
-                         GTK_SHRINK, 0, 0, 0);
+                         GTK_EXPAND | GTK_FILL, 0, 0, 0);
 
        default_alt_dict_label = gtk_label_new(_("Default alternate dictionary"));
        gtk_widget_show(default_alt_dict_label);
@@ -183,15 +180,14 @@ static void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gp
        gtk_misc_set_alignment(GTK_MISC(default_alt_dict_label), 1, 0.5);
        
        default_alt_dict_combo = gtkaspell_dictionary_combo_new(FALSE);
-       gtk_widget_set_size_request(default_alt_dict_combo, 180, -1);
        gtk_table_attach (GTK_TABLE (table), default_alt_dict_combo, 1, 2, 1, 2,
-                         GTK_SHRINK, 0, 0, 0);
+                         GTK_EXPAND | GTK_FILL, 0, 0, 0);
 
        both_dict_check = gtk_check_button_new_with_label(
                                _("Check with both dictionaries"));
        gtk_widget_show(both_dict_check);
        gtk_table_attach (GTK_TABLE (table), both_dict_check, 1, 2, 2, 3,
-                         GTK_SHRINK, 0, 0, 0);
+                         GTK_EXPAND | GTK_FILL, 0, 0, 0);
 
 #ifdef WIN32
        get_dictionaries_btn = gtkut_get_link_btn(GTK_WIDGET(window), 
@@ -212,11 +208,10 @@ static void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gp
        gtk_label_set_justify(GTK_LABEL(misspelled_label), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment(GTK_MISC(misspelled_label), 1, 0.5);
 
-       misspelled_colorbtn = gtk_button_new_with_label("");
+       misspelled_colorbtn = GTKUT_COLOR_BUTTON();
        gtk_widget_show(misspelled_colorbtn);
        gtk_box_pack_start(GTK_BOX(misspelled_hbox), misspelled_colorbtn,
                FALSE, FALSE, 0);
-       gtk_widget_set_size_request(misspelled_colorbtn, 30, 20);
        CLAWS_SET_TIP(misspelled_colorbtn,
                             _("Pick color for misspelled word. "
                               "Use black to underline"));
@@ -269,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);
@@ -317,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)