/* gtkspell - a spell-checking addon for GTK's TextView widget
* Copyright (c) 2002 Evan Martin
* Copyright (c) 2012-2013 Sandro Mani
GtkSpell is a library which provides MSWord/MacOSX-style highlighting of
misspelled words in a GtkTextView widget. Right-clicking a misspelled word pops
up a menu of suggested replacements.
GtkSpell depends on
* GObject Introspection
* GTK-Doc (optional)
* GTK+2 (optional)
For more information, see http://sourceforge.net/projects/gtkspell/ .
Use of the C API
The easiest way to learn is to look at the provided example programs.
It's pretty simple.
Use gtk_spell_checker_new() and gtk_spell_checker_attach() to attach a new
GtkSpellChecker to a GtkTextView.
For convenience, gtk_spell_checker_new() is created as GInitiallyUnowned
and gtk_spell_checker_attach() will sink the floating reference.
gtk_spell_checker_attach() also connects the 'destroy' signal of the
passed-in GObject to g_object_unref() the GtkSpellChecker, so in the most
common use-case, you need not worry about cleaning it up, see
However, if you want to detach and later reattach the GtkSpellChecker to a
(possibly different) GtkTextView, you must get a pointer to it with
gtk_spell_checker_get_from_text_view(), call g_object_ref() on the
resulting pointer, call gtk_spell_checker_detach() on it, call
gtk_spell_checker_attach() with the new GtkTextView, and finally call
g_object_unref() to release the reference that you took at the beginning.
Alternatively, you can sink the GtkSpellChecker immediately upon construction
with g_object_ref_sink(), in which case you will retain the ownership of the
GtkSpellChecker throughout the lifetime of the program, and you must remember
to call g_object_unref() when you don't need it any more, see
You don't need to keep a pointer to an attached GtkSpellChecker object around,
but you can retrieve it from a GtkTextView with
gtk_spell_checker_get_from_text_view() when necessary.
Once you have a pointer to a GtkSpellChecker, you can change the language it
uses with gtk_spell_checker_set_language(). Use gtk_spell_checker_detach()
to remove the GtkSpellChecker from its attached GtkTextView. Note that the
GtkSpellChecker will get destroyed when gtk_spell_checker_detach() is called
unless a reference is taken before via g_object_ref(). Finally,
gtk_spell_checker_recheck_all() is provided to re-spellcheck the entire buffer,
but it shouldn't be necessary.
An API reference can be found in the documentation. It the documentation was
not installed, gtkspell.h serves as an API reference.
The package also includes python-bindings via GObject typelibs as well as vala
bindings, if they were compiled.
Evan Martin <email@example.com> - http://neugierig.org/
Nathan Fredrickson <firstname.lastname@example.org>
Eduardo Pérez Ureta <email@example.com> - http://edpeur.blogspot.com/
Sandro Mani <firstname.lastname@example.org>
Ari Pollak <email@example.com> - Debian packages.
Alex <firstname.lastname@example.org> - Redhat packages.
Evan Nemerson - Vala bindings.