After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760619 - GspellChecker: accept a NULL language
GspellChecker: accept a NULL language
Status: RESOLVED FIXED
Product: gspell
Classification: Other
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gspell maintainers
gspell maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-14 12:52 UTC by Sébastien Wilmet
Modified: 2016-01-16 15:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sébastien Wilmet 2016-01-14 12:52:38 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.
Comment 1 Sébastien Wilmet 2016-01-14 12:54:36 UTC
Of course this change would require to call gspell_language_get_default() explicitly instead of passing NULL, in case we want the default language.
Comment 2 Sébastien Wilmet 2016-01-16 14:52:26 UTC
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.
Comment 3 Sébastien Wilmet 2016-01-16 15:10:45 UTC
Done.