[pitivi] medialibrary: Avoid excessive work when searching/filtering clips



commit 168de4950277d3b12cbee505fe84f129f87f746c
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Tue Jan 22 18:32:56 2013 -0500

    medialibrary: Avoid excessive work when searching/filtering clips

 pitivi/medialibrary.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index fe1977c..b867aa4 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -359,7 +359,12 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         self._insertNextSource()
 
     def _searchEntryChangedCb(self, entry):
-        self.modelFilter.refilter()
+        # With many hundred clips in an iconview with dynamic columns and
+        # ellipsizing, doing needless searches is very expensive.
+        # Realistically, nobody expects to search for only one character,
+        # and skipping that makes a huge difference in responsiveness.
+        if len(entry.get_text()) != 1:
+            self.modelFilter.refilter()
 
     def _searchEntryIconClickedCb(self, entry, icon_pos, unused_event):
         if icon_pos == Gtk.EntryIconPosition.SECONDARY:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]