]> Pileus Git - ~andy/gtk/commitdiff
Make the second example use the ::match-selected signal to make it
authorMatthias Clasen <mclasen@redhat.com>
Mon, 10 May 2004 17:55:49 +0000 (17:55 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 10 May 2004 17:55:49 +0000 (17:55 +0000)
2004-05-10  Matthias Clasen  <mclasen@redhat.com>

* tests/testentrycompletion.c: Make the second example use the
::match-selected signal to make it actually work.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
tests/testentrycompletion.c

index 36d2a56cc7c1d28778fc2019d2d6d5f6e88dc4fe..76f24eeba9f8d84e82422f5488addaf1ea3d1a7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-05-10  Matthias Clasen  <mclasen@redhat.com>
 
+       * tests/testentrycompletion.c: Make the second example use the 
+       ::match-selected signal to make it actually work.
+
        * gtk/gtkentrycompletion.c (gtk_entry_completion_init): 
        * gtk/gtkcombobox.c (gtk_combo_box_list_setup): Use hover selection
        mode.  (#127648, Dave Bordoley)
index 36d2a56cc7c1d28778fc2019d2d6d5f6e88dc4fe..76f24eeba9f8d84e82422f5488addaf1ea3d1a7f 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-10  Matthias Clasen  <mclasen@redhat.com>
 
+       * tests/testentrycompletion.c: Make the second example use the 
+       ::match-selected signal to make it actually work.
+
        * gtk/gtkentrycompletion.c (gtk_entry_completion_init): 
        * gtk/gtkcombobox.c (gtk_combo_box_list_setup): Use hover selection
        mode.  (#127648, Dave Bordoley)
index 36d2a56cc7c1d28778fc2019d2d6d5f6e88dc4fe..76f24eeba9f8d84e82422f5488addaf1ea3d1a7f 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-10  Matthias Clasen  <mclasen@redhat.com>
 
+       * tests/testentrycompletion.c: Make the second example use the 
+       ::match-selected signal to make it actually work.
+
        * gtk/gtkentrycompletion.c (gtk_entry_completion_init): 
        * gtk/gtkcombobox.c (gtk_combo_box_list_setup): Use hover selection
        mode.  (#127648, Dave Bordoley)
index 36d2a56cc7c1d28778fc2019d2d6d5f6e88dc4fe..76f24eeba9f8d84e82422f5488addaf1ea3d1a7f 100644 (file)
@@ -1,5 +1,8 @@
 2004-05-10  Matthias Clasen  <mclasen@redhat.com>
 
+       * tests/testentrycompletion.c: Make the second example use the 
+       ::match-selected signal to make it actually work.
+
        * gtk/gtkentrycompletion.c (gtk_entry_completion_init): 
        * gtk/gtkcombobox.c (gtk_combo_box_list_setup): Use hover selection
        mode.  (#127648, Dave Bordoley)
index c894b90413a1e0466cefdf28d017968e9c86d430..e4b7ef2b78eb03d6429c9fc94a6022254fbe5a95 100644 (file)
@@ -221,6 +221,23 @@ animation_timer (GtkEntryCompletion *completion)
   return TRUE;
 }
 
+gboolean 
+match_selected_cb (GtkEntryCompletion *completion,
+                  GtkTreeModel       *model,
+                  GtkTreeIter        *iter)
+{
+  gchar *str;
+  GtkWidget *entry;
+
+  entry = gtk_entry_completion_get_entry (completion);
+  gtk_tree_model_get (GTK_TREE_MODEL (model), iter, 1, &str, -1);
+  gtk_entry_set_text (GTK_ENTRY (entry), str);
+  gtk_editable_set_position (GTK_EDITABLE (entry), -1);
+  g_free (str);
+
+  return TRUE;
+}
+
 int 
 main (int argc, char *argv[])
 {
@@ -295,6 +312,8 @@ main (int argc, char *argv[])
                                  "text", 1, NULL); 
   
   gtk_entry_completion_set_match_func (completion, match_func, NULL, NULL);
+  g_signal_connect (G_OBJECT (completion), "match-selected", 
+                   G_CALLBACK (match_selected_cb), NULL);
 
   gtk_entry_completion_insert_action_text (completion, 100, "action!");
   gtk_entry_completion_insert_action_text (completion, 101, "'nother action!");