gtkspell

## gtkspell gtkspell |

## Synopsis

    #include <gtkspell/gtkspell.h>

    struct              GtkSpellChecker;
    GtkSpellChecker *   gtk_spell_checker_new               (void);
    gboolean            gtk_spell_checker_attach            (GtkSpellChecker *spell,
                                                             GtkTextView *view);
    void                gtk_spell_checker_detach            (GtkSpellChecker *spell);
    gboolean            gtk_spell_checker_set_language      (GtkSpellChecker *spell,
                                                             const gchar *lang,
                                                             GError **error);
    const gchar *       gtk_spell_checker_get_language      (GtkSpellChecker *spell);
    GList *             gtk_spell_checker_get_language_list (void);
    gchar *             gtk_spell_checker_decode_language_code
                                                            (const gchar *lang);
    void                gtk_spell_checker_recheck_all       (GtkSpellChecker *spell);
    GtkSpellChecker *   gtk_spell_checker_get_from_text_view
                                                            (GtkTextView *view);
    GtkWidget *         gtk_spell_checker_get_suggestions_menu
                                                            (GtkSpellChecker *spell,
                                                             GtkTextIter *iter);
    enum                GtkSpellError;

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkSpellChecker

## Properties

      "decode-language-codes"    gboolean              : Read / Write

## Signals

      "language-changed"                               : Run Last

## Description

## Details

### struct GtkSpellChecker

    struct GtkSpellChecker;

The GtkSpellChecker struct contains only private fields.

### gtk_spell_checker_new ()

    GtkSpellChecker *   gtk_spell_checker_new               (void);

Create a new GtkSpellChecker object.

Returns : | a new GtkSpellChecker object.

### gtk_spell_checker_attach ()

    gboolean            gtk_spell_checker_attach            (GtkSpellChecker *spell,
                                                             GtkTextView *view);

Attach GtkSpellChecker object to `view`.

Note: Please read the tutorial section of the documentation to make sure you don't leak references!

`spell` : | A GtkSpellChecker.
`view` : | The GtkTextView to attach to.
Returns : | TRUE on success, FALSE on failure.

### gtk_spell_checker_detach ()

    void                gtk_spell_checker_detach            (GtkSpellChecker *spell);

Detaches this GtkSpellChecker from its GtkTextView. Use `gtk_spell_checker_get_from_text_view()` to retrieve a GtkSpellChecker from a GtkTextView. If the GtkSpellChecker is not attached to any GtkTextView, the function silently exits.

Note: if the GtkSpellChecker is owned by the GtkTextView, you must take a reference to it to prevent it from being automatically destroyed. Please read the tutorial section of the documentation!

`spell` : | A GtkSpellChecker.

### gtk_spell_checker_set_language ()

    gboolean            gtk_spell_checker_set_language      (GtkSpellChecker *spell,
                                                             const gchar *lang,
                                                             GError **error);

Set the language on `spell` to `lang`, possibily returning an error in `error`.

`spell` : | The GtkSpellChecker object.
`lang` : | The language to use, as a locale specifier (i.e. "en_US"). If NULL, attempt to use the default system locale (LANG). [allow-none]
`error` : | Return location for error. [out][allow-none]
Returns : | FALSE if there was an error.

### gtk_spell_checker_get_language ()

    const gchar *       gtk_spell_checker_get_language      (GtkSpellChecker *spell);

Fetches the current language.

`spell` : | a GtkSpellChecker
Returns : | the current language. This string is owned by the spell object and must not be modified or freed.

### gtk_spell_checker_get_language_list ()

    GList *             gtk_spell_checker_get_language_list (void);

Requests the list of available languages from the enchant broker.

Returns : | a GList of the available languages. Use g_list_free to free the list after use. [transfer full][element-type utf8]

Since 3.0.3

### gtk_spell_checker_decode_language_code ()

    gchar *             gtk_spell_checker_decode_language_code
                                                            (const gchar *lang);

Translates the language code to a human readable format (i.e. "en_US" -> "English (United States)"). Note: If the iso-codes package is not available, the unchanged code is returned.

`lang` : | The language locale specifier (i.e. "en_US").
Returns : | The translated language specifier. Use g_free to free the returned string after use. [transfer full]

Since 3.0.3

### gtk_spell_checker_recheck_all ()

    void                gtk_spell_checker_recheck_all       (GtkSpellChecker *spell);

Recheck the spelling in the entire buffer.

`spell` : | The GtkSpellChecker object.

### gtk_spell_checker_get_from_text_view ()

    GtkSpellChecker *   gtk_spell_checker_get_from_text_view
                                                            (GtkTextView *view);

Retrieves the GtkSpellChecker object attached to a text view.

`view` : | A GtkTextView.
Returns : | the GtkSpellChecker object, or `NULL` if there is no GtkSpellChecker attached to `view`. [transfer none]

### gtk_spell_checker_get_suggestions_menu ()

    GtkWidget *         gtk_spell_checker_get_suggestions_menu
                                                            (GtkSpellChecker *spell,
                                                             GtkTextIter *iter);

Retrieves a submenu of replacement spellings, or NULL if the word at `iter` is not misspelt.

`spell` : | A GtkSpellChecker.
`iter` : | Textiter of position in buffer to be corrected if necessary.
Returns : | the GtkMenu widget, or `NULL` if there is no need for a menu. [transfer full]

### enum GtkSpellError

    typedef enum {
      GTK_SPELL_ERROR_BACKEND
    } GtkSpellError;

Error codes used for GtkSpell errors.

`GTK_SPELL_ERROR_BACKEND` | Error code for backend errors

## Property Details

### The `"decode-language-codes"` property

      "decode-language-codes"    gboolean              : Read / Write

Whether to show decoded language codes in the context menu (requires the iso-codes package).

Default value: FALSE

## Signal Details

### The `"language-changed"` signal

    void                user_function                      (GtkSpellChecker *spell,
                                                            gchar           *lang,
                                                            gpointer         user_data)      : Run Last

The ::language-changed signal is emitted when the user selects a new spelling language from the context menu.

`spell` : | the GtkSpellChecker object which received the signal.
`lang` : | the new language which was selected.
`user_data` : | user data set when the signal handler was connected.