aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-23 08:34:12 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-23 08:34:12 +0800
commit7fe73f1990a361a3c794ef5517e2cb4d3188466e (patch)
treec1b0382e254dd9dd3c53072f397f40bb60675738 /lib
parent5d0ba75eb24a3acee481ce987b6003ef36195c94 (diff)
downloadgsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.tar
gsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.tar.gz
gsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.tar.bz2
gsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.tar.lz
gsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.tar.xz
gsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.tar.zst
gsoc2013-epiphany-7fe73f1990a361a3c794ef5517e2cb4d3188466e.zip
Fix autocompletion to not show duped entries. Complete print preview impl.
2003-01-23 Marco Pesenti Gritti <marco@it.gnome.org> * TODO: * lib/ephy-autocompletion.c: (ephy_autocompletion_reset), (ephy_autocompletion_set_key), (ephy_autocompletion_update_matches_full): * lib/widgets/ephy-location-entry.c: (get_editable_number_of_chars), (position_is_at_end), (ephy_location_entry_key_press_event_cb): * src/ephy-favicon-action.c: (ephy_favicon_action_finalize): * src/ephy-favorites-menu.c: (ephy_favorites_menu_finalize_impl), (ephy_favorites_menu_rebuild): * src/ephy-window.c: (add_widget), (setup_window), (ephy_window_finalize), (ephy_window_set_chrome): * src/ppview-toolbar.c: (toolbar_update_sensitivity), (ppview_toolbar_set_window), (toolbar_cmd_ppv_close): * src/toolbar.c: (toolbar_setup_widgets), (toolbar_finalize): Fix autocompletion to not show duped entries. Complete print preview impl. Fix actions referencing, a bug in egg still blocking it though.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-autocompletion.c5
-rw-r--r--lib/widgets/ephy-location-entry.c24
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/ephy-autocompletion.c b/lib/ephy-autocompletion.c
index 361b0ed2f..3fd67a5df 100644
--- a/lib/ephy-autocompletion.c
+++ b/lib/ephy-autocompletion.c
@@ -174,7 +174,6 @@ ephy_autocompletion_reset (EphyAutocompletion *ac)
START_PROFILER ("Resetting autocompletion")
- acma_destroy (&p->matches);
g_free (p->common_prefix);
p->common_prefix = NULL;
p->status = GAS_NEEDS_FULL_UPDATE;
@@ -219,6 +218,8 @@ ephy_autocompletion_set_key (EphyAutocompletion *ac,
}
}
+ LOG ("Set key %s, old key %s", key, p->keys[0])
+
if (keylen >= p->key_lengths[0]
&& !strncmp (p->keys[0], key, p->key_lengths[0]))
{
@@ -444,6 +445,8 @@ ephy_autocompletion_update_matches_full (EphyAutocompletion *ac)
START_PROFILER ("Update full")
+ acma_destroy (&p->matches);
+
for (li = p->sources; li; li = li->next)
{
EphyAutocompletionSource *s = EPHY_AUTOCOMPLETION_SOURCE (li->data);
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 5a947a7b2..545c3bcaa 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -338,6 +338,27 @@ ephy_location_entry_autocompletion_to (EphyLocationEntry *w)
return FALSE;
}
+static int
+get_editable_number_of_chars (GtkEditable *editable)
+{
+ char *text;
+ int length;
+
+ text = gtk_editable_get_chars (editable, 0, -1);
+ length = g_utf8_strlen (text, -1);
+ g_free (text);
+ return length;
+}
+
+static gboolean
+position_is_at_end (GtkEditable *editable)
+{
+ int end;
+
+ end = get_editable_number_of_chars (editable);
+ return gtk_editable_get_position (editable) == end;
+}
+
/* this is from the old location entry, need to do the autocompletion before implementing this */
static gboolean
ephy_location_entry_key_press_event_cb (GtkWidget *entry, GdkEventKey *event, EphyLocationEntry *w)
@@ -466,7 +487,8 @@ ephy_location_entry_key_press_event_cb (GtkWidget *entry, GdkEventKey *event, Ep
break;
default:
ephy_location_entry_autocompletion_unselect_alternatives (w);
- if ((event->string[0] > 32) && (event->string[0] < 126))
+ if ((event->string[0] > 32) && (event->string[0] < 126) &&
+ position_is_at_end (GTK_EDITABLE (entry)))
{
p->show_alternatives_timeout = g_timeout_add
(SHOW_ALTERNATIVES_DELAY,