After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 721595 - Typing should trigger a search
Typing should trigger a search
Status: RESOLVED FIXED
Product: gnome-music
Classification: Applications
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks:
 
 
Reported: 2014-01-05 19:32 UTC by Sidhant Panda
Modified: 2014-02-10 07:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Enables search on typing (1.07 KB, patch)
2014-02-06 08:40 UTC, Julian Bayardo
needs-work Details | Review
Enables search on keypress (1.26 KB, patch)
2014-02-07 20:58 UTC, Julian Bayardo
none Details | Review

Description Sidhant Panda 2014-01-05 19:32:49 UTC
It would be very convenient if typing itself triggered the search.
Comment 1 Julian Bayardo 2014-02-06 08:40:36 UTC
Created attachment 268262 [details] [review]
Enables search on typing
Comment 2 Julian Bayardo 2014-02-06 08:41:49 UTC
Searching seems to work fine as far as I've tested
Comment 3 Vadim Rutkovsky 2014-02-06 11:00:38 UTC
Review of attachment 268262 [details] [review]:

::: gnomemusic/searchbar.py
@@ +57,3 @@
+            if self.view:
+                self.view.filter.refilter()
+        except AttributeError:

Skipping AttributeError here is a bad idea, we need to handle it better. Why would it happen here anyway?
Comment 4 Julian Bayardo 2014-02-06 18:04:15 UTC
Well, essentially the problem is Searchbar.prepare_search_filter is not called even though the functions are called in the same manner as the search button, hence generating an AttributeError when calling Searchbar.search_entry_changed. Another way to fix it is by adding self.view = None in Searchbar.__init__.

Either fix produces the same result. As to why Searchbar.prepare_search_filter is not called, I have no idea.

As a side comment, the function Window._show_searchbar violates encapsulation when calling "self.toolbar.searchbar._search_entry.grab_focus". It might be a better approach to create a Searchbar.show_bar which handles the same job.
Comment 5 Vadim Rutkovsky 2014-02-07 11:08:39 UTC
(In reply to comment #4)
> Either fix produces the same result.
This is not really safe to do exception catching with 'pass' anyway

> Another way to fix it is by adding self.view = None in Searchbar.__init__.
Seems like a good idea. Care to update the patch? 

> It might be a better approach to create a Searchbar.show_bar which handles the same job.
Agreed, could you prepare a second patch to improve this?
Comment 6 Julian Bayardo 2014-02-07 20:58:36 UTC
Created attachment 268449 [details] [review]
Enables search on keypress
Comment 8 Sidhant Panda 2014-02-10 07:36:08 UTC
Even I was trying to code to get the same result. Thanks a lot for getting it done :)