[gok] Remove command prediction code - bgo#594687



commit 903c65fc479060679b785d3a2ed99dd97ccba120
Author: Ben Konrath <ben bagu org>
Date:   Wed Sep 23 15:24:22 2009 -0400

    Remove command prediction code - bgo#594687

 gok-controls.kbd.in          |    2 +-
 gok.glade2                   |  146 ------------
 gok/Makefile.am              |   21 --
 gok/arraylist.c              |  194 ----------------
 gok/arraylist.h              |   67 ------
 gok/command-common.h         |   39 ---
 gok/command-edge-data-test.c |   71 ------
 gok/command-edge-data.c      |   84 -------
 gok/command-edge-data.h      |   53 -----
 gok/command-edge.c           |  113 ---------
 gok/command-edge.h           |   45 ----
 gok/command-graph.c          |  521 ------------------------------------------
 gok/command-graph.h          |   63 -----
 gok/command-predictor.c      |  226 ------------------
 gok/command-predictor.h      |   57 -----
 gok/command-vertex-data.c    |  198 ----------------
 gok/command-vertex-data.h    |   56 -----
 gok/command-vertex.c         |  189 ---------------
 gok/command-vertex.h         |   49 ----
 gok/global.c                 |  102 --------
 gok/global.h                 |   70 ------
 gok/gok-data.c               |   29 ---
 gok/gok-data.h               |    2 -
 gok/gok-editor.c             |    8 +-
 gok/gok-key.c                |    1 -
 gok/gok-key.h                |    2 -
 gok/gok-keyboard.c           |   93 --------
 gok/gok-keyboard.h           |    5 -
 gok/gok-keyslotter.c         |   95 +++-----
 gok/gok-keyslotter.h         |    2 -
 gok/gok-log-reader.c         |  176 --------------
 gok/gok-log-reader.h         |   46 ----
 gok/gok-predictor.c          |  357 -----------------------------
 gok/gok-predictor.h          |  140 -----------
 gok/main.c                   |   64 -----
 hide.kbd.in                  |    2 +-
 main.kbd.in                  |    2 +-
 mouse.kbd.in                 |    2 +-
 move-resize.kbd.in           |    2 +-
 quit.kbd.in                  |    2 +-
 text-operations.kbd.in       |    2 +-
 valuator.kbd.in              |    2 +-
 42 files changed, 43 insertions(+), 3357 deletions(-)
---
diff --git a/gok-controls.kbd.in b/gok-controls.kbd.in
index 60a1176..26af979 100644
--- a/gok-controls.kbd.in
+++ b/gok-controls.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="gok-controls" commandprediction="no" wordcompletion="no">
+<GOK:keyboard name="gok-controls" wordcompletion="no">
 	<GOK:key left="0" right="2" top="0" bottom="1" type="branchBack">
 		<_GOK:label>back</_GOK:label>
 	</GOK:key>
diff --git a/gok.glade2 b/gok.glade2
index 403a3d0..6edd21f 100644
--- a/gok.glade2
+++ b/gok.glade2
@@ -3873,133 +3873,6 @@
 		  <property name="fill">False</property>
 		</packing>
 	      </child>
-
-	      <child>
-		<widget class="GtkFrame" id="frame12">
-		  <property name="border_width">12</property>
-		  <property name="visible">True</property>
-		  <property name="label_xalign">0</property>
-		  <property name="label_yalign">0.5</property>
-		  <property name="shadow_type">GTK_SHADOW_NONE</property>
-
-		  <child>
-		    <widget class="GtkVBox" id="vbox12">
-		      <property name="border_width">6</property>
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">6</property>
-
-		      <child>
-			<widget class="GtkCheckButton" id="checkCommandPrediction">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">Enable co_mmand prediction</property>
-			  <property name="use_underline">True</property>
-			  <property name="relief">GTK_RELIEF_NORMAL</property>
-			  <property name="focus_on_click">True</property>
-			  <property name="active">False</property>
-			  <property name="inconsistent">False</property>
-			  <property name="draw_indicator">True</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkHBox" id="hbox26">
-			  <property name="visible">True</property>
-			  <property name="homogeneous">False</property>
-			  <property name="spacing">5</property>
-
-			  <child>
-			    <widget class="GtkLabel" id="label37">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">Number of _predictions:</property>
-			      <property name="use_underline">True</property>
-			      <property name="use_markup">False</property>
-			      <property name="justify">GTK_JUSTIFY_LEFT</property>
-			      <property name="wrap">False</property>
-			      <property name="selectable">False</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			      <property name="mnemonic_widget">spinNumberCommandPredictions</property>
-			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			      <property name="width_chars">-1</property>
-			      <property name="single_line_mode">False</property>
-			      <property name="angle">0</property>
-			      <accessibility>
-				<atkproperty name="AtkObject::accessible_name" translatable="yes">Number of command predictions:</atkproperty>
-			      </accessibility>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkSpinButton" id="spinNumberCommandPredictions">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="climb_rate">1</property>
-			      <property name="digits">0</property>
-			      <property name="numeric">False</property>
-			      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-			      <property name="snap_to_ticks">False</property>
-			      <property name="wrap">False</property>
-			      <property name="adjustment">5 2 12 1 3 0</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">True</property>
-			  <property name="fill">True</property>
-			</packing>
-		      </child>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkLabel" id="label35">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">&lt;b&gt;Command Prediction&lt;/b&gt;</property>
-		      <property name="use_underline">False</property>
-		      <property name="use_markup">True</property>
-		      <property name="justify">GTK_JUSTIFY_LEFT</property>
-		      <property name="wrap">False</property>
-		      <property name="selectable">False</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		      <property name="width_chars">-1</property>
-		      <property name="single_line_mode">False</property>
-		      <property name="angle">0</property>
-		    </widget>
-		    <packing>
-		      <property name="type">label_item</property>
-		    </packing>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
 	    </widget>
 	    <packing>
 	      <property name="tab_expand">False</property>
@@ -4360,25 +4233,6 @@
 		      <property name="fill">False</property>
 		    </packing>
 		  </child>
-
-		  <child>
-		    <widget class="GtkCheckButton" id="checkbutton2">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="label" translatable="yes">Command Prediction</property>
-		      <property name="use_underline">True</property>
-		      <property name="relief">GTK_RELIEF_NORMAL</property>
-		      <property name="focus_on_click">True</property>
-		      <property name="active">False</property>
-		      <property name="inconsistent">False</property>
-		      <property name="draw_indicator">True</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
 		</widget>
 	      </child>
 
diff --git a/gok/Makefile.am b/gok/Makefile.am
index 99514f1..85099c1 100644
--- a/gok/Makefile.am
+++ b/gok/Makefile.am
@@ -73,27 +73,6 @@ gok_SOURCES = \
 	gok-log.c gok-log.h gok-log-priv.h               \
 	gok-gconf-keys.h                                 \
 	gok-editor.c gok-editor.h                        \
-	global.h                                         \
-	global.c                                         \
-	arraylist.h                                      \
-	arraylist.c                                      \
-	command-common.h                                 \
-	command-vertex-data.h                            \
-	command-vertex-data.c                            \
-	command-edge-data.h                              \
-	command-edge-data.c                              \
-	command-vertex.h                                 \
-	command-vertex.c                                 \
-	command-edge.h                                   \
-	command-edge.c                                   \
-	command-graph.h                                  \
-	command-graph.c                                  \
-	command-predictor.h                              \
-	command-predictor.c                              \
-	gok-log-reader.h                                 \
-	gok-log-reader.c                                 \
-	gok-predictor.h                                  \
-	gok-predictor.c                                  \
 	gok-gconf.c gok-gconf.h                          \
 	gok-bounds.c gok-bounds.h                       \
 	gok-feedback.c gok-feedback.h			\
diff --git a/gok/gok-data.c b/gok/gok-data.c
index 23e43e1..4e90e91 100644
--- a/gok/gok-data.c
+++ b/gok/gok-data.c
@@ -59,7 +59,6 @@ static gint m_GokKeyboardX;
 static gint m_GokKeyboardY;
 static gboolean m_bKeysizePriority;
 static gboolean m_bWordCompleteOn;
-static gboolean m_bCommandPredictOn;
 static gint m_NumberPredictions;
 static gchar *m_NameAccessMethod = NULL;
 static gboolean m_bUseGtkPlusTheme;
@@ -104,7 +103,6 @@ void gok_data_initialize ()
 	m_bKeysizePriority = TRUE;
 	gok_data_set_name_accessmethod_internal ("directselection");
 	m_bWordCompleteOn = FALSE;
-	m_bCommandPredictOn = FALSE;
 	m_NumberPredictions = 5;
 	m_bUseGtkPlusTheme = FALSE;
 	m_bExpandWindow = TRUE;
@@ -967,33 +965,6 @@ void gok_data_set_wordcomplete (gboolean bTrueFalse)
 }
 
 /**
- * gok_data_get_wordcomplete:
- *
- * Returns: TRUE if word completion is turned on, FALSE if it's turned off.
- */
-gboolean gok_data_get_commandprediction ()
-{
-	/* don't use during login mode */
-	if (gok_main_get_login()) {
-		return FALSE;
-	}
-	return TRUE;/* TODO m_bCommandPredictOn;*/
-}
-
-/**
- * gok_data_set_wordcomplete:
- * @bTrueFalse: The flag setting the word completion state.
- */
-void gok_data_set_commandprediction (gboolean bTrueFalse)
-{
-	m_bCommandPredictOn = bTrueFalse;
-/*	gok_gconf_set_bool (gconf_client, GOK_GCONF_WORD_COMPLETE,
-				 m_bWordCompleteOn);
-	m_bSettingsChanged = TRUE;
-	*/
-}
-
-/**
  * gok_data_get_num_predictions:
  *
  * Returns: The maximum number of word predictions.
diff --git a/gok/gok-data.h b/gok/gok-data.h
index e88677a..d61ad9f 100644
--- a/gok/gok-data.h
+++ b/gok/gok-data.h
@@ -100,8 +100,6 @@ char* gok_data_get_name_accessmethod (void);
 void	gok_data_set_name_accessmethod (const gchar* Name);
 gboolean gok_data_get_wordcomplete (void);
 void gok_data_set_wordcomplete (gboolean bTrueFalse);
-gboolean gok_data_get_commandprediction();
-void gok_data_set_commandprediction(gboolean bTrueFalse);
 gint gok_data_get_num_predictions (void);
 void gok_data_set_num_predictions(gint Number);
 void gok_data_backup_settings (void);
diff --git a/gok/gok-editor.c b/gok/gok-editor.c
index 582b2f4..73459b2 100644
--- a/gok/gok-editor.c
+++ b/gok/gok-editor.c
@@ -211,8 +211,6 @@ void gok_editor_new_file ()
 	m_pKeyboard = gok_keyboard_new();
 	gok_keyboard_set_name (m_pKeyboard, _("new"));
 	m_pKeyboard->bSupportsWordCompletion = FALSE;
-	m_pKeyboard->bSupportsCommandPrediction = FALSE;
-	
 
 	gok_editor_add_key();
 	gok_editor_add_key();
@@ -699,7 +697,6 @@ gboolean gok_editor_save_keyboard (GokKeyboard* pKeyboard, gchar* Filename)
 	FILE* pFile;
 	gchar yes[]="yes";
 	gchar no[]="no";
-	gchar* pCommandYesNo;
 	gchar* pCompletionYesNo;
 	GokKey* pKey;
 	GokKeyLabel* pLabel;
@@ -717,10 +714,9 @@ gboolean gok_editor_save_keyboard (GokKeyboard* pKeyboard, gchar* Filename)
 	fputs ("<?xml version=\"1.0\"?>\n", pFile);
 	fputs ("<GOK:GokFile xmlns:GOK=\"http://www.gnome.org/GOK\";>\n\n", pFile);
 
-	pCommandYesNo = (pKeyboard->bSupportsCommandPrediction == TRUE) ? yes : no;
 	pCompletionYesNo = (pKeyboard->bSupportsWordCompletion == TRUE) ? yes : no;
-	fprintf (pFile, "<GOK:keyboard name=\"%s\" commandprediction=\"%s\" wordcompletion=\"%s\">\n",
-					pKeyboard->Name, pCommandYesNo, pCompletionYesNo);
+	fprintf (pFile, "<GOK:keyboard name=\"%s\" wordcompletion=\"%s\">\n",
+					pKeyboard->Name, pCompletionYesNo);
 	
 	pKey = pKeyboard->pKeyFirst;
 	while (pKey != NULL)
diff --git a/gok/gok-key.c b/gok/gok-key.c
index 3d25fbf..a88ba19 100644
--- a/gok/gok-key.c
+++ b/gok/gok-key.c
@@ -681,7 +681,6 @@ GokKey* gok_key_new (GokKey* pKeyPrevious, GokKey* pKeyNext, GokKeyboard* pKeybo
 	pgok_key_new->BottomWin = 0;
 	pgok_key_new->LeftWin = 0;
 	pgok_key_new->RightWin = 0;
-	pgok_key_new->pMimicKey = NULL;
 	pgok_key_new->pKeyNext = pKeyNext;
 	pgok_key_new->pKeyPrevious = pKeyPrevious;
 	pgok_key_new->accessible_node = NULL;
diff --git a/gok/gok-key.h b/gok/gok-key.h
index c3ef5c0..98b577f 100644
--- a/gok/gok-key.h
+++ b/gok/gok-key.h
@@ -67,7 +67,6 @@ KEYTYPE_BRANCHALPHABET,
 KEYTYPE_SETTINGS,
 KEYTYPE_SPELL,
 KEYTYPE_WORDCOMPLETE,
-KEYTYPE_COMMANDPREDICT,
 KEYTYPE_WINDOW,
 KEYTYPE_MOVERESIZE,
 KEYTYPE_POINTERCONTROL,
@@ -231,7 +230,6 @@ typedef struct GokKey{
 	gint BottomWin;
 	gint LeftWin;
 	gint RightWin;
-	struct GokKey* pMimicKey;
 
 	struct GokKey* pKeyNext;
 	struct GokKey* pKeyPrevious;
diff --git a/gok/gok-keyboard.c b/gok/gok-keyboard.c
index 7870fdd..94d2497 100644
--- a/gok/gok-keyboard.c
+++ b/gok/gok-keyboard.c
@@ -46,7 +46,6 @@
 #include "gok-log.h"
 #include "gok-modifier.h"
 #include "gok-output.h"
-#include "gok-predictor.h"
 #include "gok-composer.h"
 #include "gok-windowlister.h"
 #include "gok-settings-dialog.h"
@@ -770,7 +769,6 @@ gok_keyboard_compose_create (gchar *keyboard_name, KeyboardLayouts layout_type)
 	pKeyboard->bRequiresLayout = FALSE;
 	pKeyboard->bLaidOut = TRUE;
 	pKeyboard->bSupportsWordCompletion = TRUE;
-	pKeyboard->bSupportsCommandPrediction = FALSE;
 	pKeyboard->LayoutType = layout_type;
 	gok_log("gok_main_get_login");
 
@@ -1148,21 +1146,6 @@ gboolean gok_keyboard_add_keys (GokKeyboard* pKeyboard, xmlDoc* pDoc)
 	}
         xmlFree (pStringAttributeValue);
 
-	/* get the command prediction on/off flag */
-	pStringAttributeValue = xmlGetProp (pNodeKeyboard, (const xmlChar *) "commandprediction");
-	if (pStringAttributeValue != NULL)
-	{
-		if (xmlStrcmp (pStringAttributeValue, (const xmlChar *) "yes") == 0)
-		{
-			pKeyboard->bSupportsCommandPrediction = TRUE;
-		}
-		else
-		{
-			pKeyboard->bSupportsCommandPrediction = FALSE;
-		}
-	}
-        xmlFree (pStringAttributeValue);
-
 	/* get the type of the keyboard (this attribute is optional) */
 	pStringAttributeValue = xmlGetProp (pNodeKeyboard, (const xmlChar *) "layouttype");
 	if (pStringAttributeValue != NULL)
@@ -1329,9 +1312,7 @@ GokKeyboard* gok_keyboard_new ()
 	pGokKeyboardNew->bRequiresChunking = FALSE;
 	pGokKeyboardNew->pChunkFirst = NULL;
 	pGokKeyboardNew->bSupportsWordCompletion = FALSE;
-	pGokKeyboardNew->bSupportsCommandPrediction = FALSE;
 	pGokKeyboardNew->bWordCompletionKeysAdded = FALSE;
-	pGokKeyboardNew->bCommandPredictionKeysAdded = FALSE;
 	pGokKeyboardNew->expand = GOK_EXPAND_SOMETIMES;
 	pGokKeyboardNew->pAccessible = NULL;
 	pGokKeyboardNew->keyWidth = 0;
@@ -1375,27 +1356,6 @@ void gok_keyboard_set_wordcomplete_keys_added (GokKeyboard* pKeyboard, gboolean
 }
 
 /**
-* gok_keyboard_get_commandpredict_keys_added
-* @pKeyboard: Pointer to the keyboard that we're testing.
-*
-* returns: TRUE if the given keyboard has the word completion keys added, FALSE if not.
-**/
-gboolean gok_keyboard_get_commandpredict_keys_added (GokKeyboard* pKeyboard)
-{
-	return pKeyboard->bCommandPredictionKeysAdded;	
-}
-
-/**
-* gok_keyboard_set_commandpredict_keys_added
-* @pKeyboard: Pointer to the keyboard that is changed.
-* @bTrueFalse: TRUE if you want the prediction keys added, FALSE if not.
-**/
-void gok_keyboard_set_commandpredict_keys_added (GokKeyboard* pKeyboard, gboolean bTrueFalse)
-{
-	pKeyboard->bCommandPredictionKeysAdded = bTrueFalse;	
-}
-
-/**
 * gok_keyboard_get_accessible
 * @pKeyboard: Pointer to the keyboard that we're using
 *
@@ -1454,21 +1414,6 @@ gboolean gok_keyboard_get_supports_wordcomplete (GokKeyboard* pKeyboard)
 }
 
 /**
-* gok_keyboard_get_supports_commandprediction
-* @pKeyboard: Pointer to the keyboard that we're testing.
-*
-* returns: TRUE if the given keyboard supports command prediction.
-* Any keyboard can support command prediction..
-**/
-gboolean gok_keyboard_get_supports_commandprediction (GokKeyboard* pKeyboard)
-{
-	gok_log_enter();
-	g_assert (pKeyboard != NULL);
-	gok_log_leave();
-	return pKeyboard->bSupportsCommandPrediction;	
-}
-
-/**
 * gok_keyboard_count_rows_columns
 * @pKeyboard: Pointer to the keyboard that we want to get the rows and columns for.
 *
@@ -3988,11 +3933,6 @@ GokKey* gok_keyboard_output_key(GokKeyboard *keyboard, GokKey* pKey)
 			gok_settingsdialog_show();
 			break;
 				
-		case KEYTYPE_COMMANDPREDICT:
-		        return gok_keyboard_output_key (gok_main_get_current_keyboard (),
-							pKey->pMimicKey);
-			break;
-			
 		case KEYTYPE_POINTERCONTROL:	
 			gok_data_set_drive_corepointer (
 			!gok_data_get_drive_corepointer ());
@@ -4081,38 +4021,6 @@ GokKey* gok_keyboard_output_key(GokKeyboard *keyboard, GokKey* pKey)
 			/* output any modifier keys */
 			gok_modifier_output_pre();
 		
-			/* TODO: add check to see if command prediciton turned on ?*/
-	#ifdef WHENCOMMANDPREDICTIONINGOKDATAISHOOKEDUPTOPREFS
-			{			
-				pPredictedKeyboard = NULL;
-				pKeyboardTemp = gok_main_get_first_keyboard();
-				g_assert (pKeyboardTemp != NULL);
-				while (pKeyboardTemp != NULL)
-				{
-					pKeyTemp = pKeyboardTemp->pKeyFirst;
-					while (pKeyTemp != NULL)
-					{
-							if (pKeyTemp == pKey)
-							{
-								pPredictedKeyboard = pKeyboardTemp;
-								break;
-							}
-							pKeyTemp = pKeyTemp->pKeyNext;
-					}
-					if (pPredictedKeyboard != NULL)
-					{
-						break;
-					}
-					pKeyboardTemp = pKeyboardTemp->pKeyboardNext;
-				}
-				if (pPredictedKeyboard != NULL)
-				{								
-					gok_predictor_log(gok_main_get_command_predictor(),
-						gok_keyboard_get_name(pPredictedKeyboard), 
-							gok_key_get_label(pKey) );
-				}
-			}
-	#endif /* WHENCOMMANDPREDICTIONINGOKDATAISHOOKEDUPTOPREFS */
 			/* send the key output to the system */
 			gok_output_send_to_system (pKey->pOutput, TRUE);
 			
@@ -4635,7 +4543,6 @@ gok_keyboard_parse_direction (const gchar *string)
 	return GOK_DIRECTION_NONE;
 }
 
-/* TODO: extend the list to allow command predictions as well */
 gint
 gok_keyboard_set_predictions (GokKeyboard *pKeyboard, gchar **list, gchar *add_word)
 {
diff --git a/gok/gok-keyboard.h b/gok/gok-keyboard.h
index 89e95f1..56ef1a6 100644
--- a/gok/gok-keyboard.h
+++ b/gok/gok-keyboard.h
@@ -127,9 +127,7 @@ typedef struct GokKeyboard {
 	gboolean bRequiresLayout;
 	gboolean bLaidOut;
 	gboolean bSupportsWordCompletion;
-	gboolean bSupportsCommandPrediction;
 	gboolean bWordCompletionKeysAdded;
-	gboolean bCommandPredictionKeysAdded;
 	GokKeyboardExpandPolicy expand;
 	Accessible* pAccessible;
 	GokSpySearchType search_type;
@@ -159,11 +157,8 @@ gboolean gok_keyboard_add_keys (GokKeyboard* pKeyboard, xmlDoc* pDoc);
 gchar* gok_keyboard_get_name (GokKeyboard* pKeyboard);
 void gok_keyboard_set_name (GokKeyboard* pKeyboard, gchar* Name);
 gboolean gok_keyboard_get_supports_wordcomplete (GokKeyboard* pKeyboard);
-gboolean gok_keyboard_get_supports_commandprediction (GokKeyboard* pKeyboard);
 void gok_keyboard_set_wordcomplete_keys_added (GokKeyboard* pKeyboard, gboolean bTrueFalse);
 gboolean gok_keyboard_get_wordcomplete_keys_added (GokKeyboard* pKeyboard);
-void gok_keyboard_set_commandpredict_keys_added (GokKeyboard* pKeyboard, gboolean bTrueFalse);
-gboolean gok_keyboard_get_commandpredict_keys_added (GokKeyboard* pKeyboard);
 void gok_keyboard_paint_pointer (GokKeyboard *pKeyboard, GtkWidget *pWindowMain, gint x, gint y);
 void gok_keyboard_unpaint_pointer (GokKeyboard *pKeyboard, GtkWidget *pWindowMain);
 gboolean gok_keyboard_display (GokKeyboard* pKeyboard, GokKeyboard* pKeyboardCurrent, GtkWidget* pWindowMain, gboolean CallbackScanner);
diff --git a/gok/gok-keyslotter.c b/gok/gok-keyslotter.c
index c0f968d..ce2e4b2 100644
--- a/gok/gok-keyslotter.c
+++ b/gok/gok-keyslotter.c
@@ -29,14 +29,14 @@
 #include "gok-word-complete.h"
 #include "gok-log.h"
 
-/* programmer's note: this could do with some more generalization work */
+static gboolean gok_keyslotter_add_wordcomplete_keys (GokKeyboard* pKeyboard);
 
 /**
 * gok_keyslotter_open
 * 
 * Opens and initializes the appropriate engine.
 *
-* returns: TRUE if it was opend OK, FALSE if not.
+* returns: TRUE if it was opened OK, FALSE if not.
 **/
 gboolean
 gok_keyslotter_on (gboolean bOnOff, int keytype)
@@ -51,13 +51,11 @@ gok_keyslotter_on (gboolean bOnOff, int keytype)
 	g_assert (pKeyboard != NULL);
 	while (pKeyboard != NULL)
 	{
-		if (((keytype == KEYTYPE_WORDCOMPLETE) && (gok_keyboard_get_supports_wordcomplete (pKeyboard) == TRUE)) ||
-		    ((keytype == KEYTYPE_COMMANDPREDICT) && (gok_keyboard_get_supports_commandprediction (pKeyboard) == TRUE)) )
+		if ((keytype == KEYTYPE_WORDCOMPLETE) && (gok_keyboard_get_supports_wordcomplete (pKeyboard) == 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)) )
+				if (gok_keyboard_get_wordcomplete_keys_added (pKeyboard) == FALSE) 
 				{
 					/* add the word completion keys to the keyboard */
 					/* first, move all the keys down one row */
@@ -72,20 +70,12 @@ gok_keyslotter_on (gboolean bOnOff, int keytype)
 
 					/* add new slot keys */
 					pKeyboard->NumberRows += 1;
-					if (keytype == KEYTYPE_WORDCOMPLETE)
-					{
-						gok_keyslotter_add_prediction_keys (pKeyboard, keytype);
-					}
-					else if (keytype == KEYTYPE_COMMANDPREDICT)
-					{
-						gok_keyslotter_add_prediction_keys (pKeyboard, keytype);
-					}
+					gok_keyslotter_add_wordcomplete_keys (pKeyboard);
 				}
 			}
 			else /* remove the slot keys from the keyboard */
 			{
-				if (((keytype == KEYTYPE_WORDCOMPLETE) && (gok_keyboard_get_wordcomplete_keys_added (pKeyboard) == TRUE)) ||
-				    ((keytype == KEYTYPE_COMMANDPREDICT) && (gok_keyboard_get_commandpredict_keys_added (pKeyboard) == TRUE)) )
+				if (gok_keyboard_get_wordcomplete_keys_added (pKeyboard) == TRUE)
 				{
 					pKey = pKeyboard->pKeyFirst;
 					while (pKey != NULL)
@@ -103,14 +93,7 @@ gok_keyslotter_on (gboolean bOnOff, int keytype)
 						
 						pKey = pKey->pKeyNext;
 					}
-					if (keytype == KEYTYPE_WORDCOMPLETE)
-					{
-						gok_keyboard_set_wordcomplete_keys_added (pKeyboard, FALSE);
-					}
-					else if (keytype == KEYTYPE_COMMANDPREDICT)
-					{
-						gok_keyboard_set_commandpredict_keys_added (pKeyboard, FALSE);
-					}
+					gok_keyboard_set_wordcomplete_keys_added (pKeyboard, FALSE);
 					pKeyboard->NumberRows -= 1;
 				}
 			}
@@ -150,8 +133,7 @@ void gok_keyslotter_change_number_predictions (int Number, int keytype)
 	g_assert (pKeyboard != NULL);
 	while (pKeyboard != NULL)
 	{
-		if ( ((keytype == KEYTYPE_WORDCOMPLETE) &&( gok_keyboard_get_supports_wordcomplete (pKeyboard) == TRUE)) ||
-		     ((keytype == KEYTYPE_COMMANDPREDICT) &&( gok_keyboard_get_supports_commandprediction (pKeyboard) == TRUE) ))
+		if ((keytype == KEYTYPE_WORDCOMPLETE) &&( gok_keyboard_get_supports_wordcomplete (pKeyboard) == TRUE))
 		{
 			/* remove all the word completion keys from the keyboard */
 			pKey = pKeyboard->pKeyFirst;
@@ -165,7 +147,7 @@ void gok_keyslotter_change_number_predictions (int Number, int keytype)
 			}
 			
 			/* add new slot keys */
-			gok_keyslotter_add_prediction_keys (pKeyboard, keytype);
+			gok_keyslotter_add_wordcomplete_keys (pKeyboard);
 		}
 		pKeyboard = pKeyboard->pKeyboardNext;
 	}
@@ -173,7 +155,7 @@ void gok_keyslotter_change_number_predictions (int Number, int keytype)
 
 
 /**
-* gok_keyslotter_add_prediction_keys
+* gok_keyslotter_add_wordcomplete_keys
 *
 * @pKeyboard: Pointer to the keyboard that gets the new prediction keys.
 *
@@ -181,7 +163,7 @@ void gok_keyslotter_change_number_predictions (int Number, int keytype)
 *
 * returns: TRUE if the prediction keys were added, FALSE if not.
 **/
-gboolean gok_keyslotter_add_prediction_keys (GokKeyboard* pKeyboard, int keytype)
+static gboolean gok_keyslotter_add_wordcomplete_keys (GokKeyboard* pKeyboard)
 {
 	GokKey* pKeyNew;
 	GokKey* pKeyPrevious, *pKeyNext;
@@ -207,60 +189,49 @@ gboolean gok_keyslotter_add_prediction_keys (GokKeyboard* pKeyboard, int keytype
 	}
 
 	/* calculate the size of each key */
-	colperkey = maxcols / (keytype == KEYTYPE_WORDCOMPLETE ? (numPredictions + 1) : numPredictions);
+	colperkey = maxcols / (numPredictions + 1);
 
 	/* add new keys */
 	colleft = 0;
 	colright = colperkey;
 	for (count = 0; count < numPredictions; count++)
 	{
-		pKeyNew = gok_key_new (pKeyPrevious, 
-				       (keytype == KEYTYPE_WORDCOMPLETE || (count != numPredictions - 1)) ? NULL : pKeyNext, 
-				       pKeyboard);
+		pKeyNew = gok_key_new (pKeyPrevious, NULL, pKeyboard);
 						
 		pKeyNew->Top = 0;
 		pKeyNew->Bottom = 1;
 		pKeyNew->Left = colleft;
 		pKeyNew->Right = colright;
 		pKeyNew->FontSizeGroup = FONT_SIZE_GROUP_WORDCOMPLETE; /* TODO? */
-		pKeyNew->Type = keytype;
-		pKeyNew->Style = KEYSTYLE_WORDCOMPLETE; /* TODO for command prediction use original keys style.*/
+		pKeyNew->Type = KEYTYPE_WORDCOMPLETE;
+		pKeyNew->Style = KEYSTYLE_WORDCOMPLETE;
 
 		colleft = colright;
 		colright += colperkey;
-						
+
 		pKeyPrevious = pKeyNew;
 	}
-	if (keytype == KEYTYPE_WORDCOMPLETE) 
-	{
-	    /* add an ADDWORD key */
-	    pKeyNew = gok_key_new (pKeyPrevious, pKeyNext, pKeyboard);
-	    
-	    pKeyNew->Top = 0;
-	    pKeyNew->Bottom = 1;
-	    pKeyNew->Left = colleft;
-	    pKeyNew->Right = colright;
-	    pKeyNew->FontSizeGroup = FONT_SIZE_GROUP_UNIQUE;
-	    pKeyNew->Type = KEYTYPE_ADDWORD;
-	    pKeyNew->Style = KEYSTYLE_ADDWORD; 
-	    
-	    colleft = colright;
-	    colright += colperkey;
-	    
-	    pKeyPrevious = pKeyNew;
-	}
+
+	/* add an ADDWORD key */
+	pKeyNew = gok_key_new (pKeyPrevious, pKeyNext, pKeyboard);
+
+	pKeyNew->Top = 0;
+	pKeyNew->Bottom = 1;
+	pKeyNew->Left = colleft;
+	pKeyNew->Right = colright;
+	pKeyNew->FontSizeGroup = FONT_SIZE_GROUP_UNIQUE;
+	pKeyNew->Type = KEYTYPE_ADDWORD;
+	pKeyNew->Style = KEYSTYLE_ADDWORD;
+
+	colleft = colright;
+	colright += colperkey;
+
+	pKeyPrevious = pKeyNew;
 					
 	/* make the prediction keys fill the row */
 	gok_keyboard_fill_row (pKeyboard, 0);
 	
-	if (keytype == KEYTYPE_WORDCOMPLETE)
-	{
-		gok_keyboard_set_wordcomplete_keys_added (pKeyboard, TRUE);
-	}
-	else if (keytype == KEYTYPE_COMMANDPREDICT)
-	{
-		gok_keyboard_set_commandpredict_keys_added (pKeyboard, TRUE);
-	}
+	gok_keyboard_set_wordcomplete_keys_added (pKeyboard, TRUE);
 
 	gok_log_leave();
 	return TRUE;
diff --git a/gok/gok-keyslotter.h b/gok/gok-keyslotter.h
index 5d0caed..d0e881c 100644
--- a/gok/gok-keyslotter.h
+++ b/gok/gok-keyslotter.h
@@ -31,8 +31,6 @@ extern "C" {
 
 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);
-
 
 #ifdef __cplusplus
 }
diff --git a/gok/main.c b/gok/main.c
index bcfef30..0e2121a 100644
--- a/gok/main.c
+++ b/gok/main.c
@@ -63,7 +63,6 @@
 #include "gok-sound.h"
 #include "gok-log.h"
 #include "gok-gconf-keys.h"
-#include "gok-predictor.h"
 #include "gok-editor.h"
 #include "gok-spy.h"
 #include "gok-feedback.h"
@@ -143,9 +142,6 @@ static gint m_GeometryHeight = -1;
 static gint m_GeometryX = -1;
 static gint m_GeometryY = -1;
 
-/* pointer to the gok command predictor */
-static Gok_Predictor m_pCommandPredictor = NULL;
-
 /* command line aguments storage structure */
 typedef struct _GokArgs {
 	char* accessmethodname;
@@ -181,7 +177,6 @@ static struct {
 static void gok_main_read_rc (void);
 static void gok_main_initialize_access_methods (GokArgs *args);
 static void gok_main_initialize_wordcomplete (void);
-static void gok_main_initialize_commandprediction (void);
 static gboolean gok_main_display_scan_main(void);
 static void gok_main_object_state_listener (Accessible* pAccessible);
 static gboolean gok_main_has_xkb_extension ();
@@ -963,7 +958,6 @@ gok_main_open(gint argc, gchar *argv[])
 	gok_log ("login mode = %s\n", gok_args.is_login ? "true" : "false");
 	if (!gok_args.is_login) {
 		gok_main_initialize_wordcomplete ();
-		gok_main_initialize_commandprediction ();
 	}
 
 	/* create the settings dialog */
@@ -1107,18 +1101,6 @@ gok_main_set_cursor (GdkCursor *cursor)
 }
 
 /**
-* gok_main_get_command_predictor
-* 
-* Accessor function.
-*
-* returns: A pointer to command prediction engine
-*/
-Gok_Predictor gok_main_get_command_predictor ()
-{
-	return m_pCommandPredictor;
-}
-
-/**
 * gok_main_get_foreground_window_accessible
 * 
 * Accessor function.
@@ -1882,8 +1864,6 @@ gboolean gok_main_ds (GokKeyboard* pKeyboard)
 	/* enable/disable the menu and toolbar keys */
 	gok_keyboard_validate_dynamic_keys (gok_main_get_foreground_window_accessible());
 
-	/* if there are command prediction keys - fill them in */
-	gok_predictor_predict(m_pCommandPredictor);
 
 	/* initialize the current access method */
 	gok_scanner_reset_access_method ();
@@ -2396,49 +2376,6 @@ gok_main_initialize_wordcomplete ()
 }
 
 /**
-* gok_main_initialize_commandpredictione:
-*
-* Retreives the name of the directory containing dictionary.txt from
-* GConf and calls gok_wordcomplete_open passing that directory.
-*/
-static void
-gok_main_initialize_commandprediction ()
-{
-	gok_log_enter();
-    /* intialize command predictor */
-    m_pCommandPredictor = gok_predictor_open();
-   /*
-    GConfClient *gconf_client = NULL;
-    GError *gconf_err = NULL;
-    gchar *directory_name = NULL;
-
-    gconf_client = gconf_client_get_default ();
-    
-    directory_name = gconf_client_get_string (gconf_client,
-					      GOK_GCONF_DICTIONARY_DIRECTORY,
-					      &gconf_err);
-    if (directory_name == NULL)
-    {
-	gok_log_x ("Got NULL dictionary directory key from GConf");
-    }
-    else if (gconf_err != NULL)
-    {
-	gok_log_x ("Error getting dictionary directory key from GConf");
-	g_error_free (gconf_err);
-    }
-    else
-    {
-	if ( !(gok_wordcomplete_open (directory_name)) ) {
-	    gok_log_x ("Error initializing word completion");
-	}
-	
-	g_free (directory_name);
-    }
-    */
-	gok_log_leave();
-}
-
-/**
 * gok_main_resize_window
 * @pWindow: Pointer to the main window.
 * @pKeyboard: Pointer to the relevant (pending) keyboard (may be NULL).
@@ -2804,7 +2741,6 @@ gok_main_close()
 	gok_feedback_close();
 	gok_control_button_callback_close();
 	gok_wordcomplete_close(gok_wordcomplete_get_default ());
-	gok_predictor_close(m_pCommandPredictor);
 	
 	_exit(0);
 }
diff --git a/hide.kbd.in b/hide.kbd.in
index 28d312e..8c8328d 100644
--- a/hide.kbd.in
+++ b/hide.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="hide" commandprediction="no" wordcompletion="no" expand="never">
+<GOK:keyboard name="hide" wordcompletion="no" expand="never">
 	<GOK:key left="0" right="1" top="0" bottom="1" type="branchBack">
 		<_GOK:label>Show</_GOK:label>
 	</GOK:key>
diff --git a/main.kbd.in b/main.kbd.in
index 2f1956e..1cecc09 100644
--- a/main.kbd.in
+++ b/main.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="main" commandprediction="no" wordcompletion="no">
+<GOK:keyboard name="main" wordcompletion="no">
 	<GOK:key left="0" right="2" top="2" bottom="3" type="branchMenus">
 		<_GOK:label>Menus</_GOK:label>
 	</GOK:key>
diff --git a/mouse.kbd.in b/mouse.kbd.in
index 29553c3..c27a7f9 100644
--- a/mouse.kbd.in
+++ b/mouse.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="mouse" commandprediction="no" wordcompletion="no" expand="sometimes">
+<GOK:keyboard name="mouse" wordcompletion="no" expand="sometimes">
 	<GOK:key left="0" right="1" top="0" bottom="1" type="branchBack">
 		<!-- Translators: short label for go back. -->
 		<_GOK:label>back</_GOK:label>
diff --git a/move-resize.kbd.in b/move-resize.kbd.in
index 7a62233..ec6c9b3 100644
--- a/move-resize.kbd.in
+++ b/move-resize.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="move-resize" commandprediction="no" wordcompletion="no" expand="sometimes">
+<GOK:keyboard name="move-resize" wordcompletion="no" expand="sometimes">
 	<GOK:key left="0" right="1" top="0" bottom="1" type="branchBack">
 		<!-- Translators: short label for go back. -->
 		<_GOK:label>back</_GOK:label>
diff --git a/quit.kbd.in b/quit.kbd.in
index d596daf..f1eb246 100644
--- a/quit.kbd.in
+++ b/quit.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="quit" commandprediction="no" wordcompletion="no">
+<GOK:keyboard name="quit" wordcompletion="no">
 	<GOK:key left="0" right="2" top="0" bottom="1" type="branchBack">
 		<!-- Translators: short label for go back. -->
 		<_GOK:label>back</_GOK:label>
diff --git a/text-operations.kbd.in b/text-operations.kbd.in
index 1a7fa0c..a1156b2 100644
--- a/text-operations.kbd.in
+++ b/text-operations.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="text-operations" commandprediction="no" wordcompletion="no" expand="sometimes">
+<GOK:keyboard name="text-operations" wordcompletion="no" expand="sometimes">
 	<GOK:key left="0" right="1" top="0" bottom="1" type="branchBack">
 		<!-- Translators: short label for go back. -->
 		<GOK:label>back</GOK:label>
diff --git a/valuator.kbd.in b/valuator.kbd.in
index affc186..b170cda 100644
--- a/valuator.kbd.in
+++ b/valuator.kbd.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <GOK:GokFile xmlns:GOK="http://www.gnome.org/GOK";>
 
-<GOK:keyboard name="valuator" commandprediction="no" wordcompletion="no" expand="sometimes">
+<GOK:keyboard name="valuator" wordcompletion="no" expand="sometimes">
 	<GOK:key left="0" right="2" top="0" bottom="1" type="branchBack">
 		<!-- Translators: short label for go back. -->
 		<_GOK:label>back</_GOK:label>



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