#include "gtkspell.h"
#include <pspell/pspell.h>
-
+#include <pspell/string_list.h>
/* size of the text buffer used in various word-processing routines. */
#define BUFSIZE 1024
debug_print(_("Language : %s\nSpelling: %s\nJargon: %s\nModule: %s\n"),
language, spelling, jargon, module);
+ if (temppath[strlen(temppath)-1] == G_DIR_SEPARATOR)
+ temppath[strlen(temppath)-1]= 0;
+ if (temppath) {
+ pspell_config_replace(config, "add-word-list-path", temppath);
+ debug_print(_("Pspell config: added path %s\n"), pspell_config_retrieve(config, "word-list-path"));
+ if (pspell_config_error_number(config))
+ debug_print(_("Pspell config: %s\n"), pspell_config_error_message(config));
+ }
if (language)
pspell_config_replace(config, "language-tag", language);
if (spelling)
pspell_config_replace(config, "jargon", jargon);
if (module)
pspell_config_replace(config, "module", module);
- if (temppath)
- pspell_config_replace(config, "word-list-path", temppath);
switch(gtkpspell->mode) {
case PSPELL_FASTMODE:
- pspell_config_replace(config, "sug_mode", "fast");
+ pspell_config_replace(config, "sug-mode", "fast");
break;
case PSPELL_NORMALMODE:
- pspell_config_replace(config, "sug_mode", "normal");
+ pspell_config_replace(config, "sug-mode", "normal");
break;
case PSPELL_BADSPELLERMODE:
- pspell_config_replace(config, "sug_mode", "bad-spellers");
+ pspell_config_replace(config, "sug-mode", "bad-spellers");
break;
}
/* Dict is simply the menu label */
gtk_label_get(GTK_LABEL(GTK_BIN(w)->child), (gchar **) &thelabel);
+
+ if (!strcmp2(thelabel, _("None")))
+ return;
+
thedict = g_strdup(thelabel);
/* Set path, dict, (and sug_mode ?) */
- gtkpspell_set_path_and_dict(gtkpspell, gtkpspell->path, thedict);
+ if(!gtkpspell_set_path_and_dict(gtkpspell, gtkpspell->path, thedict)) {
+ /* FIXME : try to handle this very special case */
+ debug_print("Pspell: Attempt to change to a non existant dict. I will crash after closing compose window.\n");
+ gtkpspell_detach(gtkpspell);
+ gtkpspell = gtkpspell_delete(gtkpspell);
+ }
g_free(thedict);
}
list = create_empty_dictionary_list();
}
if(list==NULL){
- debug_print(_("No dictionary found"));
+ debug_print(_("No dictionary found\n"));
list = create_empty_dictionary_list();
}
chdir(prevdir);
guchar *convert_to_pspell_encoding (const guchar *encoding)
{
guchar * pspell_encoding;
- /* Beware, strstr2 returns 0 if string is found -1 if not */
- if (!strstr2(encoding, "ISO-8859-")) {
+
+ if (strstr2(encoding, "ISO-8859-")) {
pspell_encoding = g_strdup_printf("iso8859%s", encoding+8);
}
else