GNOME Bugzilla – Bug 779960
Implement room list filtering
Last modified: 2017-03-14 01:07:30 UTC
Patches are on top of bug 779940. For testing convenience, everything is available on the wip/fmuellner/roomlist-filtering branch, or as flatpak build in the repo at https://people.gnome.org/~fmuellner/fmuellner.flatpakrepo.
Created attachment 347781 [details] [review] utils: Add updateTerms() helper As we will soon add filtering to the server room list, it makes sense to generalize how we normalize and split filter text into terms. Add a utility method based on the code in ConnectionsList for that purpose. As a bonus, the method's return value indicates whether the terms actually changed, so callers can avoid unneeded work (for example when the amount of stripped whitespace changed).
Created attachment 347782 [details] [review] connection: Only refilter networks on actual filter changes Use the shared updateTerms() helper and take advantage of its return value.
Created attachment 347783 [details] [review] serverRoomList: Add ModelFilter TreeViews are filtered by wrapping the actual model in a ModelFilter, so do that to prepare for room list filtering.
Created attachment 347784 [details] [review] serverRoomList: Implement filtering The entry already looks like it can be used to filter the list of rooms, now make it behave as advertised.
Created attachment 347785 [details] [review] serverRoomList: Don't use filter text as room name to join Now that the entry is used for filtering the room list, it is extremely weird to also use its text as room name that is joined along the selected rooms from the list - it means the user either has to enter the complete room name (in which case selecting rooms from the list becomes pointless), or remember to clear the entry after selecting a room. Just remove the conflicting functionality for now, we will bring back the ability to enter custom room names in a way that is compatible with filtering soon.
Created attachment 347786 [details] [review] serverRoomList: Include custom room item in list While creating new rooms (by joining a non-existent room) isn't a very common operation, allowing users to enter a custom room name is still important, as it means they can join rooms while the list hasn't been loaded yet. To account for that case, include an additional row in the list that uses the current filter text as room name.
Created attachment 347787 [details] [review] serverRoomList: Hide custom room item for exact matches Now that we mirror the filter text in a row, we can end up with a duplicated room name in case the list contains an exact match. We don't need a custom item in that case, so hide it.
Created attachment 347788 [details] [review] serverRoomList: Provide an efficient way to join a single room The ability to join multiple rooms at once is neat, but most useful right after setting up a new network. After that, by far the most common case is to join a single room, so it's worth making that case as efficient as possible. Right now we require users to select a room by selecting a row via mouse or keynav, and then activate the join button. This is often slower than the pre-room-list dialog, where a room was joined by hitting Enter after typing the (full) room name - to improve on both current and old behavior, keep the top result selected when filtering and toggle the selected row when the entry is activated.
Attachment 347781 [details] pushed as 4eecba1 - utils: Add updateTerms() helper Attachment 347782 [details] pushed as c8814c8 - connection: Only refilter networks on actual filter changes Attachment 347783 [details] pushed as 2182d2b - serverRoomList: Add ModelFilter Attachment 347784 [details] pushed as 6c139ab - serverRoomList: Implement filtering Attachment 347785 [details] pushed as 7f30cee - serverRoomList: Don't use filter text as room name to join Attachment 347786 [details] pushed as ebbf7ba - serverRoomList: Include custom room item in list Attachment 347787 [details] pushed as e470de1 - serverRoomList: Hide custom room item for exact matches Attachment 347788 [details] pushed as 05c3115 - serverRoomList: Provide an efficient way to join a single room