? 122110.diff
? 122117-1.diff
? 122742.diff
? Keyboard.kbd
? automatic-scanning.xam
? core.28766
? core.29900
? direct-selection.xam
? dwell-selection.xam
? foo
? gok-word-complete-3.patch
? gok-word-complete-gobject-1.patch
? gok-word-complete-gobject-2.patch
? gok.desktop
? inverse-scanning.xam
? word-complete-refactor.patch
? docs/reference/gok-decl-list.txt
? docs/reference/gok-decl.txt
? docs/reference/gok-undocumented.txt
? docs/reference/gok-unused.txt
? docs/reference/gok.args
? docs/reference/gok.hierarchy
? docs/reference/gok.signals
? docs/reference/html
? docs/reference/html-build.stamp
? docs/reference/html.stamp
? docs/reference/scan-build.stamp
? docs/reference/sgml
? docs/reference/sgml-build.stamp
? docs/reference/sgml.stamp
? docs/reference/tmpl-build.stamp
? docs/reference/tmpl.stamp
? gok/gok-word-completion-changes.txt
? gok/keyboard-geometry
? gok/test-gok-wordcomplete
? gok/test-gok-wordcomplete.c
? gok/word-complete.c.foo
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gok/ChangeLog,v
retrieving revision 1.301
diff -u -r1.301 ChangeLog
--- ChangeLog	1 Oct 2003 14:37:03 -0000	1.301
+++ ChangeLog	1 Oct 2003 15:30:38 -0000
@@ -1,3 +1,47 @@
+2003-10-01  Bill Haneman <billh@gnome.org>
+
+	* gok/gok-keyboard.c:
+	Reverted addition of new strings marked for translation.
+	(gok_keyboard_output_key): Use new API for gok_key_wordcomplete_output.
+
+	* gok/gok-word-complete.c:
+	(gok_wordcomplete_process_and_predict): Take an additional
+	param specifying the number of predicions, so that calling
+	gok_data API is not necessary.  This removes a needless dependency.
+	(gok_wordcomplete_get_output): Moved to gok-key.c, which rationalizes
+	our dependencies.
+
+	* gok/gok-word-complete.h:
+	Remove vestigial last_output member from private struct.
+
+	* gok/main.c:
+	(gok_main_initialize_wordcomplete):
+	Moved call to gok_keyslotter_on() here from gok_wordcomplete.
+	
+	* gok/Makefile.am: Include test-gok-wordcomplete in
+	uninstalled tests; include gok-utf8-word-complete.[ch]
+	in SOURCES.
+
+	* gok/test-gok-wordcomplete.c:
+	Test harness for word completion.
+
+	* gok/gok-chunker.h: Removed dependency on gok-keyboard, 
+	replaced with more lightweight dependency on gok-key.
+
+	* gok/gok-keyslotter.c:
+	(gok_keyslotter_on): Return a gboolean as our usage in main.c requires.
+	
+	* gok/gok-key.c:
+	#include gok-word-complete.h
+	(gok_key_wordcomplete_output): 
+	Moved here from gok-word-complete, where it didn't
+	belong.  Allows gok-word-complete to be used and tested
+	independent of GokKeyboard/GokKey.
+	
+	* gok/gok-utf8-word-complete.[hc]:
+	New files: utf8-safe word completion.  Not yet the
+	default completion engine.
+
 2003-10-01  Damien Carbery <damien.carbery@sun.com>
 
 	* gok/gok-scanner.c: moved variable declarations for C compile
@@ -18,6 +62,24 @@
 	
 	[Fix for bug #123561]
 
+2003-09-30  Bill Haneman <billh@gnome.org>
+
+	* gok/word-predict.c:
+	(WordCompletePredict): Make sure the returned array is NULL-terminated.
+
+	* gok/gok-word-complete.c
+ 	Refactor to remove dependencies on gok-*.[ch] from this module.
+	(gok_wordcomplete_get_output): Move to gok-key.c.
+
+	* gok/gok-key.c:
+	(gok_key_wordcomplete_output): Rename and move here from gok-word-complete.c
+	
+	* gok/test-word-complete.c:
+	New file; test harness for word-prediction (mostly a timing test at the moment).
+
+	* gok/Makefile.am:
+	Add rules for test-word-complete.
+	
 2003-09-30  Bill Haneman <billh@gnome.org>
 	
 	* gok/gok-keyboard.h:
Index: gok/Makefile.am
===================================================================
RCS file: /cvs/gnome/gok/gok/Makefile.am,v
retrieving revision 1.40
diff -u -r1.40 Makefile.am
--- gok/Makefile.am	9 Jun 2003 18:19:51 -0000	1.40
+++ gok/Makefile.am	1 Oct 2003 15:30:38 -0000
@@ -1,6 +1,6 @@
 bin_PROGRAMS = gok
 
-noinst_PROGRAMS = test-gok-action test-gok-feedback test-gok-sound test-gok-bounds keyboard-geometry
+noinst_PROGRAMS = test-gok-action test-gok-feedback test-gok-sound test-gok-bounds test-gok-wordcomplete keyboard-geometry
 
 EXTRA_DIST = \
 	test-gok-log.pl
@@ -19,7 +19,7 @@
 	$(X_LIBS) \
 	@LT_VERSION_INFO@
 
-TESTS = test-gok-action test-gok-feedback test-gok-bounds
+TESTS = test-gok-action test-gok-feedback test-gok-bounds test-gok-wordcomplete
 
 gok_SOURCES = \
 	callbacks.c callbacks.h                          \
@@ -49,6 +49,8 @@
 	gok-keyslotter.c gok-keyslotter.h                \
 	gok-word-complete.c gok-word-complete.h          \
 	word-complete.c word-complete.h                  \
+	gok-utf8-word-complete.c			 \
+	gok-utf8-word-complete.h			 \
 	gok-sound.c gok-sound.h                          \
 	gok-modifier.c gok-modifier.h                    \
 	gok-output.c gok-output.h                        \
@@ -106,5 +108,14 @@
 test_gok_bounds_SOURCES = \
 	test-gok-bounds.c                                \
 	gok-bounds.c gok-bounds.h
+
+test_gok_wordcomplete_SOURCES = \
+	test-gok-wordcomplete.c \
+	gok-word-complete.c \
+	gok-word-complete.h \
+	gok-utf8-word-complete.c \
+	gok-utf8-word-complete.h \
+	word-complete.c \
+	word-complete.h 
 
 keyboard_geometry_SOURCES = keyboard-geometry.c
Index: gok/gok-chunker.h
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-chunker.h,v
retrieving revision 1.16
diff -u -r1.16 gok-chunker.h
--- gok/gok-chunker.h	15 Jan 2003 11:55:49 -0000	1.16
+++ gok/gok-chunker.h	1 Oct 2003 15:30:39 -0000
@@ -26,7 +26,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <gnome.h>
-#include "gok-keyboard.h"
+#include "gok-key.h"
 #include "gok-button.h"
 
 #ifdef __cplusplus
Index: gok/gok-key.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-key.c,v
retrieving revision 1.71
diff -u -r1.71 gok-key.c
--- gok/gok-key.c	30 Sep 2003 13:29:10 -0000	1.71
+++ gok/gok-key.c	1 Oct 2003 15:30:42 -0000
@@ -32,6 +32,7 @@
 #include "gok-modifier.h"
 #include "gok-scanner.h"
 #include "gok-feedback.h"
+#include "gok-word-complete.h"
 #include "gok-data.h"
 #include "gok-branchback-stack.h"
 #include "gok-modifier-keymasks.h"
@@ -2213,4 +2214,60 @@
 	}
 	gok_log_leave();
 	return returncode;
+}
+
+
+static GokOutput *last_wordcomplete_output = NULL;
+
+/**
+* gok_key_wordcomplete_output
+* 
+* Gets the output for a word prediction key.
+*
+* @pKey: Pointer to the word completion key that will be output.
+*
+* returns: A pointer to the output.
+**/
+GokOutput* 
+gok_key_wordcomplete_output (GokKey *pKey, GokWordComplete *complete)
+{
+	gchar* LabelText;
+	gchar *word_part = gok_wordcomplete_get_word_part (complete);
+	g_assert (pKey != NULL);
+
+	/* make sure this is a word completion key */
+	if (pKey->Type != KEYTYPE_WORDCOMPLETE)
+	{
+		gok_log_x ("Hey, this is not a word completion key!\n");
+		return NULL;
+	}
+	
+	/* subtract the part word from the output */
+	LabelText = gok_key_get_label (pKey);
+	if (LabelText == NULL)
+	{
+		return NULL;
+	}
+	
+	if (word_part && (g_utf8_strlen (word_part, -1) < g_utf8_strlen (LabelText, -1)))
+	{
+		gchar *cp;
+                /* 
+		 * note that this won't match if the decompositions don't match. Should we
+		 * decompose to canonical first ? 
+		 */ 
+		cp = strstr (LabelText, word_part); 
+		/* sanity check: is our word_part found in our label? */
+		if (cp) {
+			gint offset = strlen (word_part); /* in bytes, not chars */
+			if (last_wordcomplete_output) gok_output_delete_all (last_wordcomplete_output);
+			last_wordcomplete_output = gok_output_new (OUTPUT_KEYSTRING, cp + offset, SPI_KEY_STRING);
+		}
+		else {
+			/* if not then we are doing a 'replace', handle that via EditableText. */
+			g_warning ("Sorry, string replacement is not yet implemented.");
+		}
+	}
+
+	return last_wordcomplete_output;
 }
Index: gok/gok-key.h
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-key.h,v
retrieving revision 1.47
diff -u -r1.47 gok-key.h
--- gok/gok-key.h	19 Sep 2003 13:42:48 -0000	1.47
+++ gok/gok-key.h	1 Oct 2003 15:30:42 -0000
@@ -33,6 +33,7 @@
 #include <gnome.h>
 #include "gok-spy-priv.h"
 #include "gok-output.h"
+#include "gok-word-complete.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -247,6 +248,7 @@
 GokKeyImage* gok_keyimage_new (GokKey *pKey, gchar* Filename);
 void gok_keyimage_delete (GokKeyImage* pKeyImage);
 gboolean gok_key_isRepeatable(GokKey* pKey);
+GokOutput* gok_key_wordcomplete_output (GokKey *pKey, GokWordComplete *complete);
 
 #ifdef __cplusplus
 }
Index: gok/gok-keyboard.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-keyboard.c,v
retrieving revision 1.101
diff -u -r1.101 gok-keyboard.c
--- gok/gok-keyboard.c	1 Oct 2003 12:02:21 -0000	1.101
+++ gok/gok-keyboard.c	1 Oct 2003 15:30:49 -0000
@@ -3134,9 +3134,9 @@
 			gok_modifier_output_pre();
 			
 			/* send the key output to the system */
-			gok_output_send_to_system (gok_wordcomplete_get_output (
-							   gok_wordcomplete_get_default (), pKey), 
-				FALSE);
+			gok_output_send_to_system (gok_key_wordcomplete_output (pKey,
+							   gok_wordcomplete_get_default ()), 
+						   FALSE);
 			
 			/* end the word with a 'space' */
 			OutputSpace.Type = OUTPUT_KEYSYM;
Index: gok/gok-keyslotter.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-keyslotter.c,v
retrieving revision 1.5
diff -u -r1.5 gok-keyslotter.c
--- gok/gok-keyslotter.c	30 Sep 2003 13:29:11 -0000	1.5
+++ gok/gok-keyslotter.c	1 Oct 2003 15:30:50 -0000
@@ -38,13 +38,14 @@
 *
 * returns: TRUE if it was opend OK, FALSE if not.
 **/
-void gok_keyslotter_on (gboolean bOnOff, int keytype)
+gboolean
+gok_keyslotter_on (gboolean bOnOff, int keytype)
 {
 	GokKeyboard* pKeyboard;
 	GokKey* pKey;
 
 	gok_log_enter();
-	
+
 	/* find all the keyboards that support word completion */
 	pKeyboard = gok_main_get_first_keyboard();
 	g_assert (pKeyboard != NULL);
@@ -53,7 +54,7 @@
 		if (((keytype == KEYTYPE_WORDCOMPLETE) && (gok_keyboard_get_supports_wordcomplete (pKeyboard) == TRUE)) ||
 		    ((keytype == KEYTYPE_COMMANDPREDICT) && (gok_keyboard_get_supports_commandprediction (pKeyboard) == TRUE)) )
 		{
-			if (bOnOff == TRUE)
+			if (bOnOff)
 			{
 				if (((keytype == KEYTYPE_WORDCOMPLETE) && (gok_keyboard_get_wordcomplete_keys_added (pKeyboard) == FALSE)) ||
 				    ((keytype == KEYTYPE_COMMANDPREDICT) && (gok_keyboard_get_commandpredict_keys_added (pKeyboard) == FALSE)) )
@@ -117,6 +118,8 @@
 		pKeyboard = pKeyboard->pKeyboardNext;
 	}
 	gok_log_leave();
+
+	return TRUE;
 }
 
 /**
Index: gok/gok-keyslotter.h
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-keyslotter.h,v
retrieving revision 1.3
diff -u -r1.3 gok-keyslotter.h
--- gok/gok-keyslotter.h	11 Oct 2002 19:00:04 -0000	1.3
+++ gok/gok-keyslotter.h	1 Oct 2003 15:30:50 -0000
@@ -29,7 +29,7 @@
 extern "C" {
 #endif /* __cplusplus */
 
-void gok_keyslotter_on (gboolean bOnOff, int keytype);
+gboolean gok_keyslotter_on (gboolean bOnOff, int keytype);
 void gok_keyslotter_change_number_predictions (int Number, int keytype);
 gboolean gok_keyslotter_add_prediction_keys (GokKeyboard* pKeyboard, int keytype);
 
Index: gok/gok-output.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-output.c,v
retrieving revision 1.18
diff -u -r1.18 gok-output.c
--- gok/gok-output.c	30 Sep 2003 13:29:11 -0000	1.18
+++ gok/gok-output.c	1 Oct 2003 15:30:50 -0000
@@ -57,7 +57,8 @@
 		case OUTPUT_KEYCODE:
 		case OUTPUT_KEYSYM:
 			prediction_list = gok_wordcomplete_process_and_predict (gok_wordcomplete_get_default (),
-										(gunichar) data);
+										(gunichar) data,
+										gok_data_get_num_predictions ());
 			gok_keyboard_set_predictions (gok_main_get_current_keyboard (),
 						      prediction_list);
 			break;
@@ -78,7 +79,8 @@
 					letter = g_utf8_get_char (string);
 					prediction_list = gok_wordcomplete_process_and_predict (
 						gok_wordcomplete_get_default (),
-						letter);
+						letter,
+						gok_data_get_num_predictions ());
 					string = g_utf8_next_char (string);
 				}
 				gok_keyboard_set_predictions (gok_main_get_current_keyboard (), 
Index: gok/gok-utf8-word-complete.c
===================================================================
RCS file: gok/gok-utf8-word-complete.c
diff -N gok/gok-utf8-word-complete.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gok/gok-utf8-word-complete.c	1 Oct 2003 15:30:50 -0000
@@ -0,0 +1,192 @@
+/* gok-utf8-word-complete.c
+*
+* Copyright 2001,2002 Sun Microsystems, Inc.,
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public
+* License along with this library; if not, write to the
+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+* Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gnome.h>
+#include "gok-log.h"
+#include "gok-utf8-word-complete.h"
+
+/* private functions */
+
+/* implementations of GokWordCompleteClass virtual methods */
+
+typedef enum 
+{
+	WORD_CASE_LOWER,
+	WORD_CASE_INITIAL_CAPS,
+	WORD_CASE_ALL_CAPS,
+	WORD_CASE_TITLE
+} WordPredictionCaseType;
+
+typedef struct
+{
+	gchar *string;
+	gint   priority;
+} WordPrediction;
+
+/* The filename of the dictionary file */
+static gchar *dictionary_full_path;
+
+/* declarations of implementation methods */
+static gchar** utf8_wordcomplete_predict_string (GokWordComplete *complete, const gchar* pWord, gint num_predictions);
+static gboolean utf8_wordcomplete_open (GokWordComplete *complete, const gchar *directory);
+
+/* private intermal methods */
+static GSList *utf8_wordcomplete_find (const gchar *word);
+static gint utf8_sort_by_priority (gconstpointer a, gconstpointer b);
+
+/* 
+ * This macro initializes GokUtf8WordComplete with the GType system 
+ *   and defines ..._class_init and ..._instance_init functions 
+ */
+GNOME_CLASS_BOILERPLATE (GokUTF8WordComplete, gok_utf8_wordcomplete,
+			 GokWordComplete, GOK_TYPE_WORDCOMPLETE)
+
+static void
+gok_utf8_wordcomplete_instance_init (GokUTF8WordComplete *complete)
+{
+}
+
+static void
+gok_utf8_wordcomplete_class_init (GokUTF8WordCompleteClass *klass)
+{
+	GokWordCompleteClass *word_complete_class = (GokWordCompleteClass *) klass;
+	word_complete_class->open = utf8_wordcomplete_open;
+	word_complete_class->predict_string = utf8_wordcomplete_predict_string;
+}
+
+static gboolean
+utf8_wordcomplete_open (GokWordComplete *complete, const gchar *directory)
+{
+	FILE *file;
+
+	gok_log ("gok_utf8_wordcomplete_open");
+	
+	gok_wordcomplete_reset (complete); /* reset, anyhow */
+
+	/* open the dictionary file */
+	dictionary_full_path = g_build_filename (directory, "dictionary.txt", NULL);
+	file = fopen (dictionary_full_path, "rt");
+	if (file == NULL)
+	{
+		/* can't open dictionary file! */
+		gok_log_x ("Can't open dictionary file in utf8_wordcomplete_open !\n");
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static gchar**
+utf8_wordcomplete_predict_string (GokWordComplete *complete, const gchar* word, gint num_predictions)
+{
+	gchar **word_predict_list = NULL;
+	gchar *normalized, *tmp;
+	gint  i, n, m = num_predictions;
+	GSList *predictions;
+	gpointer data;
+	
+	/* validate the given values */
+	if (word == NULL || num_predictions < 1)
+	{
+	  return NULL;
+	}
+	
+	word_predict_list = g_new0 (gchar *, num_predictions + 1); /* NULL-terminated */
+
+	/* convert the given string to a normalized, case-insensitive form */
+	tmp = g_utf8_normalize (word, -1, G_NORMALIZE_ALL);
+	normalized = g_utf8_casefold (tmp, -1);
+	g_free (tmp);
+
+	/* find matching words */
+	predictions = utf8_wordcomplete_find (normalized);
+
+	/* reorder according to priority */
+	predictions = g_slist_sort (predictions, utf8_sort_by_priority); 
+
+	/* convert to array of strings */
+	n = -1;
+	do
+	{
+		WordPrediction *prediction;
+		++n;
+		prediction = g_slist_nth_data (predictions, n);
+		word_predict_list [n] = prediction ? prediction->string : NULL;
+	} while (word_predict_list [n] && n < num_predictions);
+
+	word_predict_list [num_predictions] = NULL; /* in case predictions-len >= num_predictions */
+
+	/* free the extra storage; returned strings will be freed later */
+	data = g_slist_nth_data (predictions, num_predictions);
+	while (data) {
+		WordPrediction *prediction = (WordPrediction *) data;
+		m = num_predictions;
+		g_free (prediction->string);
+		g_free (prediction);
+		++m;
+		data = g_slist_nth_data (predictions, m);
+	}
+	g_slist_free (predictions);
+
+	/* were there any predictions? */
+	if (n == 0)
+	{
+		g_free (word_predict_list);
+ 	        return NULL; /* indicates no predictions made */
+	}
+
+	/* post-process the predictions to match the case of the input */
+/*	apply_case (word, word_predict_list, num_predictions); */ /* TODO!!! */
+
+	return word_predict_list; /* predictions made! */
+}
+
+static WordPrediction*
+prediction_new (const gchar *string, gint priority)
+{
+	WordPrediction *prediction = g_new0 (WordPrediction, 1);
+	prediction->string = strdup (string);
+	prediction->priority = priority;
+	return prediction;
+}
+
+static GSList *
+utf8_wordcomplete_find (const gchar *word)
+{
+	GSList *found = NULL;
+	WordPrediction *prediction;
+	found = g_slist_append (found, prediction_new ("foo", 1));
+	found = g_slist_append (found, prediction_new ("bar", 1));
+	found = g_slist_append (found, prediction_new ("kilroy", 2));
+	found = g_slist_append (found, prediction_new ("was", 2));
+	found = g_slist_append (found, prediction_new ("here", 2));
+	return found;
+}
+
+static gint
+utf8_sort_by_priority (gconstpointer a, gconstpointer b)
+{
+        WordPrediction *p_a = (WordPrediction *) a;
+	WordPrediction *p_b = (WordPrediction *) b;
+	if (a && b)
+		return p_b->priority - p_a->priority;
+	else
+		return (a) ? -1 : ((b) ? 1 : 0);
+}
Index: gok/gok-utf8-word-complete.h
===================================================================
RCS file: gok/gok-utf8-word-complete.h
diff -N gok/gok-utf8-word-complete.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gok/gok-utf8-word-complete.h	1 Oct 2003 15:30:50 -0000
@@ -0,0 +1,46 @@
+/* gok-utf8-word-complete.c
+*
+* Copyright 2001,2002 Sun Microsystems, Inc.,
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public
+* License along with this library; if not, write to the
+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+* Boston, MA 02111-1307, USA.
+*
+**/
+
+#ifndef __GOK_UTF8_WORDCOMPLETE_H__
+#define __GOK_UTF8_WORDCOMPLETE_H__
+
+#include "gok-word-complete.h"
+
+#define GOK_TYPE_UTF8WORDCOMPLETE           (gok_utf8_wordcomplete_get_type ())
+#define GOK_UTF8WORDCOMPLETE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOK_TYPE_UTF8WORDCOMPLETE, GokUTF8WordComplete))
+#define GOK_UTF8WORDCOMPLETE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, GOK_TYPE_UTF8WORDCOMPLETE, GokUTF8WordCompleteClass)
+#define GOK_IS_UTF8WORDCOMPLETE(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, GOK_TYPE_UTF8WORDCOMPLETE)
+#define GOK_IS_UTF8WORDCOMPLETE_CLASS(klass)       G_TYPE_CHECK_CLASS_TYPE (klass, GOK_TYPE_UTF8WORDCOMPLETE)
+
+typedef struct _GokUTF8WordComplete       GokUTF8WordComplete;
+typedef struct _GokUTF8WordCompleteClass  GokUTF8WordCompleteClass;
+
+struct _GokUTF8WordComplete
+{
+	GokWordComplete parent;
+};
+
+struct _GokUTF8WordCompleteClass
+{
+	GokWordCompleteClass parent_class;
+};
+
+#endif /* #ifndef _GOK_UTF8_WORDCOMPLETE_H__ */
Index: gok/gok-word-complete.c
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-word-complete.c,v
retrieving revision 1.22
diff -u -r1.22 gok-word-complete.c
--- gok/gok-word-complete.c	30 Sep 2003 13:29:11 -0000	1.22
+++ gok/gok-word-complete.c	1 Oct 2003 15:30:51 -0000
@@ -57,7 +57,6 @@
 {
         /* the word, or part word, that is getting completed */
 	gchar     *word_part;
-	GokOutput *last_output;
 };
 
 static GokWordComplete *default_wordcomplete_engine = NULL;
@@ -70,7 +69,6 @@
 {
 	complete->priv = g_new0 (GokWordCompletePrivate, 1);
 	complete->priv->word_part = NULL;
-	complete->priv->last_output = NULL;
 }
 
 static void
@@ -95,7 +93,7 @@
 gok_wordcomplete_finalize (GObject *obj)
 {
 	GokWordComplete *complete = GOK_WORDCOMPLETE (obj);
-	gok_output_delete_all (complete->priv->last_output);
+
 	if (complete && complete->priv)
 		g_free (complete->priv);
 	G_OBJECT_CLASS (GOK_WORDCOMPLETE_GET_CLASS (obj))->finalize (obj);
@@ -214,11 +212,11 @@
 array of strings representing the predicted completions.
 **/
 gchar **
-gok_wordcomplete_process_and_predict (GokWordComplete *complete, const gunichar letter)
+gok_wordcomplete_process_and_predict (GokWordComplete *complete, const gunichar letter, gint num_predictions)
 {
 	return gok_wordcomplete_predict_string (complete, 
 						gok_wordcomplete_process_unichar (complete, letter),
-						gok_data_get_num_predictions ());
+						num_predictions);
 }
 
 /**
@@ -306,60 +304,6 @@
 }
 
 /**
-* gok_wordcomplete_get_output
-* 
-* Gets the output for a word prediction key.
-*
-* @pKey: Pointer to the word completion key that will be output.
-*
-* returns: A pointer to the output.
-**/
-GokOutput* 
-gok_wordcomplete_get_output (GokWordComplete *complete, GokKey* pKey)
-{
-	/* FIXME: does this belong in gok-output.c instead? */
-	gchar* LabelText;
-	gchar *word_part = gok_wordcomplete_get_word_part (complete);
-	g_assert (pKey != NULL);
-
-	/* make sure this is a word completion key */
-	if (pKey->Type != KEYTYPE_WORDCOMPLETE)
-	{
-		gok_log_x ("Hey, this is not a word completion key!\n");
-		return NULL;
-	}
-	
-	/* subtract the part word from the output */
-	LabelText = gok_key_get_label (pKey);
-	if (LabelText == NULL)
-	{
-		return NULL;
-	}
-	
-	if (word_part && (g_utf8_strlen (word_part, -1) < g_utf8_strlen (LabelText, -1)))
-	{
-		gchar *cp;
-                /* 
-		 * note that this won't match if the decompositions don't match. Should we
-		 * decompose to canonical first ? 
-		 */ 
-		cp = strstr (LabelText, word_part); 
-		/* sanity check: is our word_part found in our label? */
-		if (cp) {
-			gint offset = strlen (word_part); /* in bytes, not chars */
-			if (complete->priv->last_output) gok_output_delete_all (complete->priv->last_output);
-			complete->priv->last_output = gok_output_new (OUTPUT_KEYSTRING, cp + offset, SPI_KEY_STRING);
-		}
-		else {
-			/* if not then we are doing a 'replace', handle that via EditableText. */
-			g_warning ("Sorry, string replacement is not yet implemented.");
-		}
-	}
-
-	return complete->priv->last_output;
-}
-
-/**
  * gok_wordcomplete_get_default:
  *
  * Returns the current default word completion engine.
@@ -470,7 +414,9 @@
 	return prefix;
 }
 
-static gchar *
+/**
+ **/
+gchar *
 gok_wordcomplete_real_get_word_part (GokWordComplete *complete)
 {
 	if (complete && complete->priv)
@@ -490,6 +436,7 @@
 gchar **
 gok_wordcomplete_real_predict (GokWordComplete *complete, gint num_predictions)
 {
-	return gok_wordcomplete_predict_string (complete, num_predictions, 
-						gok_wordcomplete_get_word_part (complete));
+	return gok_wordcomplete_predict_string (complete, 
+						gok_wordcomplete_get_word_part (complete),
+						num_predictions);
 }
Index: gok/gok-word-complete.h
===================================================================
RCS file: /cvs/gnome/gok/gok/gok-word-complete.h,v
retrieving revision 1.10
diff -u -r1.10 gok-word-complete.h
--- gok/gok-word-complete.h	30 Sep 2003 13:29:11 -0000	1.10
+++ gok/gok-word-complete.h	1 Oct 2003 15:30:51 -0000
@@ -22,8 +22,7 @@
 #ifndef __GOKWORDCOMPLETE_H__
 #define __GOKWORDCOMPLETE_H__
 
-#include "gok-keyboard.h"
-#include "gok-output.h"
+#include <glib-object.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -87,11 +86,11 @@
 
 gboolean gok_wordcomplete_add_new_word   (GokWordComplete *complete, const char* word);
 
-/* TODO: move this to gok-output! */
-GokOutput* gok_wordcomplete_get_output   (GokWordComplete *complete, GokKey* key);
-
 GokWordComplete *gok_wordcomplete_get_default (void);
-gchar**  gok_wordcomplete_process_and_predict (GokWordComplete *complete, const gunichar letter);
+gchar**  gok_wordcomplete_process_and_predict (GokWordComplete *complete, const gunichar letter, 
+					       gint num_predictions);
+
+gchar*   gok_wordcomplete_get_word_part (GokWordComplete *complete);
 
 #ifdef __cplusplus
 }
Index: gok/main.c
===================================================================
RCS file: /cvs/gnome/gok/gok/main.c,v
retrieving revision 1.112
diff -u -r1.112 main.c
--- gok/main.c	30 Sep 2003 13:29:11 -0000	1.112
+++ gok/main.c	1 Oct 2003 15:30:54 -0000
@@ -1488,7 +1488,8 @@
     else
     {
 	if ( !(gok_wordcomplete_open (gok_wordcomplete_get_default (),
-				      directory_name)) ) {
+				      directory_name)) ||
+		! (gok_keyslotter_on (gok_wordcomplete_get_default (), KEYTYPE_WORDCOMPLETE))) {
 	    gok_log_x ("Error initializing word completion");
 	}
 	
Index: gok/word-complete.c
===================================================================
RCS file: /cvs/gnome/gok/gok/word-complete.c,v
retrieving revision 1.12
diff -u -r1.12 word-complete.c
--- gok/word-complete.c	30 Sep 2003 13:29:11 -0000	1.12
+++ gok/word-complete.c	1 Oct 2003 15:30:55 -0000
@@ -26,10 +26,11 @@
 *
 */
 
-#include "word-complete.h"
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <gnome.h>
+#include "word-complete.h"
 #include "gok-log.h"
 
 /* private functions */
@@ -151,9 +152,6 @@
 	m_FirstNode.state = 0;
 	m_FirstNode.pNextNode = NULL;
 	m_FirstNode.pFirstChildNode = NULL;
-
-	/* prepare the key slotter */
-	gok_keyslotter_on(gok_data_get_wordcomplete (), KEYTYPE_WORDCOMPLETE);
 
 	/* open the dictionary file */
 	dictionary_full_path = g_build_filename (directory, "dictionary.txt", NULL);
Index: gok/word-complete.h
===================================================================
RCS file: /cvs/gnome/gok/gok/word-complete.h,v
retrieving revision 1.8
diff -u -r1.8 word-complete.h
--- gok/word-complete.h	30 Sep 2003 13:29:11 -0000	1.8
+++ gok/word-complete.h	1 Oct 2003 15:30:55 -0000
@@ -32,7 +32,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <gtk/gtk.h>
-#include <gok/gok-word-complete.h>
+#include "gok-word-complete.h"
 
 /* maximum length of a word in the dictionary */
 #define MAXWORDLENGTH 30
