GNOME Bugzilla – Bug 732416
grid search results are truncated when modifying search terms
Last modified: 2014-07-19 21:02:21 UTC
The search when in grid mode (AppSearchResults for one) initially returns all results, then if one do a search that returns no results, then fix its terms, the results will be truncated to one of them. Steps to reproduce: 1. search with results (here "d"for AppDisplay) 2. search with no results (here "dx"as term ), 3. search from step 1 - this time I only see one result - (here "d"), 4. a search with no results (here "dx" again), 5. same search as in step 1 and 3 - this time I get all the results as in step 1 - (here "d") _getMaxDisplayedResults is called only in 1, 3 and 5 . It is this value that down the filterResults to one item in step "3" as it computes the number of results from the width of the GridSearchResults._bin parent of the IconGrid. This bin width down when the IconGrid has no children to expand inside of it (ie the _clearResultDisplay if GridSearchResults is called from the updateSearch). PS: The IconGrid _getPreferredWidth returned alloc.min_size has an issue in that it returns too big a size when no child is there any more (ie 136 instead of 0). Thus the _getMaxDisplayedResults ends up as value 1 instead (with above 0 instead of 136 it would be zero returned as max). Still it is bad a value, only one result is displayed.
Created attachment 279525 [details] [review] Search: Don't use IconGrid width for maxDisplayedResults Currently to know how many results we could show for GridResults we use the width of the bin containing those results. Since it's expanding it shouldn't be a problem. But it becomes a problem when no results are displayed, thus the IconGrid becomes 0 width, and therefore the bin becomes 0 width too. In the next introduction of terms in search we call again maxDisplayedResults with a width of 0, and therefore no results are displayed (currently a bug on IconGrid makes the min size = one icon, so actually we show one and only one icon in this case). To solve that use the parent container which contains the search results of all providers or the text label with not displayed results, so it always have the real available width to calculate maxDisplayedResults. Thanks Alban Browaeys for the debugging footwork.
To be honest couldn't find why it was working before in the first search call, since IconGrid has no children and therefore preferred_width is 0 and therefore the container bin should be 0. Instead of that the debug results was that the first time the container bin had the parent width and therefore was working fine.
Created attachment 280724 [details] [review] Search: Don't use IconGrid width for maxDisplayedResults Currently to know how many results we could show for GridResults we use the width of the bin containing those results. Since it's expanding it shouldn't be a problem. But it becomes a problem when no results are displayed, thus the container becomes hidden and it losts its allocation. In the next introduction of terms in search we call again maxDisplayedResults but it doesn't have allocation yet, and therefore no results are displayed (currently a bug on IconGrid makes the min size = one icon, so actually we show one and only one icon in this case). To solve that use the parent container which contains the search results of all providers or the text label with not displayed results, so it always have the real available width to calculate maxDisplayedResults. Thanks Alban Browaeys for the debugging footwork.
Review of attachment 280724 [details] [review]: Looks good.
Attachment 280724 [details] pushed as 9970671 - Search: Don't use IconGrid width for maxDisplayedResults
*** Bug 710531 has been marked as a duplicate of this bug. ***