SexySpellEntry

SexySpellEntry — A GtkEntry with inline spell checking.

Synopsis

                    SexySpellEntry;
GtkWidget*          sexy_spell_entry_new                (void);
GSList*             sexy_spell_entry_get_languages      (const SexySpellEntry *entry);
gchar*              sexy_spell_entry_get_language_name  (const SexySpellEntry *entry,
                                                         const gchar *lang);
gboolean            sexy_spell_entry_language_is_active (const SexySpellEntry *entry,
                                                         const gchar *lang);
gboolean            sexy_spell_entry_activate_language  (SexySpellEntry *entry,
                                                         const gchar *lang,
                                                         GError **error);
void                sexy_spell_entry_deactivate_language
                                                        (SexySpellEntry *entry,
                                                         const gchar *lang);
gboolean            sexy_spell_entry_set_active_languages
                                                        (SexySpellEntry *entry,
                                                         GSList *langs,
                                                         GError **error);
GSList*             sexy_spell_entry_get_active_languages
                                                        (SexySpellEntry *entry);
gboolean            sexy_spell_entry_is_checked         (SexySpellEntry *entry);
void                sexy_spell_entry_set_checked        (SexySpellEntry *entry,
                                                         gboolean checked);
void                sexy_spell_entry_activate_default_languages
                                                        (SexySpellEntry *entry);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkEntry
                           +----SexySpellEntry

Implemented Interfaces

SexySpellEntry implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

Signals

  "word-check"                                     : Run Last

Description

SexySpellEntry is a GtkEntry with inline spell checking. This makes use of Enchant and allows the user to see what they've typed wrong as they type it. A right-click menu is provided for misspelled words offering suggestions.

Details

SexySpellEntry

typedef struct _SexySpellEntry SexySpellEntry;

The SexySpellEntry struct contains private data only, and should be manipulated using the functions below.


sexy_spell_entry_new ()

GtkWidget*          sexy_spell_entry_new                (void);

Creates a new SexySpellEntry widget.

Returns :

a new SexySpellEntry.

sexy_spell_entry_get_languages ()

GSList*             sexy_spell_entry_get_languages      (const SexySpellEntry *entry);

Retrieve a list of language codes for which dictionaries are available.

entry :

A SexySpellEntry.

Returns :

a new GList object, or NULL on error.

sexy_spell_entry_get_language_name ()

gchar*              sexy_spell_entry_get_language_name  (const SexySpellEntry *entry,
                                                         const gchar *lang);

Get a friendly name for a given locale.

entry :

A SexySpellEntry.

lang :

The language code to lookup a friendly name for.

Returns :

The name of the locale. Should be freed with g_free()

sexy_spell_entry_language_is_active ()

gboolean            sexy_spell_entry_language_is_active (const SexySpellEntry *entry,
                                                         const gchar *lang);

Determine if a given language is currently active.

entry :

A SexySpellEntry.

lang :

The language to use, in a form enchant understands.

Returns :

TRUE if the language is active.

sexy_spell_entry_activate_language ()

gboolean            sexy_spell_entry_activate_language  (SexySpellEntry *entry,
                                                         const gchar *lang,
                                                         GError **error);

Activate spell checking for the language specifed.

entry :

A SexySpellEntry

lang :

The language to use in a form Enchant understands. Typically either a two letter language code or a locale code in the form xx_XX.

error :

Return location for error.

Returns :

FALSE if there was an error.

sexy_spell_entry_deactivate_language ()

void                sexy_spell_entry_deactivate_language
                                                        (SexySpellEntry *entry,
                                                         const gchar *lang);

Deactivate spell checking for the language specifed.

entry :

A SexySpellEntry.

lang :

The language in a form Enchant understands. Typically either a two letter language code or a locale code in the form xx_XX.

sexy_spell_entry_set_active_languages ()

gboolean            sexy_spell_entry_set_active_languages
                                                        (SexySpellEntry *entry,
                                                         GSList *langs,
                                                         GError **error);

Activate spell checking for only the languages specified.

entry :

A SexySpellEntry

langs :

A list of language codes to activate, in a form Enchant understands. Typically either a two letter language code or a locale code in the form xx_XX.

error :

Return location for error.

Returns :

FALSE if there was an error.

sexy_spell_entry_get_active_languages ()

GSList*             sexy_spell_entry_get_active_languages
                                                        (SexySpellEntry *entry);

Retrieve a list of the currently active languages.

entry :

A SexySpellEntry

Returns :

A GSList of char* values with language codes (en, fr, etc). Both the data and the list must be freed by the user.

sexy_spell_entry_is_checked ()

gboolean            sexy_spell_entry_is_checked         (SexySpellEntry *entry);

Queries a SexySpellEntry and returns whether the entry has spell-checking enabled.

entry :

A SexySpellEntry.

Returns :

TRUE if the entry has spell-checking enabled.

sexy_spell_entry_set_checked ()

void                sexy_spell_entry_set_checked        (SexySpellEntry *entry,
                                                         gboolean checked);

Sets whether the entry has spell-checking enabled.

entry :

A SexySpellEntry.

checked :

Whether to enable spell-checking

sexy_spell_entry_activate_default_languages ()

void                sexy_spell_entry_activate_default_languages
                                                        (SexySpellEntry *entry);

Activate spell checking for languages specified in the $LANG or $LANGUAGE environment variables. These languages are activated by default, so this function need only be called if they were previously deactivated.

entry :

A SexySpellEntry.

Signal Details

The "word-check" signal

gboolean            user_function                      (SexySpellEntry *entry,
                                                        gchar          *word,
                                                        gpointer        user_data)      : Run Last

The ::word-check signal is emitted whenever the entry has to check a word. This allows the application to mark words as correct even if none of the active dictionaries contain it, such as nicknames in a chat client.

entry :

The entry on which the signal is emitted.

word :

The word to check.

user_data :

user data set when the signal handler was connected.

Returns :

FALSE to indicate that the word should be marked as correct.