made search for accounts by email address not case sensitive
[claws.git] / src / gtkspell.c
index 94def48c1ea11def10667589a5954abf7e5d08fc..9d5594caace719cbf5800885c6f51aff9a0d9af8 100644 (file)
@@ -58,7 +58,7 @@
 #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
 
@@ -322,6 +322,14 @@ int set_path_and_dict(GtkPspell *gtkpspell, PspellConfig *config,
        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) 
@@ -330,18 +338,16 @@ int set_path_and_dict(GtkPspell *gtkpspell, PspellConfig *config,
                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;
        }
   
@@ -458,10 +464,19 @@ static void menu_change_dict(GtkWidget *w, GtkPspell *gtkpspell)
        /* 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);
 }
 
@@ -1298,7 +1313,7 @@ GSList *gtkpspell_get_dictionary_list(const gchar *pspell_path)
                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);
@@ -1403,8 +1418,8 @@ gchar *gtkpspell_get_dictionary_menu_active_item(GtkWidget *menu)
 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