67c276dd8bd694384ce103a51e5abecf45812882
[claws.git] / src / prefs_spelling.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2002-2007 Hiroyuki Yamamoto & the Claws Mail team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #  include "config.h"
22 #endif
23
24 #if USE_ASPELL
25
26 #include "defs.h"
27
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 #include <glib.h>
32 #include <glib/gi18n.h>
33 #include <gtk/gtk.h>
34
35 #include "utils.h"
36 #include "prefs_common.h"
37 #include "prefs_gtk.h"
38
39 #include "gtk/gtkutils.h"
40 #include "gtk/prefswindow.h"
41 #include "gtk/filesel.h"
42 #include "gtk/colorsel.h"
43
44 typedef struct _SpellingPage
45 {
46         PrefsPage page;
47
48         GtkWidget *window;              /* do not modify */
49
50         GtkWidget *automatic_frame;
51         GtkWidget *dictionary_frame;
52         GtkWidget *path_frame;
53         
54         GtkWidget *enable_aspell_checkbtn;
55         GtkWidget *recheck_when_changing_dict_checkbtn;
56         GtkWidget *check_while_typing_checkbtn;
57         GtkWidget *use_alternate_checkbtn;
58
59         GtkWidget *aspell_path_entry;
60         GtkWidget *aspell_path_select;
61
62         GtkWidget *default_dict_label;
63         GtkWidget *default_dict_optmenu;
64         GtkWidget *default_dict_optmenu_menu;
65
66         GtkWidget *default_alt_dict_label;
67         GtkWidget *default_alt_dict_optmenu;
68         GtkWidget *default_alt_dict_optmenu_menu;
69
70         GtkWidget *both_dict_check;
71
72         GtkWidget *sugmode_label;
73         GtkWidget *sugmode_optmenu;
74         GtkWidget *sugmode_optmenu_menu;
75
76         GtkWidget *misspelled_label;
77         GtkWidget *misspelled_colorbtn;
78         GtkWidget *misspelled_useblack_label;
79
80         gint       misspell_col;
81 } SpellingPage;
82
83 static void prefs_spelling_btn_aspell_path_clicked_cb(GtkWidget *widget,
84                                                      gpointer data)
85 {
86         SpellingPage *spelling = (SpellingPage *) data;
87         gchar *file_path;
88         GtkWidget *new_menu;
89         GtkWidget *alt_new_menu;
90
91         file_path = filesel_select_file_open(_("Select dictionaries location"),
92                                         prefs_common.aspell_path);
93         if (file_path != NULL) {
94                 gchar *tmp_path, *tmp;
95
96                 tmp_path = g_path_get_dirname(file_path);
97                 tmp = g_strdup_printf("%s%s", tmp_path, G_DIR_SEPARATOR_S);
98                 g_free(tmp_path);
99
100                 new_menu = gtkaspell_dictionary_option_menu_new(tmp);
101                 gtk_option_menu_set_menu(GTK_OPTION_MENU(spelling->default_dict_optmenu),
102                                          new_menu);
103
104                 alt_new_menu = gtkaspell_dictionary_option_menu_new_with_refresh(tmp, FALSE);
105                 gtk_option_menu_set_menu(GTK_OPTION_MENU(spelling->default_alt_dict_optmenu),
106                                          alt_new_menu);
107
108                 gtk_entry_set_text(GTK_ENTRY(spelling->aspell_path_entry), tmp);
109                 /* select first one */
110                 gtk_option_menu_set_history(GTK_OPTION_MENU(
111                                         spelling->default_dict_optmenu), 0);
112                 gtk_option_menu_set_history(GTK_OPTION_MENU(
113                                         spelling->default_alt_dict_optmenu), 0);
114         
115                 g_free(tmp);
116
117         }
118 }
119
120 static void prefs_spelling_colorsel(GtkWidget *widget,
121                                     gpointer data)
122 {
123         SpellingPage *spelling = (SpellingPage *) data;
124         gint rgbcolor;
125
126         rgbcolor = colorsel_select_color_rgb(_("Pick color for misspelled word"), 
127                                              spelling->misspell_col);
128         gtkut_set_widget_bgcolor_rgb(spelling->misspelled_colorbtn, rgbcolor);
129         spelling->misspell_col = rgbcolor;
130 }
131
132 #define SAFE_STRING(str) \
133         (str) ? (str) : ""
134
135 void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer data)
136 {
137         SpellingPage *prefs_spelling = (SpellingPage *) _page;
138
139         GtkWidget *vbox1, *vbox2;
140
141         GtkWidget *enable_aspell_checkbtn;
142         GtkWidget *check_while_typing_checkbtn;
143         GtkWidget *recheck_when_changing_dict_checkbtn;
144         GtkWidget *use_alternate_checkbtn;
145
146         GtkWidget *automatic_frame;
147         GtkWidget *dictionary_frame;
148         GtkWidget *path_frame;
149
150         GtkWidget *aspell_path_hbox;
151         GtkWidget *aspell_path_entry;
152         GtkWidget *aspell_path_select;
153
154         GtkWidget *table;
155
156         GtkWidget *default_dict_label;
157         GtkWidget *default_dict_optmenu;
158         GtkWidget *default_dict_optmenu_menu;
159
160         GtkWidget *default_alt_dict_label;
161         GtkWidget *default_alt_dict_optmenu;
162         GtkWidget *default_alt_dict_optmenu_menu;
163
164         GtkWidget *sugmode_label;
165         GtkWidget *sugmode_optmenu;
166         GtkWidget *sugmode_optmenu_menu;
167         
168         GtkWidget *both_dict_check;
169         GtkWidget *misspelled_label;
170         GtkWidget *misspelled_hbox;
171         GtkWidget *misspelled_colorbtn;
172         GtkTooltips *tooltips;
173
174         vbox1 = gtk_vbox_new (FALSE, VSPACING);
175         gtk_widget_show (vbox1);
176         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
177
178         vbox2 = gtk_vbox_new (FALSE, 0);
179         gtk_widget_show (vbox2);
180         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
181
182         enable_aspell_checkbtn = gtk_check_button_new_with_label(
183                         _("Enable spell checker"));
184         gtk_widget_show(enable_aspell_checkbtn);
185         gtk_box_pack_start(GTK_BOX(vbox2), enable_aspell_checkbtn, TRUE, TRUE, 0);
186
187         use_alternate_checkbtn = gtk_check_button_new_with_label(
188                         _("Enable alternate dictionary"));
189         gtk_widget_show(use_alternate_checkbtn);
190         gtk_box_pack_start(GTK_BOX(vbox2), use_alternate_checkbtn, TRUE, TRUE, 0);
191
192         tooltips = gtk_tooltips_new();
193         gtk_tooltips_set_tip(tooltips, use_alternate_checkbtn, 
194                         _("Faster switching with last used dictionary"), NULL);
195
196         PACK_FRAME(vbox1, path_frame, _("Path to dictionaries"));
197         aspell_path_hbox = gtk_hbox_new(FALSE, 8);
198         gtk_widget_show(aspell_path_hbox);
199         gtk_container_add(GTK_CONTAINER(path_frame), aspell_path_hbox);
200         gtk_container_set_border_width(GTK_CONTAINER(aspell_path_hbox), 8);     
201
202         aspell_path_entry = gtk_entry_new();
203         gtk_widget_show(aspell_path_entry);
204         gtk_box_pack_start(GTK_BOX(aspell_path_hbox), aspell_path_entry, TRUE, TRUE, 0);
205         gtk_widget_set_size_request(aspell_path_entry, 30, 20);
206
207         aspell_path_select = gtkut_get_browse_directory_btn(_("_Browse"));
208         gtk_widget_show(aspell_path_select);
209         gtk_box_pack_start(GTK_BOX(aspell_path_hbox), aspell_path_select, FALSE, FALSE, 0);
210
211         PACK_FRAME(vbox1, automatic_frame, _("Automatic spelling"));
212         vbox2 = gtk_vbox_new(FALSE, VSPACING_NARROW);
213         gtk_widget_show(vbox2);
214         gtk_container_add(GTK_CONTAINER(automatic_frame), vbox2);
215         gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);
216         
217         check_while_typing_checkbtn = gtk_check_button_new_with_label(
218                         _("Check while typing"));
219         gtk_widget_show(check_while_typing_checkbtn);
220         gtk_box_pack_start(GTK_BOX(vbox2), check_while_typing_checkbtn, TRUE, TRUE, 0);
221
222         recheck_when_changing_dict_checkbtn = gtk_check_button_new_with_label(
223                         _("Re-check message when changing dictionary"));
224         gtk_widget_show(recheck_when_changing_dict_checkbtn);
225         gtk_box_pack_start(GTK_BOX(vbox2), recheck_when_changing_dict_checkbtn, TRUE, TRUE, 0);
226         
227         PACK_FRAME(vbox1, dictionary_frame, _("Dictionary"));
228         vbox2 = gtk_vbox_new(TRUE, VSPACING_NARROW);
229         gtk_widget_show(vbox2);
230         gtk_container_add(GTK_CONTAINER(dictionary_frame), vbox2);
231         
232         table = gtk_table_new(6, 4, FALSE);
233         gtk_widget_show(table);
234         gtk_container_set_border_width(GTK_CONTAINER(table), 8);
235         gtk_table_set_row_spacings(GTK_TABLE(table), 4);
236         gtk_table_set_col_spacings(GTK_TABLE(table), 8);
237
238         gtk_box_pack_start(GTK_BOX(vbox2), table, TRUE, TRUE, 0);
239
240         default_dict_label = gtk_label_new(_("Default dictionary"));
241         gtk_widget_show(default_dict_label);
242         gtk_table_attach(GTK_TABLE (table), default_dict_label, 0, 1, 0, 1,
243                          (GtkAttachOptions) (GTK_FILL),
244                          (GtkAttachOptions) (0), 0, 2);
245         gtk_label_set_justify(GTK_LABEL(default_dict_label), GTK_JUSTIFY_RIGHT);
246         gtk_misc_set_alignment(GTK_MISC(default_dict_label), 1, 0.5);
247         
248         default_dict_optmenu = gtk_option_menu_new();
249         gtk_widget_show(default_dict_optmenu);
250         gtk_widget_set_size_request(default_dict_optmenu, 180, -1);
251         gtk_table_attach (GTK_TABLE (table), default_dict_optmenu, 1, 2, 0, 1,
252                           GTK_SHRINK, 0, 0, 0);
253
254         default_dict_optmenu_menu = gtk_menu_new();
255         gtk_option_menu_set_menu(GTK_OPTION_MENU(default_dict_optmenu),
256                         default_dict_optmenu_menu);
257
258         default_alt_dict_label = gtk_label_new(_("Default alternate dictionary"));
259         gtk_widget_show(default_alt_dict_label);
260         gtk_table_attach(GTK_TABLE (table), default_alt_dict_label, 0, 1, 1, 2,
261                          (GtkAttachOptions) (GTK_FILL),
262                          (GtkAttachOptions) (0), 0, 2);
263         gtk_label_set_justify(GTK_LABEL(default_alt_dict_label), GTK_JUSTIFY_RIGHT);
264         gtk_misc_set_alignment(GTK_MISC(default_alt_dict_label), 1, 0.5);
265         
266         default_alt_dict_optmenu = gtk_option_menu_new();
267         gtk_widget_show(default_alt_dict_optmenu);
268         gtk_widget_set_size_request(default_alt_dict_optmenu, 180, -1);
269         gtk_table_attach (GTK_TABLE (table), default_alt_dict_optmenu, 1, 2, 1, 2,
270                           GTK_SHRINK, 0, 0, 0);
271
272         default_alt_dict_optmenu_menu = gtk_menu_new();
273         gtk_option_menu_set_menu(GTK_OPTION_MENU(default_alt_dict_optmenu),
274                         default_alt_dict_optmenu_menu);
275
276         both_dict_check = gtk_check_button_new_with_label(
277                                 _("Check with both dictionaries"));
278         gtk_widget_show(both_dict_check);
279         gtk_table_attach (GTK_TABLE (table), both_dict_check, 1, 2, 2, 3,
280                           GTK_SHRINK, 0, 0, 0);
281
282
283         sugmode_label = gtk_label_new(_("Default suggestion mode"));
284         gtk_widget_show(sugmode_label);
285         gtk_table_attach(GTK_TABLE (table), sugmode_label, 0, 1, 3, 4,
286                          (GtkAttachOptions) (GTK_FILL),
287                          (GtkAttachOptions) (0), 0, 2);
288         gtk_label_set_justify(GTK_LABEL(sugmode_label), GTK_JUSTIFY_RIGHT);
289         gtk_misc_set_alignment(GTK_MISC(sugmode_label), 1, 0.5);
290
291         sugmode_optmenu = gtk_option_menu_new();
292         gtk_widget_show(sugmode_optmenu);
293         gtk_widget_set_size_request(sugmode_optmenu, 180, -1); 
294         gtk_table_attach (GTK_TABLE (table), sugmode_optmenu, 1, 2, 3, 4,
295                           GTK_SHRINK, 0, 0, 0);
296         
297         sugmode_optmenu_menu = gtk_menu_new();
298         gtk_option_menu_set_menu(GTK_OPTION_MENU(sugmode_optmenu),
299                         sugmode_optmenu_menu);
300         
301         misspelled_hbox = gtk_hbox_new(FALSE, 10);
302         gtk_widget_show(misspelled_hbox);
303         gtk_box_pack_start(GTK_BOX(vbox1), misspelled_hbox, FALSE, FALSE, 0);
304                 
305         misspelled_label = gtk_label_new(_("Misspelled word color"));
306         gtk_widget_show(misspelled_label);
307         gtk_box_pack_start(GTK_BOX(misspelled_hbox), misspelled_label,
308                 FALSE, FALSE, 0);
309         gtk_label_set_justify(GTK_LABEL(misspelled_label), GTK_JUSTIFY_RIGHT);
310         gtk_misc_set_alignment(GTK_MISC(misspelled_label), 1, 0.5);
311
312         misspelled_colorbtn = gtk_button_new_with_label("");
313         gtk_widget_show(misspelled_colorbtn);
314         gtk_box_pack_start(GTK_BOX(misspelled_hbox), misspelled_colorbtn,
315                 FALSE, FALSE, 0);
316         gtk_widget_set_size_request(misspelled_colorbtn, 30, 20);
317         tooltips = gtk_tooltips_new();
318         gtk_tooltips_set_tip(tooltips, misspelled_colorbtn,
319                              _("Pick color for misspelled word. "
320                                "Use black to underline"), NULL);
321
322         SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, automatic_frame);
323         SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, dictionary_frame);
324         SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, path_frame);
325         SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, misspelled_label);
326         SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, misspelled_colorbtn);
327         SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, use_alternate_checkbtn);
328         SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, default_alt_dict_label);
329         SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, default_alt_dict_optmenu);
330         SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, both_dict_check);
331
332         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_aspell_checkbtn),
333                         prefs_common.enable_aspell);
334         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(both_dict_check),
335                         prefs_common.use_both_dicts);
336         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_while_typing_checkbtn),
337                         prefs_common.check_while_typing);
338         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(recheck_when_changing_dict_checkbtn),
339                         prefs_common.recheck_when_changing_dict);
340         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_alternate_checkbtn),
341                         prefs_common.use_alternate);
342         gtk_entry_set_text(GTK_ENTRY(aspell_path_entry), 
343                         SAFE_STRING(prefs_common.aspell_path));
344         g_signal_connect(G_OBJECT(aspell_path_select), "clicked", 
345                          G_CALLBACK(prefs_spelling_btn_aspell_path_clicked_cb),
346                          prefs_spelling);
347         gtk_option_menu_set_menu(GTK_OPTION_MENU(default_dict_optmenu),
348                                  gtkaspell_dictionary_option_menu_new(prefs_common.aspell_path));
349         gtkaspell_set_dictionary_menu_active_item(default_dict_optmenu, prefs_common.dictionary);
350         gtk_option_menu_set_menu(GTK_OPTION_MENU(default_alt_dict_optmenu),
351                                  gtkaspell_dictionary_option_menu_new_with_refresh(prefs_common.aspell_path, FALSE));
352         gtkaspell_set_dictionary_menu_active_item(default_alt_dict_optmenu, prefs_common.alt_dictionary);
353
354         gtk_option_menu_set_menu(GTK_OPTION_MENU(sugmode_optmenu),
355                                  gtkaspell_sugmode_option_menu_new(prefs_common.aspell_sugmode));
356         gtkaspell_sugmode_option_menu_set(GTK_OPTION_MENU(sugmode_optmenu),
357                                           prefs_common.aspell_sugmode);
358         g_signal_connect(G_OBJECT(misspelled_colorbtn), "clicked",
359                          G_CALLBACK(prefs_spelling_colorsel), prefs_spelling);
360
361         prefs_spelling->misspell_col = prefs_common.misspelled_col;
362         gtkut_set_widget_bgcolor_rgb(misspelled_colorbtn, prefs_spelling->misspell_col);
363
364         prefs_spelling->window                  = GTK_WIDGET(window);
365         prefs_spelling->automatic_frame =       automatic_frame;
366         prefs_spelling->dictionary_frame =      dictionary_frame;
367         prefs_spelling->path_frame =    path_frame;
368         prefs_spelling->enable_aspell_checkbtn  = enable_aspell_checkbtn;
369         prefs_spelling->check_while_typing_checkbtn
370                 = check_while_typing_checkbtn;
371         prefs_spelling->recheck_when_changing_dict_checkbtn
372                 = recheck_when_changing_dict_checkbtn;
373         prefs_spelling->use_alternate_checkbtn  = use_alternate_checkbtn;
374         prefs_spelling->aspell_path_entry       = aspell_path_entry;
375         prefs_spelling->aspell_path_select      = aspell_path_select;
376         prefs_spelling->default_dict_label      = default_dict_label;
377         prefs_spelling->default_dict_optmenu    = default_dict_optmenu;
378         prefs_spelling->default_dict_optmenu_menu
379                 = default_dict_optmenu_menu;
380         prefs_spelling->default_alt_dict_label  = default_alt_dict_label;
381         prefs_spelling->default_alt_dict_optmenu        = default_alt_dict_optmenu;
382         prefs_spelling->default_alt_dict_optmenu_menu
383                 = default_alt_dict_optmenu_menu;
384         prefs_spelling->sugmode_label           = sugmode_label;
385         prefs_spelling->sugmode_optmenu         = sugmode_optmenu;
386         prefs_spelling->sugmode_optmenu_menu    = sugmode_optmenu_menu;
387         prefs_spelling->misspelled_label        = misspelled_label;
388         prefs_spelling->misspelled_colorbtn     = misspelled_colorbtn;
389         prefs_spelling->both_dict_check = both_dict_check;
390
391         prefs_spelling->page.widget = vbox1;
392 }
393
394 void prefs_spelling_save(PrefsPage *_page)
395 {
396         SpellingPage *spelling = (SpellingPage *) _page;
397
398         prefs_common.enable_aspell =
399                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->enable_aspell_checkbtn));
400         prefs_common.check_while_typing =
401                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->check_while_typing_checkbtn));
402         prefs_common.recheck_when_changing_dict =
403                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->recheck_when_changing_dict_checkbtn));
404         prefs_common.use_alternate =
405                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->use_alternate_checkbtn));
406         prefs_common.use_both_dicts =
407                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(spelling->both_dict_check));
408
409         g_free(prefs_common.aspell_path);
410         prefs_common.aspell_path =
411                 gtk_editable_get_chars(GTK_EDITABLE(spelling->aspell_path_entry), 0, -1);
412
413         g_free(prefs_common.dictionary);
414         prefs_common.dictionary = 
415                 gtkaspell_get_dictionary_menu_active_item(
416                         gtk_option_menu_get_menu(
417                                 GTK_OPTION_MENU(
418                                         spelling->default_dict_optmenu)));
419
420         g_free(prefs_common.alt_dictionary);
421         prefs_common.alt_dictionary = 
422                 gtkaspell_get_dictionary_menu_active_item(
423                         gtk_option_menu_get_menu(
424                                 GTK_OPTION_MENU(
425                                         spelling->default_alt_dict_optmenu)));
426
427         prefs_common.aspell_sugmode =
428                 gtkaspell_get_sugmode_from_option_menu(
429                         GTK_OPTION_MENU(spelling->sugmode_optmenu));
430
431         prefs_common.misspelled_col = spelling->misspell_col;
432 }
433
434 static void prefs_spelling_destroy_widget(PrefsPage *_page)
435 {
436         /* SpellingPage *spelling = (SpellingPage *) _page; */
437
438 }
439
440 SpellingPage *prefs_spelling;
441
442 void prefs_spelling_init(void)
443 {
444         SpellingPage *page;
445         static gchar *path[3];
446         const gchar* language = NULL;
447         
448         path[0] = _("Compose");
449         path[1] = _("Spell Checking");
450         path[2] = NULL;
451
452         page = g_new0(SpellingPage, 1);
453         page->page.path = path;
454         page->page.create_widget = prefs_spelling_create_widget;
455         page->page.destroy_widget = prefs_spelling_destroy_widget;
456         page->page.save_page = prefs_spelling_save;
457         page->page.weight = 180.0;
458
459         prefs_gtk_register_page((PrefsPage *) page);
460         prefs_spelling = page;
461         
462         language = g_getenv("LANG");
463         if (language == NULL)
464                 language = "en";
465         else if (!strcmp(language, "POSIX") || !strcmp(language, "C"))
466                 language = "en";
467         
468         if (!prefs_common.dictionary)
469                 prefs_common.dictionary = g_strdup_printf("%s%s",
470                                                 prefs_common.aspell_path,
471                                                 language);
472         if (!strlen(prefs_common.dictionary)
473         ||  !strcmp(prefs_common.dictionary,"(None"))
474                 prefs_common.dictionary = g_strdup_printf("%s%s",
475                                                 prefs_common.aspell_path,
476                                                 language);
477         if (strcasestr(prefs_common.dictionary,".utf"))
478                 *(strcasestr(prefs_common.dictionary,".utf")) = '\0';
479         if (strstr(prefs_common.dictionary,"@"))
480                 *(strstr(prefs_common.dictionary,"@")) = '\0';
481 }
482
483 void prefs_spelling_done(void)
484 {
485         prefs_gtk_unregister_page((PrefsPage *) prefs_spelling);
486         g_free(prefs_spelling);
487 }
488
489 #endif /* USE_ASPELL */