GSoC 2012: Report 3

  • ~3 min read

This report covers the third two week block of coding time, June 18 – July 1.

Week 5

I spent most of the time going over the search display and search provider code. I also spent some time thinking about how to do the recent files bit and really couldn’t come up with a reasonable way to do what the design calls for.

Week 6

Being stymied by the recent files stuff, this week I moved on to UI work (mockups/description here). It was quick to swap out provider titles for icons. I thought it would be quick to inline the search results with the provider icon as well, just remove vertical: true from the search providers box and be done. Of course, it’s never that easy. There are layout issues somewhere along the chain for the search results which causes the height of the results grid to collapse when in a non-vertical St.BoxLayout. I summarized it on IRC like so:

In searchDisplay.js each provider has a St.BoxLayout for its search stuff. If that BoxLayout vertical property is set to false (to inline the children), the resultsDisplay* stuff seems to have it’s height ignored, i.e., the BoxLayout is maybe 5-10px tall with a grid of large icons as a child. If one adds a St.Icon or St.Label, the BoxLayout height adjusts to accommodate it while still ignoring the grid. When vertical is true, the BoxLayout fits to the grid height.

If interested, the quickest way to see it would be to change the vertical property of providerBox in createProviderMeta() (line 269 in searchDisplay.js) to false. I talked to Rui about it and he came up with a fix (bug 679168). I don’t think it is the final/proper fix, which I’m happy to leave for more experienced people, but it works for me to test with.

With the layout issue out of my way for the time being, I moved to what I have been calling the ‘more’ icon, the ‘+’ that is shown when there are more results than displayed. Again, I thought it would be fairly easy, most of the infrastructure looked like it was already in place. Most importantly, there was a _notDisplayedResult array already present in GridSearchResults so just setup something to check if it’s length is > 0 and if so, show the ‘more’ icon. Well, it works wonderfully on all searches except the initial one on the system. Building results for the very first search term on a Shell start/restart doesn’t set _notDisplayedResult properly.

So, if I restart the Shell and search for ‘t’, a search for which Settings provides more results than can be displayed, no ‘more’ icon is shown. If one then adds an ‘a’ to the search so that it becomes ‘ta’ no ‘more’ icon is shown since no provider has many results. Now, the fun part, I hit ← Backspace (deleting ‘a’) so the search is now just for ‘t’ (our original term) and magically, a ‘+’ is now displayed on the Settings icon (as it should be). Any new or continued search after that initial term will be fine. What appears to be the case from some minimal debugging, is that IconGrid.childrenInRow() is not picking up the icon width from the CSS before we initially draw the results, so it considers 48px as icon width to calculate from, when in fact it is more like 118px. That means _notDisplayedResult is off since GridSearcResults calculates it can display some 20 results (the right amount if the icons are 48px), it grabs all 18 Settings results for ‘t’ while only showing 6. It sorts itself out on subsequent searches, just the very initial start of the first search is wrong.

Additionally, in line with the design, when the provider icon is clicked, a new provider function called launchSearch is executed, which should cause the app associated with the provider to open and run the current search term(s) itself. No provider currently supplies such a function since it was just created, but in the future they will need to, unless someone can see another way to do it.

Looking Forward

I have plenty of the little things to fix. I also need to get this work prettied up and attached to a bug (or bugs) for review.