Top |
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 () |
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.
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()
.
const GspellLanguage *
gspell_checker_get_language (GspellChecker *checker
);
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()
.
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.
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).
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.
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.
void
gspell_checker_clear_session (GspellChecker *checker
);
Clears the session dictionary.
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
.
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
An error code used with GSPELL_CHECKER_ERROR
in a GError returned
from a spell-checker-related function.
#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.
“language”
property“language” GspellLanguage *
The GspellLanguage used.
Owner: GspellChecker
Flags: Read / Write / Construct
“session-cleared”
signalvoid user_function (GspellChecker *spell_checker, gpointer user_data)
Emitted when the session dictionary is cleared.
spell_checker |
the GspellChecker. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“word-added-to-personal”
signalvoid user_function (GspellChecker *spell_checker, char *word, gpointer user_data)
Emitted when a word is added to the personal dictionary.
spell_checker |
the GspellChecker. |
|
word |
the added word. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“word-added-to-session”
signalvoid user_function (GspellChecker *spell_checker, char *word, gpointer user_data)
Emitted when a word is added to the session dictionary. See
gspell_checker_add_word_to_session()
.
spell_checker |
the GspellChecker. |
|
word |
the added word. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last