Top |
Functions
GspellChecker * | gspell_checker_new () |
const GspellLanguage * | gspell_checker_get_language () |
void | gspell_checker_set_language () |
gboolean | gspell_checker_check_word () |
GSList * | gspell_checker_get_suggestions () |
void | gspell_checker_add_word_to_personal () |
void | gspell_checker_add_word_to_session () |
void | gspell_checker_clear_session () |
void | gspell_checker_set_correction () |
EnchantDict * | gspell_checker_get_enchant_dict () |
Description
GspellChecker is a spell checker.
If the “language” property is NULL
, it means that no
dictonaries are available, in which case the GspellChecker is in a
“disabled” (but allowed) state.
gspell uses the Enchant library. The
use of Enchant is part of the gspell API, GspellChecker exposes the
EnchantDict with the gspell_checker_get_enchant_dict()
function.
Functions
gspell_checker_new ()
GspellChecker *
gspell_checker_new (const GspellLanguage *language
);
Creates a new GspellChecker. If language
is NULL
, the default language is
picked with gspell_language_get_default()
.
gspell_checker_get_language ()
const GspellLanguage *
gspell_checker_get_language (GspellChecker *checker
);
gspell_checker_set_language ()
void gspell_checker_set_language (GspellChecker *checker
,const GspellLanguage *language
);
Sets the language to use for the spell checking. If language
is NULL
, the
default language is picked with gspell_language_get_default()
.
gspell_checker_check_word ()
gboolean gspell_checker_check_word (GspellChecker *checker
,const gchar *word
,gssize word_length
,GError **error
);
If the “language” is NULL
, i.e. when no dictonaries are
available, this function returns TRUE
to limit the damage.
gspell_checker_get_suggestions ()
GSList * gspell_checker_get_suggestions (GspellChecker *checker
,const gchar *word
,gssize word_length
);
Gets the suggestions for word
. Free the return value with
g_slist_free_full(suggestions, g_free).
gspell_checker_add_word_to_personal ()
void gspell_checker_add_word_to_personal (GspellChecker *checker
,const gchar *word
,gssize word_length
);
Adds a word to the personal dictionary. It is typically saved in the user's home directory.
gspell_checker_add_word_to_session ()
void gspell_checker_add_word_to_session (GspellChecker *checker
,const gchar *word
,gssize word_length
);
Adds a word to the session dictionary. Each GspellChecker instance has a
different session dictionary. The session dictionary is lost when the
“language” property changes or when checker
is destroyed or
when gspell_checker_clear_session()
is called.
This function is typically called for an “Ignore All” action.
gspell_checker_clear_session ()
void
gspell_checker_clear_session (GspellChecker *checker
);
Clears the session dictionary.
gspell_checker_set_correction ()
void gspell_checker_set_correction (GspellChecker *checker
,const gchar *word
,gssize word_length
,const gchar *replacement
,gssize replacement_length
);
Informs the spell checker that word
is replaced/corrected by replacement
.
gspell_checker_get_enchant_dict ()
EnchantDict *
gspell_checker_get_enchant_dict (GspellChecker *checker
);
Gets the EnchantDict currently used by checker
. It permits to extend
GspellChecker with more features. Note that by doing so, the other classes
in gspell may no longer work well.
GspellChecker re-creates a new EnchantDict when the “language” is changed and when the session is cleared.
[skip]
Since: 1.6
Types and Values
enum GspellCheckerError
An error code used with GSPELL_CHECKER_ERROR
in a GError returned
from a spell-checker-related function.
GSPELL_CHECKER_ERROR
#define GSPELL_CHECKER_ERROR (gspell_checker_error_quark ())
Error domain for the spell checker. Errors in this domain will be from the GspellCheckerError enumeration. See GError for more information on error domains.
Property Details
The “language”
property
“language” GspellLanguage *
The GspellLanguage used.
Owner: GspellChecker
Flags: Read / Write / Construct
Signal Details
The “session-cleared”
signal
void user_function (GspellChecker *spell_checker, gpointer user_data)
Emitted when the session dictionary is cleared.
Parameters
spell_checker |
the GspellChecker. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “word-added-to-personal”
signal
void user_function (GspellChecker *spell_checker, gchar *word, gpointer user_data)
Emitted when a word is added to the personal dictionary.
Parameters
spell_checker |
the GspellChecker. |
|
word |
the added word. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “word-added-to-session”
signal
void user_function (GspellChecker *spell_checker, gchar *word, gpointer user_data)
Emitted when a word is added to the session dictionary. See
gspell_checker_add_word_to_session()
.
Parameters
spell_checker |
the GspellChecker. |
|
word |
the added word. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last