Coder Social home page Coder Social logo

norwayfun / gtkspell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manisandro/gtkspell

0.0 0.0 0.0 1.41 MB

On-the-fly spell checking for GtkTextView widgets

License: GNU General Public License v2.0

Shell 3.01% C 84.22% Makefile 5.57% M4 7.20%

gtkspell's Introduction

/* gtkspell - a spell-checking addon for GTK's TextView widget
 * Copyright (c) 2002 Evan Martin
 * Copyright (c) 2012-2013 Sandro Mani
 */

Introduction
------------
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
 * GTK+3
 * Enchant
 * 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
examples/simple.c.

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
examples/advanced.c.

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.

Available bindings
------------------
The package also includes python-bindings via GObject typelibs as well as vala
bindings, if they were compiled.

Original Author
---------------
Evan Martin <[email protected]> - http://neugierig.org/

Previous Maintainers
--------------------
Nathan Fredrickson <[email protected]>
Eduardo Pérez Ureta <[email protected]> - http://edpeur.blogspot.com/

Current Maintainers
------------------
Sandro Mani <[email protected]>
Daniel Atallah

Thanks
------
Ari Pollak <[email protected]> - Debian packages.
Alex <[email protected]> - Redhat packages.
Evan Nemerson - Vala bindings.

vim: tw=72

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.