[banshee] Improve search responsiveness on large libraries
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Improve search responsiveness on large libraries
- Date: Tue, 2 Mar 2010 18:41:05 +0000 (UTC)
commit fb3c382cbfa943f4dcced1994d46040a9be7e971
Author: Gabriel Burt <gabriel burt gmail com>
Date: Tue Mar 2 10:37:20 2010 -0800
Improve search responsiveness on large libraries
If the library is sufficiently large, add a longer delay before
initiating the search so the user can type the whole query out, instead
of it initiating the search after each character, and the UI becoming
unresponsive (bgo#540835). The exact thresholds for the longer delay
are the library has > 20k items or the current, filtered item count is >
10k items.
src/Clients/Nereid/Nereid/PlayerInterface.cs | 5 +++++
.../Banshee.Widgets/Banshee.Widgets/SearchEntry.cs | 5 ++++-
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index 9f91357..22cfced 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -606,6 +606,11 @@ namespace Nereid
}
status_label.Text = source.GetStatusText ();
+
+ // We need a bit longer delay between query character typed to search initiated
+ // when the library is sufficiently big; see bgo #540835
+ bool long_delay = source.FilteredCount > 10000 || (source.Parent ?? source).Count > 20000;
+ view_container.SearchEntry.ChangeTimeoutMs = long_delay ? (uint)250 : (uint)25;
}
#endregion
diff --git a/src/Core/Banshee.Widgets/Banshee.Widgets/SearchEntry.cs b/src/Core/Banshee.Widgets/Banshee.Widgets/SearchEntry.cs
index 11fa899..fc388cf 100644
--- a/src/Core/Banshee.Widgets/Banshee.Widgets/SearchEntry.cs
+++ b/src/Core/Banshee.Widgets/Banshee.Widgets/SearchEntry.cs
@@ -65,12 +65,15 @@ namespace Banshee.Widgets
remove { filter_changed -= value; }
}
+ public uint ChangeTimeoutMs { get; set; }
+
public Menu Menu {
get { return menu; }
}
public SearchEntry()
{
+ ChangeTimeoutMs = 25;
AppPaintable = true;
BuildWidget();
@@ -185,7 +188,7 @@ namespace Banshee.Widgets
}
if (Ready)
- changed_timeout_id = GLib.Timeout.Add(25, OnChangedTimeout);
+ changed_timeout_id = GLib.Timeout.Add(ChangeTimeoutMs, OnChangedTimeout);
}
private bool OnChangedTimeout()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]