GspellEntry: gspell 1 Reference Manual

## GspellEntry GspellEntry — Spell checking support for GtkEntry |

## Functions

GspellEntry * | gspell_entry_get_from_gtk_entry ()
void | gspell_entry_basic_setup ()
GtkEntry * | gspell_entry_get_entry ()
gboolean | gspell_entry_get_inline_spell_checking ()
void | gspell_entry_set_inline_spell_checking ()

## Properties

GtkEntry * | entry | Read / Write / Construct Only
gboolean | inline-spell-checking | Read / Write

## Types and Values

| GspellEntry

## Object Hierarchy

        GObject
        ╰── GspellEntry

## Includes

    #include <gspell/gspell.h>

## Description

GspellEntry extends the GtkEntry class with inline spell checking. Misspelled words are highlighted with a red `PANGO_UNDERLINE_SINGLE`. Right-clicking a misspelled word pops up a context menu of suggested replacements. The context menu also contains an “Ignore All” item to add the misspelled word to the session dictionary. And an “Add” item to add the word to the personal dictionary.

For a basic use-case, there is the `gspell_entry_basic_setup()` convenience function.

If you don't use the `gspell_entry_basic_setup()` function, you need to call `gspell_entry_buffer_set_spell_checker()` to associate a GspellChecker to the GtkEntryBuffer.

Note that GspellEntry extends the GtkEntry class but without subclassing it, because GtkEntry is already subclassed by GtkSearchEntry for example.

`PANGO_UNDERLINE_SINGLE` is used for consistency with GspellTextView. If you want a `PANGO_UNDERLINE_ERROR` instead (a wavy underline), please fix this bug first.

## Functions

### gspell_entry_get_from_gtk_entry ()

    GspellEntry *
    gspell_entry_get_from_gtk_entry (GtkEntry *gtk_entry);

Returns the GspellEntry of `gtk_entry` . The returned object is guaranteed to be the same for the lifetime of `gtk_entry` .

#### Parameters

gtk_entry | a GtkEntry. |

#### Returns

the GspellEntry of `gtk_entry` .

[transfer none]

Since: 1.4

### gspell_entry_basic_setup ()

    void
    gspell_entry_basic_setup (GspellEntry *gspell_entry);

This function is a convenience function that does the following:

- Set a spell checker. The language chosen is the one returned by `gspell_language_get_default()`.

- Set the “inline-spell-checking” property to `TRUE`.

Example:

    1
    2
    3
    4
    5
    GtkEntry *gtk_entry;
    GspellEntry *gspell_entry;

    gspell_entry = gspell_entry_get_from_gtk_entry (gtk_entry);
    gspell_entry_basic_setup (gspell_entry);

This is equivalent to:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    GtkEntry *gtk_entry;
    GspellEntry *gspell_entry;
    GspellChecker *checker;
    GtkEntryBuffer *gtk_buffer;
    GspellEntryBuffer *gspell_buffer;

    checker = gspell_checker_new (NULL);
    gtk_buffer = gtk_entry_get_buffer (gtk_entry);
    gspell_buffer = gspell_entry_buffer_get_from_gtk_entry_buffer (gtk_buffer);
    gspell_entry_buffer_set_spell_checker (gspell_buffer, checker);
    g_object_unref (checker);

    gspell_entry = gspell_entry_get_from_gtk_entry (gtk_entry);
    gspell_entry_set_inline_spell_checking (gspell_entry, TRUE);

#### Parameters

gspell_entry | a GspellEntry. |

Since: 1.4

### gspell_entry_get_entry ()

    GtkEntry *
    gspell_entry_get_entry (GspellEntry *gspell_entry);

#### Parameters

gspell_entry | a GspellEntry. |

#### Returns

the GtkEntry of `gspell_entry` .

[transfer none]

Since: 1.4

### gspell_entry_get_inline_spell_checking ()

    gboolean
    gspell_entry_get_inline_spell_checking
                                   (GspellEntry *gspell_entry);

#### Parameters

gspell_entry | a GspellEntry. |

#### Returns

the value of the “inline-spell-checking” property.

Since: 1.4

### gspell_entry_set_inline_spell_checking ()

    void
    gspell_entry_set_inline_spell_checking
                                   (GspellEntry *gspell_entry,
                                    gboolean enable);

Sets the “inline-spell-checking” property.

#### Parameters

gspell_entry | a GspellEntry. |
enable | the new state. |

Since: 1.4

## Types and Values

### GspellEntry

    typedef struct _GspellEntry GspellEntry;

## Property Details

### The `“entry”` property

      “entry”                    GtkEntry *

The GtkEntry.

Flags: Read / Write / Construct Only

Since: 1.4

### The `“inline-spell-checking”` property

      “inline-spell-checking”    gboolean

Whether the inline spell checking is enabled.

Even if this property is `TRUE`, GspellEntry disables internally the inline spell checking in case the “visibility” property is `FALSE`.

Flags: Read / Write

Default value: FALSE

Since: 1.4