GspellNavigator

GspellNavigator — Interface to navigate through misspelled words

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── GspellNavigator

Prerequisites

GspellNavigator requires GInitiallyUnowned.

Known Implementations

GspellNavigator is implemented by GspellNavigatorTextView.

Includes

#include <gspell/gspell.h>

Description

GspellNavigator is an interface to navigate through misspelled words, and correct the mistakes.

It is used by widgets like GspellCheckerDialog. The purpose is to spell-check a document one word at a time.

It is not mandatory to navigate through all the text. Depending on the context, an implementation could spell-check only the current page, or the selection, etc.

For GtkTextView, see the GspellNavigatorTextView implementation of this interface.

The GspellNavigator interface requires GInitiallyUnowned because a GspellNavigator object is meant to be passed as an argument to a GtkWidget constructor, for example gspell_checker_dialog_new(). This permits to decouple the frontend from the backend, making the GtkWidget re-usable for different GspellNavigator's.

Functions

gspell_navigator_goto_next ()

gboolean
gspell_navigator_goto_next (GspellNavigator *navigator,
                            gchar **word,
                            GspellChecker **spell_checker,
                            GError **error);

Goes to the next misspelled word. When called the first time, goes to the first misspelled word.

Parameters

navigator

a GspellNavigator.

 

word

a location to store an allocated string, or NULL. Use g_free() to free the returned string.

[out][optional]

spell_checker

a location to store the GspellChecker used, or NULL. Use g_object_unref() when no longer needed.

[out][optional][transfer full]

error

a location to a NULL GError, or NULL.

[out][optional]

Returns

TRUE if a next misspelled word has been found, FALSE if the spell checking is finished or if an error occurred.


gspell_navigator_change ()

void
gspell_navigator_change (GspellNavigator *navigator,
                         const gchar *word,
                         const gchar *change_to);

Changes the current word by change_to in the text. word must be the same as returned by the last call to gspell_navigator_goto_next().

This function doesn't call gspell_checker_set_correction(). A widget using a GspellNavigator should call gspell_checker_set_correction() in addition to this function.

Parameters

navigator

a GspellNavigator.

 

word

the word to change.

 

change_to

the replacement.

 

gspell_navigator_change_all ()

void
gspell_navigator_change_all (GspellNavigator *navigator,
                             const gchar *word,
                             const gchar *change_to);

Changes all occurrences of word by change_to in the text.

This function doesn't call gspell_checker_set_correction(). A widget using a GspellNavigator should call gspell_checker_set_correction() in addition to this function.

Parameters

navigator

a GspellNavigator.

 

word

the word to change.

 

change_to

the replacement.

 

Types and Values

GspellNavigator

typedef struct _GspellNavigator GspellNavigator;

See Also

GspellNavigatorTextView, GspellCheckerDialog