[gimp] Bug #658816 - Add a spellchecker to the comment editor



commit 978c96bbc6d709936ff9a3a88a68d24f4d69b497
Author: Mukund Sivaraman <muks banu com>
Date:   Mon Sep 12 19:34:51 2011 +0530

    Bug #658816 - Add a spellchecker to the comment editor
    
    This is an initial version and can be improved. Something is better
    than nothing.  :)

 app/Makefile.am                      |    4 ++++
 app/widgets/Makefile.am              |    4 ++++
 app/widgets/gimpimagecommenteditor.c |    9 +++++++++
 configure.ac                         |   24 ++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index fe00891..ab2fb15 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -201,6 +201,10 @@ gimp_2_7_LDADD = \
 	$(GIMPRC)
 
 
+if HAVE_GTKSPELL
+gimp_2_7_LDADD += $(GTKSPELL_LIBS)
+endif
+
 if ENABLE_GIMP_CONSOLE
 
 gimp_console_2_7_SOURCES = $(libapp_sources) main.c
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index 9c27642..d33071d 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -14,6 +14,10 @@ INCLUDES = \
 	$(GTK_CFLAGS)		\
 	-I$(includedir)
 
+if HAVE_GTKSPELL
+INCLUDES += $(GTKSPELL_CFLAGS)
+endif
+
 noinst_LIBRARIES = libappwidgets.a
 
 libappwidgets_a_sources = \
diff --git a/app/widgets/gimpimagecommenteditor.c b/app/widgets/gimpimagecommenteditor.c
index 5388bc0..4a76395 100644
--- a/app/widgets/gimpimagecommenteditor.c
+++ b/app/widgets/gimpimagecommenteditor.c
@@ -25,6 +25,10 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#ifdef HAVE_GTKSPELL
+#include <gtkspell/gtkspell.h>
+#endif
+
 #include "libgimpbase/gimpbase.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
@@ -100,6 +104,11 @@ gimp_image_comment_editor_init (GimpImageCommentEditor *editor)
   gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text_view), 6);
   gtk_text_view_set_right_margin (GTK_TEXT_VIEW (text_view), 6);
 
+#ifdef HAVE_GTKSPELL
+  /* FIXME: Set language here */
+  gtkspell_new_attach (GTK_TEXT_VIEW (text_view), NULL, NULL);
+#endif
+
   gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
   gtk_widget_show (text_view);
 
diff --git a/configure.ac b/configure.ac
index 6f4c8d6..c84ae68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ m4_define([libgudev_required_version], [167])
 m4_define([exif_required_version], [0.6.15])
 m4_define([lcms_required_version], [1.16])
 m4_define([libpng_required_version], [1.2.37])
+m4_define([gtkspell_required_version], [2.0.16])
 
 
 AC_INIT([GIMP], [gimp_version],
@@ -1284,6 +1285,28 @@ AC_SUBST(WEB_PAGE)
 AM_CONDITIONAL(HAVE_WEBKIT, test "x$have_webkit" = xyes)
 
 
+####################
+# Check for gtkspell
+####################
+
+AC_ARG_WITH(gtkspell, [  --without-gtkspell        don't use a spellchecker])
+
+have_gtkspell=no
+if test "x$with_gtkspell" != xno; then
+  PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= gtkspell_required_version,
+    AC_DEFINE(HAVE_GTKSPELL, 1,
+              [Define to 1 if GtkSpell is available])
+    have_gtkspell=yes,
+    have_gtkspell="no (GtkSpell not found)")
+else
+  have_gtkspell="no (GtkSpell support disabled)"
+fi
+
+AM_CONDITIONAL(HAVE_GTKSPELL, test "x$have_gtkspell" = xyes)
+AC_SUBST(GTKSPELL_LIBS)
+AC_SUBST(GTKSPELL_CFLAGS)
+
+
 ###################
 # Check for librsvg
 ###################
@@ -2255,6 +2278,7 @@ Optional Features:
 Optional Plug-Ins:
   Ascii Art:           $have_libaa
   Help Browser:        $have_webkit
+  Spellchecker:        $have_gtkspell
   LCMS:                $have_lcms
   JPEG:                $jpeg_ok
   JPEG 2000:           $have_jp2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]