GNOME Bugzilla – Bug 760619
GspellChecker: accept a NULL language
Last modified: 2016-01-16 15:10:45 UTC
From the documentation: "If the “language” is not set correctly, the spell checker should not be used. It can happen when no dictionaries are available, in which case gspell_checker_get_language() returns NULL." I don't really like that. It is easy to check if no dictionaries are available, by calling gspell_language_get_available(). If no dictionaries are available, gspell should behave without warnings/errors, even if applications don't check if a language is correctly set. It can even be useful to have a disabled state for GspellChecker. gspell_checker_check_word() would always return TRUE (word correctly spelled). At least accepting a NULL language would make the API easier to use, since there are less restrictions.
Of course this change would require to call gspell_language_get_default() explicitly instead of passing NULL, in case we want the default language.
Actually no, passing a NULL language to new() and set_language() should still pick the default language, for consistency with GspellLanguageChooser, and because it is more convenient, for example a lookup() can fail and return NULL. But a NULL language state would be allowed in the case when no dictionaries are available.
Done.