[latexila/spell-checking] Spell checking (test)
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/spell-checking] Spell checking (test)
- Date: Sat, 17 Sep 2011 03:35:39 +0000 (UTC)
commit e79de0fd07a488a4af684d9b296bb406b58e33f3
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Sat Sep 17 04:52:17 2011 +0200
Spell checking (test)
Thanks Dion Timmermann!
CMakeLists.txt | 3 +++
src/document_view.vala | 10 ++++++++++
vapi/gtkspell-2.0.vapi | 25 +++++++++++++++++++++++++
3 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 394a59d..1457ee2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ endif ()
find_package (PkgConfig)
pkg_check_modules (GTK REQUIRED "gtk+-2.0 >= 2.16")
pkg_check_modules (GTKSOURCEVIEW REQUIRED "gtksourceview-2.0 >= 2.10")
+pkg_check_modules (GTKSPELL REQUIRED "gtkspell-2.0")
pkg_check_modules (GEE REQUIRED "gee-1.0")
pkg_check_modules (GIO REQUIRED "gio-2.0 >= 2.28")
pkg_check_modules (UNIQUE REQUIRED "unique-1.0")
@@ -63,6 +64,7 @@ add_definitions (-include config.h)
add_definitions (
${GTK_CFLAGS}
${GTKSOURCEVIEW_CFLAGS}
+ ${GTKSPELL_CFLAGS}
${GEE_CFLAGS}
${GIO_CFLAGS}
${UNIQUE_CFLAGS}
@@ -73,6 +75,7 @@ add_definitions (
link_libraries (
${GTK_LIBRARIES}
${GTKSOURCEVIEW_LIBRARIES}
+ ${GTKSPELL_LIBRARIES}
${GEE_LIBRARIES}
${GIO_LIBRARIES}
${UNIQUE_LIBRARIES}
diff --git a/src/document_view.vala b/src/document_view.vala
index 881e8fd..08b88b3 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -79,6 +79,16 @@ public class DocumentView : Gtk.SourceView
// smart backspace (if indent with spaces)
key_press_event.connect (on_backspace);
+
+ // Spell checking
+ try
+ {
+ new Spell.attach (this, "en");
+ }
+ catch (GLib.Error e)
+ {
+ warning ("Spell checking: %s", e.message);
+ }
}
public void scroll_to_cursor (double margin = 0.25)
diff --git a/vapi/gtkspell-2.0.vapi b/vapi/gtkspell-2.0.vapi
new file mode 100644
index 0000000..7f3527f
--- /dev/null
+++ b/vapi/gtkspell-2.0.vapi
@@ -0,0 +1,25 @@
+namespace Gtk
+{
+ [CCode (cprefix = "GTKSPELL_ERROR_", cheader_filename = "gtkspell/gtkspell.h")]
+ public errordomain SpeelError
+ {
+ ERROR_BACKEND
+ }
+
+ [Compact]
+ [CCode (cheader_filename = "gtkspell/gtkspell.h", free_function = "")]
+ public class Spell
+ {
+ [CCode (cname = "gtkspell_new_attach")]
+ public Spell.attach (TextView view, string? lang) throws GLib.Error;
+ [CCode (cname = "gtkspell_get_from_text_view")]
+ public static Spell get_from_text_view (TextView view);
+ [CCode (cname = "gtkspell_detach")]
+ public void detach ();
+ [CCode (cname = "gtkspell_set_language")]
+ public bool set_language (string lang) throws GLib.Error;
+ [CCode (cname = "gtkspell_recheck_all")]
+ public void recheck_all ();
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]