[epiphany/gnome-3-36] Limit number of entries show in url drop down
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-36] Limit number of entries show in url drop down
- Date: Mon, 20 Apr 2020 16:32:17 +0000 (UTC)
commit 0bfff82556e584505c9852d8923c7e38a4bbf2a0
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sat Feb 29 11:11:50 2020 +0000
Limit number of entries show in url drop down
Set a limit of 25 for history / bookmark entries in order to improve
speed of url drop down. Open tabs and search engines are not limited.
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/1096
(cherry picked from commit 8e3e2886e903ec565bf7fff3f35d6035ea23a7a4)
src/ephy-suggestion-model.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c
index 9e5fdfc58..97965a01a 100644
--- a/src/ephy-suggestion-model.c
+++ b/src/ephy-suggestion-model.c
@@ -36,6 +36,7 @@ struct _EphySuggestionModel {
GSequence *urls;
GSequence *items;
GCancellable *icon_cancellable;
+ guint num_custom_entries;
};
enum {
@@ -247,6 +248,20 @@ load_favicon (EphySuggestionModel *model,
suggestion);
}
+static gboolean
+append_suggestion (EphySuggestionModel *self,
+ EphySuggestion *suggestion)
+{
+ if (self->num_custom_entries < 25) {
+ g_sequence_append (self->items, suggestion);
+ self->num_custom_entries++;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static guint
add_bookmarks (EphySuggestionModel *self,
const char *query)
@@ -286,9 +301,10 @@ add_bookmarks (EphySuggestionModel *self,
load_favicon (self, suggestion, url);
ephy_suggestion_set_secondary_icon (suggestion, "starred-symbolic");
- new_urls = g_list_prepend (new_urls, g_strdup (url));
- g_sequence_append (self->items, suggestion);
- added++;
+ if (append_suggestion (self, suggestion)) {
+ new_urls = g_list_prepend (new_urls, g_strdup (url));
+ added++;
+ }
}
}
@@ -326,8 +342,8 @@ add_history (EphySuggestionModel *self,
suggestion = ephy_suggestion_new (markup, title, url->url);
load_favicon (self, suggestion, url->url);
- g_sequence_append (self->items, suggestion);
- added++;
+ if (append_suggestion (self, suggestion))
+ added++;
}
return added;
@@ -390,6 +406,7 @@ add_tabs (EphySuggestionModel *self,
shell = ephy_embed_shell_get_default ();
application = G_APPLICATION (shell);
window = EPHY_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application)));
+ self->num_custom_entries = 0;
if (!window)
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]