diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-app.c ./gdictsrc/gdict-app.c
--- ../gnome-utils-2.6.2/gdictsrc/gdict-app.c	2004-02-24 03:42:22.000000000 +0300
+++ ./gdictsrc/gdict-app.c	2004-06-15 06:35:54.659145440 +0400
@@ -33,6 +33,7 @@
 #include "gdict-app.h"
 #include "gdict-defbox.h"
 #include "gdict-speller.h"
+#include "gdict-compbox.h" 
 
 #ifdef HAVE_GNOME_PRINT
 #  include <libgnomeprint/gnome-printer-dialog.h>
@@ -47,7 +48,13 @@
 GtkWidget *gnome_word_entry;
 GtkWidget *word_entry;
 GtkWidget *find_entry;
+
+GtkWidget *scrolled_defbox;
+GtkWidget *scrolled_compbox;
+
+
 GDictDefbox *defbox;
+GDictCompbox *compbox;
 GDictSpeller *speller;
 GtkWidget *pref_dialog;
 GtkWidget *socket_error_dialog;
@@ -56,6 +63,11 @@
 static gchar *find_text = NULL;
 static gboolean search_from_beginning = TRUE;
 
+/* THIS IS A HACK! I couldn't find better way to
+   notify complete_cb that entry was changed by machine
+   so it doesn't update it completion list */
+static gboolean changed_by_user = TRUE;
+
 #ifdef HAVE_GNOME_PRINT
 GnomePrinter *gdict_printer = NULL;
 #endif /* HAVE_GNOME_PRINT */
@@ -93,6 +105,7 @@
     context->command = dict_disconnect_command_new ();
     
     defbox->context = context;
+    compbox->context = context;
 
 #ifdef ENABLE_IPV6
     if (context->host6info)
@@ -209,8 +222,10 @@
     if ((word_entry_text == NULL) || (*word_entry_text == 0) || (strcmp (word_entry_text, text) != 0))
     {
         g_utf8_strdown (text, strlen (text));
+	changed_by_user = FALSE;
         gnome_entry_prepend_history (GNOME_ENTRY (gnome_word_entry), 1, text);
         gtk_entry_set_text (GTK_ENTRY (word_entry), text);
+	changed_by_user = TRUE;
     }
 
     g_free (word_entry_text);
@@ -243,11 +258,18 @@
 {
     gchar *text = NULL;
     gtk_signal_emit_by_name (GTK_OBJECT (defbox), "copy_clipboard");
+
+    changed_by_user = FALSE;
     gtk_entry_set_text (GTK_ENTRY (word_entry), "");
+    changed_by_user = TRUE;
+
     gtk_signal_emit_by_name (GTK_OBJECT (word_entry), "paste_clipboard");
     text = gtk_editable_get_chars (GTK_EDITABLE (word_entry), 0, -1);
     g_utf8_strdown (text, strlen (text));
+    changed_by_user = FALSE;
     gnome_entry_prepend_history (GNOME_ENTRY (gnome_word_entry), 1, text);
+    changed_by_user = TRUE;
+
     gdict_app_do_lookup (text);
     if (text)
         g_free (text);
@@ -289,7 +311,7 @@
     gnome_appbar_refresh (GNOME_APPBAR (gdict_appbar));
     gdict_edit_menu_set_sensitivity (FALSE);
  
-    if (gdict_pref.smart) {
+    if (gdict_pref.smart && widget == GTK_WIDGET(defbox)) {
         gdict_spell (gdict_defbox_get_word (defbox), FALSE);
     }
 }
@@ -303,18 +325,56 @@
 }
 
 static void
+defbox_activated_cb (GtkWidget *widget, gpointer data) 
+{
+  gtk_widget_hide (scrolled_compbox);
+  gtk_widget_show_all (scrolled_defbox);
+}
+
+static void
+compbox_activated_cb (GtkWidget *widget, gpointer data) 
+{
+  gtk_widget_hide (scrolled_defbox);
+  gtk_widget_show_all (scrolled_compbox);
+}
+
+static void
 lookup_cb (GtkWidget *menuitem, gpointer user_data) 
 {
     lookup_any();
 }
 
 static void
+complete_cb(GtkWidget *entry, gpointer user_data)
+{
+    gchar *text = gtk_editable_get_chars (GTK_EDITABLE (word_entry), 0, -1);
+
+    if (!gdict_pref.completions)
+      return;
+
+    if (text[0] != '\0' && changed_by_user) {
+      g_utf8_strdown(text, strlen (text));
+      gdict_compbox_lookup (compbox, text);
+    } else {
+      gdict_compbox_clear (compbox);
+    }
+    if (text)
+        g_free (text);
+}
+
+static void
 lookup_button_cb (GtkButton *button, gpointer data)
 {
     lookup_any();
 }
 
 static void
+lookup_completed_cb (GtkWidget *w, gchar *word, gpointer data)
+{
+  gdict_app_do_lookup (word);
+}
+
+static void
 lookup_button_drag_cb (GtkWidget *widget, GdkDragContext *context, gint x, gint y,
 		       GtkSelectionData *sd, guint info, guint t, gpointer data)
 {
@@ -324,8 +384,10 @@
 	
 	if (text) {
 		g_utf8_strdown (text, strlen (text));
-		gtk_entry_set_text (GTK_ENTRY (word_entry), text);
+		changed_by_user = FALSE;
+		gtk_entry_set_text (GTK_ENTRY (word_entry), text);	      
     		gnome_entry_prepend_history (GNOME_ENTRY (gnome_word_entry), 1, text);
+		changed_by_user = TRUE;
     		gdict_app_do_lookup (text);
 		g_free (text);
 	}
@@ -761,7 +823,6 @@
     GtkWidget *hbox;
     GtkWidget *button;
     GtkWidget *word_label;
-    GtkWidget *scrolled;
     GtkTooltips *tooltips;
     static GtkTargetEntry drop_targets [] = {
     	{ "UTF8_STRING", 0, 0 },
@@ -831,15 +892,16 @@
         add_atk_namedesc(GTK_WIDGET(button), NULL, _("Look Up for a Word"));
     }
 
-    scrolled = gtk_scrolled_window_new (NULL, NULL);
-    gtk_container_set_border_width (GTK_CONTAINER (scrolled), GNOME_PAD_SMALL);    
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+    /* setup defbox */
+
+    scrolled_defbox = gtk_scrolled_window_new (NULL, NULL);
+    gtk_container_set_border_width (GTK_CONTAINER (scrolled_defbox), GNOME_PAD_SMALL);    
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_defbox),
                                         GTK_POLICY_AUTOMATIC,             
 	       				GTK_POLICY_AUTOMATIC);
-    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_NONE);
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_defbox), GTK_SHADOW_NONE);
+
 
-    gtk_widget_show (scrolled);
-  
     defbox = GDICT_DEFBOX (gdict_defbox_new ());
     defbox_setup_tags (defbox);
     gtk_text_view_set_left_margin (GTK_TEXT_VIEW (defbox), GNOME_PAD_SMALL);
@@ -853,18 +915,53 @@
                         GTK_SIGNAL_FUNC (def_substr_not_found_cb), defbox);
     gtk_signal_connect (GTK_OBJECT (defbox), "socket_error",
                         GTK_SIGNAL_FUNC (socket_error_cb), defbox);
+    gtk_signal_connect (GTK_OBJECT (defbox), "defbox_activated",
+			GTK_SIGNAL_FUNC(defbox_activated_cb), defbox);
+
   
-    gtk_widget_show (GTK_WIDGET (defbox));
     gtk_text_view_set_editable (GTK_TEXT_VIEW (defbox), FALSE);
-    gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (defbox));
+    gtk_container_add (GTK_CONTAINER (scrolled_defbox), GTK_WIDGET (defbox));
 
-    gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), scrolled_defbox, TRUE, TRUE, 0);
 
+    /* setup compbox */
+    scrolled_compbox = gtk_scrolled_window_new (NULL, NULL);
+    gtk_container_set_border_width (GTK_CONTAINER (scrolled_compbox), GNOME_PAD_SMALL);    
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_compbox),
+				    GTK_POLICY_AUTOMATIC,             
+				    GTK_POLICY_AUTOMATIC);
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_compbox), GTK_SHADOW_NONE);
+    
+
+    compbox = GDICT_COMPBOX (gdict_compbox_new ());
+    gtk_signal_connect (GTK_OBJECT (compbox), "word_lookup_start",
+			GTK_SIGNAL_FUNC (def_lookup_start_cb), compbox);
+    gtk_signal_connect (GTK_OBJECT (compbox), "word_lookup_done",
+			    GTK_SIGNAL_FUNC (def_lookup_done_cb), compbox);
+    gtk_signal_connect (GTK_OBJECT (compbox), "word_not_found",
+			GTK_SIGNAL_FUNC (def_not_found_cb), compbox);
+    gtk_signal_connect (GTK_OBJECT (compbox), "socket_error",
+			GTK_SIGNAL_FUNC (socket_error_cb), compbox);
+    gtk_signal_connect (GTK_OBJECT (compbox), "word_selected",
+			GTK_SIGNAL_FUNC(lookup_completed_cb), compbox);
+    gtk_signal_connect (GTK_OBJECT (compbox), "compbox_activated",
+			    GTK_SIGNAL_FUNC(compbox_activated_cb), compbox);
+    
+    
+    gtk_container_add (GTK_CONTAINER (scrolled_compbox), GTK_WIDGET (compbox));
+    gtk_box_pack_start (GTK_BOX (vbox), scrolled_compbox, TRUE, TRUE, 0);
+    
     gdict_appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
     gnome_app_set_statusbar (GNOME_APP (gdict_app), gdict_appbar);
     gnome_app_install_menu_hints (GNOME_APP (gdict_app), menubar_uiinfo);
 
+   if (gdict_pref.completions)
+     gtk_widget_show_all (scrolled_compbox);
+   else
+      gtk_widget_show_all (scrolled_defbox);
+
     gtk_widget_show (gdict_appbar);
+    
 
     if (!applet)
       gtk_signal_connect (GTK_OBJECT (gdict_app), "delete_event",
@@ -875,6 +972,9 @@
     
     gtk_signal_connect (GTK_OBJECT (word_entry), "activate",
                         GTK_SIGNAL_FUNC(lookup_cb), NULL);
+    gtk_signal_connect (GTK_OBJECT (word_entry), "changed", 
+			GTK_SIGNAL_FUNC(complete_cb), NULL);
+    
     return gdict_app;
 }
 
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-compbox.c ./gdictsrc/gdict-compbox.c
--- ../gnome-utils-2.6.2/gdictsrc/gdict-compbox.c	1970-01-01 03:00:00.000000000 +0300
+++ ./gdictsrc/gdict-compbox.c	2004-06-15 06:35:55.485019888 +0400
@@ -0,0 +1,457 @@
+/* $Id: gdict-compbox.c,v 1.24 2003/11/10 01:49:50 gman Exp $ */
+
+/*
+ *  Mike Hughes <mfh@psilord.com>
+ *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
+ *  Bradford Hovinen <hovinen@udel.edu>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  GDict main window
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <gnome.h>
+
+#include "gdict-compbox.h"
+#include "gdict-pref.h"
+#include "gdict-app.h"
+
+enum {
+    WORD_LOOKUP_START_SIGNAL,
+    WORD_LOOKUP_DONE_SIGNAL,
+    WORD_NOT_FOUND_SIGNAL,
+    SOCKET_ERROR_SIGNAL,
+    COMPBOX_ACTIVATED_SIGNAL,
+    WORD_SELECTED_SIGNAL,
+    LAST_SIGNAL
+};
+
+GtkWidget *ss_label;
+
+static gint gdict_compbox_signals[LAST_SIGNAL] = { 0, 0, 0 };
+
+
+static void gdict_compbox_init (GDictCompbox *compbox);
+static void gdict_compbox_class_init (GDictCompboxClass *class);
+
+static void compbox_add_word  (GDictCompbox *compbox, gchar *word);
+
+static void completion_error_cb        (dict_command_t *command, 
+					DictStatusCode code, 
+					gchar *message, gpointer data);
+static void completion_word_status_cb  (dict_command_t *command, 
+					DictStatusCode code, 
+					int num_found, gpointer data);
+static void completion_word_data_cb    (dict_command_t *command, 
+					dict_res_t *res, gpointer data);
+
+
+static void row_selected_cb       (GtkTreeSelection *selection, gpointer data);
+static void row_activated_cb      (GtkTreeView *tree, GtkTreePath *path, 
+				   GtkTreeViewColumn *column, gpointer data);
+
+
+/* gdict_compbox_get_type
+ *
+ * Register the GDictCompbox type with Gtk's type system if necessary and
+ * return the type identifier code
+ */
+
+GType
+gdict_compbox_get_type (void) {
+    static GType gdict_compbox_type = 0;
+    
+    if (!gdict_compbox_type) {
+        static const GTypeInfo gdict_compbox_info = {
+            sizeof (GDictCompboxClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gdict_compbox_class_init,
+	    NULL,
+	    NULL,
+ 	    sizeof (GDictCompbox),
+	    0,
+            (GInstanceInitFunc) gdict_compbox_init
+        };
+        
+        gdict_compbox_type = 
+            g_type_register_static (GTK_TYPE_TREE_VIEW, "GDictCompbox", &gdict_compbox_info, 0);
+    }
+    
+    return gdict_compbox_type;
+}
+
+/* gdict_compbox_init
+ *
+ * Initialises an instance of a GDictCompbox object
+ */
+
+static void 
+gdict_compbox_init (GDictCompbox *compbox) {
+    GtkListStore *model;
+    GtkTreeViewColumn *column;
+    GtkTreeSelection *selection;
+    GtkCellRenderer *cell;
+    
+    compbox->context = NULL;
+    compbox->spell_cmd = NULL;
+    compbox->strat = "prefix";
+    compbox->too_much_completions = FALSE;
+    
+    model = gtk_list_store_new (1, G_TYPE_STRING);
+    
+    gtk_tree_view_set_model (GTK_TREE_VIEW(compbox),
+				  GTK_TREE_MODEL (model));
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (compbox), FALSE);
+    g_object_unref (G_OBJECT (model));
+    
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (compbox));
+    g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (row_selected_cb),
+    		      compbox);
+    
+    cell = gtk_cell_renderer_text_new ();
+    column = gtk_tree_view_column_new_with_attributes ("words", 
+    						       cell,
+    						       "text", 0,
+    						       NULL);
+    gtk_tree_view_column_set_sort_column_id (column, 0);
+    
+    gtk_tree_view_append_column (GTK_TREE_VIEW (compbox), column);
+    
+    g_signal_connect (GTK_TREE_VIEW (compbox), "row_activated",
+    		      G_CALLBACK (row_activated_cb), compbox);
+    		      
+}
+
+/* gdict_compbox_class_init
+ *
+ * Initialises a structure describing the GDictCompbox class; sets up signals
+ * for compbox events in the Gtk signal management system
+ */
+
+static void 
+gdict_compbox_class_init (GDictCompboxClass *class) {
+    GtkObjectClass *object_class;
+    
+    object_class = GTK_OBJECT_CLASS (class);
+
+    gdict_compbox_signals[WORD_LOOKUP_START_SIGNAL] =
+        gtk_signal_new ("word_lookup_start", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+                        GTK_SIGNAL_OFFSET (GDictCompboxClass, word_lookup_start),
+                        gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
+    
+    gdict_compbox_signals[WORD_LOOKUP_DONE_SIGNAL] =
+        gtk_signal_new ("word_lookup_done", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+                        GTK_SIGNAL_OFFSET (GDictCompboxClass, word_lookup_done),
+                        gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
+    
+    gdict_compbox_signals[WORD_NOT_FOUND_SIGNAL] =
+        gtk_signal_new ("word_not_found", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+                        GTK_SIGNAL_OFFSET (GDictCompboxClass, word_not_found),
+                        gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
+    
+    gdict_compbox_signals[SOCKET_ERROR_SIGNAL] =
+        gtk_signal_new ("socket_error", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+                        GTK_SIGNAL_OFFSET (GDictCompboxClass, socket_error),
+                        gtk_marshal_VOID__STRING, GTK_TYPE_NONE, 1,
+                        GTK_TYPE_STRING);
+
+    gdict_compbox_signals[COMPBOX_ACTIVATED_SIGNAL] =
+      gtk_signal_new ("compbox_activated", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+		      GTK_SIGNAL_OFFSET (GDictCompboxClass, compbox_activated),
+		      gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
+    
+    gdict_compbox_signals[WORD_SELECTED_SIGNAL] =
+    gtk_signal_new ("word_selected", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+		    GTK_SIGNAL_OFFSET (GDictCompboxClass, word_selected),
+		    gtk_marshal_VOID__STRING, GTK_TYPE_NONE, 1,
+		    GTK_TYPE_STRING);
+
+
+    class->word_lookup_done = NULL;
+    class->word_not_found = NULL;
+
+    object_class->destroy = (void (*) (GtkObject *)) gdict_compbox_destroy;
+}
+
+/* gdict_compbox_new
+ *
+ * Creates a new GDictCompbox object
+ */
+
+GtkWidget *
+gdict_compbox_new () {
+    GtkWidget	 *widget;
+ 
+    widget = g_object_new (gdict_compbox_get_type (), NULL);
+    return widget;
+}
+
+/* gdict_compbox_destroy
+ *
+ * Destroys a compbox dialog
+ */
+
+void
+gdict_compbox_destroy (GDictCompbox *compbox) {
+
+    g_free (compbox->database);
+    dict_command_destroy (compbox->spell_cmd);
+    
+}
+
+/* gdict_compbox_lookup
+ *
+ * Sends the command to the server to commence looking up matches for a word
+ * of a word and sets the callbacks so that the definition will be displayed
+ * in this compbox
+ *
+ * Returns 0 on success and -1 on command invocation error
+ */
+
+gint 
+gdict_compbox_lookup (GDictCompbox *compbox, gchar *text) {
+    g_return_val_if_fail (compbox != NULL, -1);
+    g_return_val_if_fail (IS_GDICT_COMPBOX (compbox), -1);
+    g_return_val_if_fail (text != NULL, -1);
+    
+    while (isspace (*text)) text++;
+    
+    if (*text == '\0')
+      {
+	gdict_compbox_clear (compbox);
+        return 0;
+      }
+
+    gtk_signal_emit (GTK_OBJECT (compbox), 
+                     gdict_compbox_signals[WORD_LOOKUP_START_SIGNAL]);
+    
+    gdict_compbox_clear (compbox);
+    
+    if (compbox->database) g_free (compbox->database);
+    
+    compbox->database = g_strdup (gdict_pref.database);
+    
+    compbox->spell_cmd = 
+        dict_match_command_new (compbox->database, compbox->strat, text);
+    compbox->spell_cmd->error_notify_cb = completion_error_cb;
+    compbox->spell_cmd->status_notify_cb = completion_word_status_cb;
+    compbox->spell_cmd->data_notify_cb = completion_word_data_cb;
+    compbox->spell_cmd->user_data = compbox;
+    
+    if (dict_command_invoke (compbox->spell_cmd, compbox->context) < 0)
+      return -1;
+    
+    return 0;
+}
+
+/* gdict_compbox_clear
+ *
+ * Clears the text in a compbox and eliminates the current command structure
+ */
+
+void 
+gdict_compbox_clear (GDictCompbox *compbox) {
+    GtkTreeModel *model;
+    g_return_if_fail (compbox != NULL);
+    g_return_if_fail (IS_GDICT_COMPBOX (compbox));
+    
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW (compbox));
+    gtk_list_store_clear (GTK_LIST_STORE (model));
+    compbox->current_word = NULL;
+    
+    if (compbox->spell_cmd) {
+        dict_command_destroy (compbox->spell_cmd);
+        compbox->spell_cmd = NULL;
+    }
+}
+
+/* gdict_compbox_reset
+ *
+ * Reinvokes the search with a new context and preferences
+ */
+
+void
+gdict_compbox_reset (GDictCompbox *compbox, dict_context_t *context) {
+    gchar *word;
+    
+    /* If we have a new context, we cannot trust that the search strategy
+     * we were using will still be present
+     */
+    
+    if (context != compbox->context) {
+        compbox->context = context;
+        compbox->strat = gdict_pref.dfl_strat;
+    }
+    
+    /* Re-invoke current query only if there is a new database specified */
+    
+    if (context != compbox->context ||
+        strcmp (compbox->database, gdict_pref.database))
+    {
+        if (compbox->spell_cmd) {
+            word = g_strdup (compbox->spell_cmd->search_term);
+            dict_command_destroy (compbox->spell_cmd);
+            compbox->spell_cmd = NULL;
+            gdict_compbox_lookup (compbox, word);
+            g_free (word);
+        }
+    }
+}
+
+/* gdict_compbox_get_word
+ *
+ * Returns the word defined in the compbox, if any
+ */
+
+gchar *
+gdict_compbox_get_word (GDictCompbox *compbox) {
+    g_return_val_if_fail (compbox != NULL, NULL);
+    g_return_val_if_fail (IS_GDICT_COMPBOX (compbox), NULL);
+    
+    return compbox->spell_cmd ? compbox->spell_cmd->search_term : NULL;
+}
+
+
+static void
+completion_error_cb (dict_command_t *command, DictStatusCode code,
+                gchar *message, gpointer data)
+{
+    GtkTreeView *compbox;
+    gchar *string;
+    
+    compbox = GTK_TREE_VIEW (data);
+    
+    if (code != DICT_SOCKET_ERROR) {
+        GtkWidget *dialog;
+        string = g_strdup_printf (_("Error invoking query: %s"), message);
+        dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  	 GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                  	 "%s", string); 
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+        g_free (string);
+        if (command->cmd == C_MATCH)
+          gtk_signal_emit (GTK_OBJECT (compbox), 
+                           gdict_compbox_signals[WORD_LOOKUP_DONE_SIGNAL]);
+    }
+    else {
+        gtk_signal_emit (GTK_OBJECT (compbox),
+                         gdict_compbox_signals[SOCKET_ERROR_SIGNAL], message);
+    }
+}
+
+/* compbox_add_word
+ *
+ * Adds a word to the word list
+ */
+
+static void 
+compbox_add_word (GDictCompbox *compbox, gchar *word) {
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW (compbox));
+    
+    gtk_list_store_insert (GTK_LIST_STORE (model), &iter, 0);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, word, -1);
+    
+    if (!compbox->current_word) compbox->current_word = word;
+}
+
+/* completion_word_data_cb
+ *
+ * Callback used when a new word has arrived over the link
+ */
+
+static void 
+completion_word_data_cb (dict_command_t *command, dict_res_t *res, gpointer data) {
+    GDictCompbox *compbox;
+    
+    compbox = GDICT_COMPBOX (data);
+    if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (compbox))) return;
+    if (!compbox->too_much_completions)
+      compbox_add_word (compbox, res->desc);
+}
+
+/* completion_word_status_cb
+ *
+ * Callback used when a status code has arrived over the link
+ */
+
+static void 
+completion_word_status_cb (dict_command_t *command, DictStatusCode code, 
+                      int num_found, gpointer data)
+{
+    GDictCompbox *compbox;
+    
+    compbox = GDICT_COMPBOX (data);
+
+    if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (compbox))) return;
+    
+    if (code == DICT_STATUS_OK)
+      {
+	gtk_signal_emit (GTK_OBJECT (compbox), 
+			 gdict_compbox_signals[WORD_LOOKUP_DONE_SIGNAL]);
+	gtk_signal_emit (GTK_OBJECT (compbox), 
+			 gdict_compbox_signals[COMPBOX_ACTIVATED_SIGNAL]);
+	compbox->too_much_completions = FALSE;
+      }
+    else if (code == DICT_STATUS_NO_MATCH)
+      gtk_signal_emit (GTK_OBJECT (compbox), 
+                       gdict_compbox_signals[WORD_NOT_FOUND_SIGNAL]);
+    else if (code == DICT_STATUS_MATCHES_FOUND)
+      if ((gdict_pref.max_completions != 0) && (num_found > gdict_pref.max_completions))
+	{
+	  compbox->too_much_completions = TRUE;
+	  compbox_add_word (compbox, "Too much completions to show");
+	}
+}
+
+static void
+row_selected_cb (GtkTreeSelection *selection, gpointer data) {
+    GDictCompbox *compbox;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
+    gchar *word;
+    g_return_if_fail (data != NULL);
+    
+    compbox = GDICT_COMPBOX (data);
+    
+    if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
+    	return;
+    
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW (compbox));
+    gtk_tree_model_get (model, &iter, 0, &word, -1);
+    compbox->current_word = g_strdup (word);
+
+}    
+
+static void
+row_activated_cb (GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column,
+		  gpointer data) {
+    GDictCompbox *compbox;
+    
+    g_return_if_fail (data != NULL);
+    compbox = GDICT_COMPBOX (data);
+
+    gtk_signal_emit (GTK_OBJECT (compbox), 
+		     gdict_compbox_signals[WORD_SELECTED_SIGNAL], 
+		     compbox->current_word);
+    
+}
+
+
+
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-compbox.h ./gdictsrc/gdict-compbox.h
--- ../gnome-utils-2.6.2/gdictsrc/gdict-compbox.h	1970-01-01 03:00:00.000000000 +0300
+++ ./gdictsrc/gdict-compbox.h	2004-06-15 06:35:55.533012592 +0400
@@ -0,0 +1,80 @@
+#ifndef __GDICT_COMPBOX_H_
+#define __GDICT_COMPBOX_H_
+
+/* $Id: gdict-compbox.h,v 1.5 2003/11/10 01:49:50 gman Exp $ */
+
+/*
+ *  Mike Hughes <mfh@psilord.com>
+ *  Papadimitriou Spiros <spapadim@cs.cmu.edu>
+ *  Bradford Hovinen <hovinen@udel.edu>
+ *  Peter Novodvorsky <nidd@myxomop.com>
+ *
+ *  This code released under the GNU GPL.
+ *  Read the file COPYING for more information.
+ *
+ *  GDict main window
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gtk/gtk.h>
+#include <gnome.h>
+
+#include "dict.h"
+
+#define GDICT_COMPBOX(obj)         GTK_CHECK_CAST (obj, gdict_compbox_get_type (), GDictCompbox)
+#define GDICT_COMPBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gdict_compbox_get_type (), GDictCompboxClass)
+#define IS_GDICT_COMPBOX(obj)      GTK_CHECK_TYPE (obj, gdict_compbox_get_type ())
+
+#define MAX_COMPLETIONS_TO_SHOW 200
+
+typedef struct _GDictCompbox        GDictCompbox;
+typedef struct _GDictCompboxClass   GDictCompboxClass;
+
+struct _GDictCompbox {
+    GtkTreeView	   word_list;
+    
+    dict_context_t *context;
+    char           *strat;
+    dict_command_t *spell_cmd;
+    gchar          *database;
+
+    /* We won't add more than MAX_COMPLETIONS_TO_SHOW 
+       to the list.
+     */
+    gboolean       too_much_completions; 
+    
+    gchar          *current_word;
+};
+
+struct _GDictCompboxClass {
+    GtkTreeViewClass  parent_class;
+    
+    void (*word_lookup_start) (GDictCompbox *);
+    void (*word_lookup_done)  (GDictCompbox *);
+    void (*word_not_found)    (GDictCompbox *);
+    void (*socket_error)      (GDictCompbox *, gchar *);
+    void (*compbox_activated) (GDictCompbox *);
+    void (*word_selected)     (GDictCompbox *, gchar *);
+};
+
+GType      gdict_compbox_get_type    (void);
+
+GtkWidget *gdict_compbox_new         ();
+void       gdict_compbox_destroy     (GDictCompbox *compbox);
+
+gint       gdict_compbox_lookup      (GDictCompbox *compbox, gchar *text);
+void       gdict_compbox_clear       (GDictCompbox *compbox);
+void       gdict_compbox_reset       (GDictCompbox *compbox,
+                                      dict_context_t *context);
+
+gchar     *gdict_compbox_get_word    (GDictCompbox *compbox);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDICT_COMPBOX_H_ */
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-defbox.c ./gdictsrc/gdict-defbox.c
--- ../gnome-utils-2.6.2/gdictsrc/gdict-defbox.c	2004-04-29 03:19:13.000000000 +0400
+++ ./gdictsrc/gdict-defbox.c	2004-06-15 06:35:54.754131000 +0400
@@ -39,6 +39,7 @@
     WORD_NOT_FOUND_SIGNAL,
     SUBSTR_NOT_FOUND_SIGNAL,
     SOCKET_ERROR_SIGNAL,
+    DEFBOX_ACTIVATED_SIGNAL,
     LAST_SIGNAL
 };
 
@@ -143,6 +144,11 @@
                         GTK_SIGNAL_OFFSET (GDictDefboxClass, socket_error),
                         gtk_marshal_VOID__STRING, GTK_TYPE_NONE, 1,
                         GTK_TYPE_STRING);
+    gdict_defbox_signals[DEFBOX_ACTIVATED_SIGNAL] =
+        gtk_signal_new ("defbox_activated", GTK_RUN_FIRST, GTK_CLASS_TYPE (object_class),
+                        GTK_SIGNAL_OFFSET (GDictDefboxClass, defbox_activated),
+                        gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
+
  /*   
     gtk_object_class_add_signals (object_class, gdict_defbox_signals,
                                   LAST_SIGNAL);
@@ -693,7 +699,11 @@
     defbox = GTK_OBJECT (data);
     
     if (code == DICT_STATUS_OK)
-      gtk_signal_emit (defbox, gdict_defbox_signals[WORD_LOOKUP_DONE_SIGNAL]);
+      {
+	gtk_signal_emit (defbox, gdict_defbox_signals[WORD_LOOKUP_DONE_SIGNAL]);
+	gtk_signal_emit (GTK_OBJECT (defbox), 
+			 gdict_defbox_signals[DEFBOX_ACTIVATED_SIGNAL]);
+      }
     else if (code == DICT_STATUS_NO_MATCH)
       gtk_signal_emit (defbox, gdict_defbox_signals[WORD_NOT_FOUND_SIGNAL]);
 }
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-defbox.h ./gdictsrc/gdict-defbox.h
--- ../gnome-utils-2.6.2/gdictsrc/gdict-defbox.h	2002-05-10 18:09:33.000000000 +0400
+++ ./gdictsrc/gdict-defbox.h	2004-06-15 06:35:54.771128416 +0400
@@ -48,6 +48,7 @@
     void (*word_not_found)    (GDictDefbox *);
     void (*substr_not_found)  (GDictDefbox *);
     void (*socket_error)      (GDictDefbox *, gchar *);
+    void (*defbox_activated)  (GDictDefbox *);
 };
 
 GType	   gdict_defbox_get_type   (void);
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-pref.c ./gdictsrc/gdict-pref.c
--- ../gnome-utils-2.6.2/gdictsrc/gdict-pref.c	2004-02-16 12:36:10.000000000 +0300
+++ ./gdictsrc/gdict-pref.c	2004-06-15 06:35:54.691140576 +0400
@@ -29,7 +29,7 @@
 static GConfClient *gdict_client = NULL;
 
 GDictPref gdict_pref = { 
-    NULL, 0, TRUE, NULL, NULL, TRUE
+  NULL, 0, TRUE, NULL, NULL, TRUE, TRUE, 200
 };
 
 GConfClient *
@@ -69,6 +69,23 @@
     gdict_pref.smart = gconf_value_get_bool (value);
 }
 
+static void
+completions_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+    GConfValue *value = gconf_entry_get_value (entry);
+    
+    gdict_pref.completions = gconf_value_get_bool (value);
+}
+
+static void
+max_completions_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+    GConfValue *value = gconf_entry_get_value (entry);
+    
+    gdict_pref.max_completions = gconf_value_get_int (value);
+}
+
+
 /* gdict_pref_load
  *
  * Loads configuration from config file
@@ -98,6 +115,24 @@
     }
 
     gconf_client_notify_add (gdict_get_gconf_client (), "/apps/gnome-dictionary/smart", smart_changed_cb, NULL, NULL, NULL);
+
+    gdict_pref.completions = gconf_client_get_bool(gdict_get_gconf_client (),
+"/apps/gnome-dictionary/completions", &error);
+    if (error) {
+        gdict_pref.completions = TRUE;
+        g_error_free (error);
+    }
+    
+    gconf_client_notify_add (gdict_get_gconf_client (), "/apps/gnome-dictionary/completions", completions_changed_cb, NULL, NULL, NULL);
+
+    gdict_pref.max_completions = gconf_client_get_int(gdict_get_gconf_client (),
+"/apps/gnome-dictionary/max_completions", &error);
+    if (error) {
+        gdict_pref.max_completions = 200;
+        g_error_free (error);
+    }
+
+    gconf_client_notify_add (gdict_get_gconf_client (), "/apps/gnome-dictionary/max_completions", max_completions_changed_cb, NULL, NULL, NULL);
     
     gdict_pref.database = gconf_client_get_string (gdict_get_gconf_client (), "/apps/gnome-dictionary/database", NULL);
     gconf_client_notify_add (gdict_get_gconf_client (), "/apps/gnome-dictionary/database", database_changed_cb, NULL, NULL, NULL);
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-pref-dialog.c ./gdictsrc/gdict-pref-dialog.c
--- ../gnome-utils-2.6.2/gdictsrc/gdict-pref-dialog.c	2004-02-09 11:37:23.000000000 +0300
+++ ./gdictsrc/gdict-pref-dialog.c	2004-06-15 06:35:54.702138904 +0400
@@ -56,6 +56,7 @@
 static void set_default_server      (GtkButton *button, gpointer data);
 static void set_default_port        (GtkButton *button, gpointer data);
 static void smart_lookup_cb	    (GtkToggleButton *toggle, gpointer data);
+static void completions_cb	    (GtkToggleButton *toggle, gpointer data);
 
 
 enum {
@@ -264,6 +265,18 @@
     gtk_table_attach_defaults (pref_dialog->table, pref_dialog->strat_label, 0, 1, 4, 5);
     pref_dialog->strat_list = GTK_MENU (gtk_menu_new ());
     gtk_widget_show (GTK_WIDGET (pref_dialog->strat_list));
+
+
+    /* completion options */
+    pref_dialog->completions_btn = 
+        GTK_CHECK_BUTTON (gtk_check_button_new_with_mnemonic (_("Enable _completions")));
+    g_signal_connect (G_OBJECT (pref_dialog->completions_btn), "toggled",
+    		      G_CALLBACK (completions_cb), pref_dialog);
+    gtk_table_attach_defaults (pref_dialog->table, GTK_WIDGET (pref_dialog->completions_btn),
+    			       1, 3, 5, 6);
+    if ( ! gconf_client_key_is_writable (gdict_get_gconf_client (), "/apps/gnome-dictionary/completions", NULL))
+	    gtk_widget_set_sensitive (GTK_WIDGET (pref_dialog->completions_btn), FALSE);
+    gtk_widget_show (GTK_WIDGET (pref_dialog->completions_btn));
     
     gtk_widget_show_all (GTK_WIDGET (pref_dialog->table));
 
@@ -288,6 +301,9 @@
     g_free(port_str);
     gtk_toggle_button_set_active
 	(GTK_TOGGLE_BUTTON (pref_dialog->smart_lookup_btn), gdict_pref.smart);
+    gtk_toggle_button_set_active
+	(GTK_TOGGLE_BUTTON (pref_dialog->completions_btn), gdict_pref.completions);
+
 
     gtk_widget_show_all (GTK_WIDGET (pref_dialog));
 }
@@ -767,3 +783,13 @@
         gconf_client_set_bool (gdict_get_gconf_client (), "/apps/gnome-dictionary/smart", toggled, NULL);
 }
 
+
+static void 
+completions_cb	(GtkToggleButton *toggle, gpointer data)
+{
+    gboolean toggled;
+    
+    toggled = gtk_toggle_button_get_active (toggle);
+    if (toggled != gdict_pref.completions)
+        gconf_client_set_bool (gdict_get_gconf_client (), "/apps/gnome-dictionary/completions", toggled, NULL);
+}
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-pref-dialog.h ./gdictsrc/gdict-pref-dialog.h
--- ../gnome-utils-2.6.2/gdictsrc/gdict-pref-dialog.h	2004-02-09 11:37:23.000000000 +0300
+++ ./gdictsrc/gdict-pref-dialog.h	2004-06-15 06:35:54.722135864 +0400
@@ -43,6 +43,7 @@
     GtkEntry         *server_entry;
     GtkEntry         *port_entry;
     GtkCheckButton   *smart_lookup_btn;
+    GtkCheckButton   *completions_btn;
     GtkCheckButton   *applet_handle_btn;
     GtkWidget        *db_label;
     GtkWidget        *strat_label;
diff -Naur ../gnome-utils-2.6.2/gdictsrc/gdict-pref.h ./gdictsrc/gdict-pref.h
--- ../gnome-utils-2.6.2/gdictsrc/gdict-pref.h	2002-05-12 01:04:28.000000000 +0400
+++ ./gdictsrc/gdict-pref.h	2004-06-15 06:35:54.702138904 +0400
@@ -47,6 +47,8 @@
     gboolean      smart;        /* Auto-detect patterns */
     gchar        *database;     /* Database to search for words and defs */
     gchar        *dfl_strat;    /* Default match strategy */
+    gboolean      completions;
+    gint          max_completions;
 
     /* Applet preferences (read only during startup) */
     gboolean      applet_handle;
diff -Naur ../gnome-utils-2.6.2/gdictsrc/Makefile.am ./gdictsrc/Makefile.am
--- ../gnome-utils-2.6.2/gdictsrc/Makefile.am	2004-03-09 05:47:26.000000000 +0300
+++ ./gdictsrc/Makefile.am	2004-06-15 06:35:54.571158816 +0400
@@ -21,6 +21,7 @@
 	gdict-app.c gdict-app.h \
 	gdict-defbox.c gdict-defbox.h \
 	gdict-speller.c gdict-speller.h \
+	gdict-compbox.c gdict-compbox.h \
 	dict.c dict.h \
 	main.c
 
@@ -34,6 +35,7 @@
 	gdict-pref-dialog.c gdict-pref-dialog.h \
 	gdict-defbox.c gdict-defbox.h \
 	gdict-speller.c gdict-speller.h \
+	gdict-compbox.c gdict-compbox.h \
 	gdict-about.c gdict-about.h 
 
 gdict_applet_LDADD = $(GNOME_UTILS_LIBS) $(APPLET_LIBS)
