aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets/ephy-location-entry.c
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-05-02 01:13:10 +0800
committerXan Lopez <xan@src.gnome.org>2007-05-02 01:13:10 +0800
commitbe0b0b965e05963d42b9bf21899b4675b0a18e24 (patch)
tree89e6027cce96af82bb45b68f20923cd945bb9fa1 /lib/widgets/ephy-location-entry.c
parent9a3819459ea8edf60d3674cb0150566a2c2e1824 (diff)
downloadgsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.tar
gsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.tar.gz
gsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.tar.bz2
gsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.tar.lz
gsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.tar.xz
gsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.tar.zst
gsoc2013-epiphany-be0b0b965e05963d42b9bf21899b4675b0a18e24.zip
Copy the items on the completion list as the user moves through them. The
* lib/widgets/ephy-location-entry.c: * lib/widgets/ephy-location-entry.h: * src/ephy-completion-model.c: * src/ephy-completion-model.h: * src/ephy-location-action.c: Copy the items on the completion list as the user moves through them. The original input can be restored pressing Esc. The tentative completion can be made definitive pressing Left or Right. Fixes #409291, #102528 svn path=/trunk/; revision=7020
Diffstat (limited to 'lib/widgets/ephy-location-entry.c')
-rw-r--r--lib/widgets/ephy-location-entry.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 235eb56ab..084234935 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -53,6 +53,7 @@
#include <gtk/gtkseparatormenuitem.h>
#include <gtk/gtkalignment.h>
#include <gtk/gtkclipboard.h>
+#include <gtk/gtkversion.h>
#include <string.h>
@@ -78,6 +79,7 @@ struct _EphyLocationEntryPrivate
guint relevance_col;
guint extra_col;
guint favicon_col;
+ guint url_col;
guint hash;
@@ -994,6 +996,29 @@ sort_func (GtkTreeModel *model,
return valueb - valuea;
}
+#if GTK_CHECK_VERSION (2, 11, 0)
+static gboolean
+cursor_on_match_cb (GtkEntryCompletion *completion,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EphyLocationEntry *le)
+{
+ char *item = NULL;
+ GtkWidget *entry;
+
+ gtk_tree_model_get (model, iter,
+ le->priv->url_col,
+ &item, -1);
+
+ entry = gtk_entry_completion_get_entry (completion);
+ gtk_entry_set_text (GTK_ENTRY (entry), item);
+
+ g_free (item);
+
+ return TRUE;
+}
+#endif /* GTK+ 2.11.0 */
+
void
ephy_location_entry_set_completion (EphyLocationEntry *le,
GtkTreeModel *model,
@@ -1002,7 +1027,8 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
guint keywords_col,
guint relevance_col,
guint extra_col,
- guint favicon_col)
+ guint favicon_col,
+ guint url_col)
{
EphyLocationEntryPrivate *priv = le->priv;
GtkTreeModel *sort_model;
@@ -1015,6 +1041,7 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
le->priv->relevance_col = relevance_col;
le->priv->extra_col = extra_col;
le->priv->favicon_col = favicon_col;
+ le->priv->url_col = url_col;
sort_model = gtk_tree_model_sort_new_with_model (model);
g_object_unref (model);
@@ -1062,6 +1089,12 @@ ephy_location_entry_set_completion (EphyLocationEntry *le,
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion),
extracell, "text", extra_col);
+#if GTK_CHECK_VERSION (2, 11, 0)
+ g_object_set (completion, "inline-selection", TRUE, NULL);
+ g_signal_connect (completion, "cursor-on-match",
+ G_CALLBACK (cursor_on_match_cb), le);
+#endif
+
gtk_entry_set_completion (GTK_ENTRY (priv->icon_entry->entry), completion);
g_object_unref (completion);
}