GNOME Bugzilla – Bug 756831
userList: If no match found, show "No match found" instead of empty space.
Last modified: 2015-10-23 21:06:17 UTC
Created attachment 313706 [details] left: gnome-calendar, middle: proposal, right: gedit As quoted from the HIG: "If a search term does not return any results, ensure that feedback is given in the content view. Often a simple "No results" label is sufficient." [0] The attached picture shows how Gedit and Calendar does it. In the middle there is a proposal for how it could look like in Polari's userList. [0]: https://developer.gnome.org/hig/stable/search.html.en
I think this might be decent gnome-love material.
I did it in userList.js, but had enough elements and child elements that it almost makes more sense to create another .ui file, instead. The latest gedit build sets the placeholder ListBox element to a frame, fills the content area with it, and makes another container box, itself containing a GtkImage and a label. Although, there are similar sections in userList.js, so maybe it's fine. I will attach a patch soon.
(In reply to Cody Welsh from comment #2) > The latest gedit build sets the placeholder ListBox element to a frame, > fills the content area with it, and makes another container box, > itself containing a GtkImage and a label. gedit is a bit different though: it uses a treeview for the content, so the placeholder is handled separately. The user list on the other hand uses a listbox, so you can just pass the box with image+label to set_placeholder() and rely on the parent to provide the frame. That said, I don't mind if you want to make it a template - but if you do, make it a separate commit before adding the placeholder.
(In reply to Florian Müllner from comment #3) > The user list on the other hand uses a listbox, so you can just pass the box > with image+label to set_placeholder() and rely on the parent to > provide the frame. That actually made it a bit cleaner, so I think it might be fine without the template file, for now. Also, for the purpose of making the objects a bit dimmer, I guess we could either lower the opacity of the GtkImage and GtkLabel, or do what gedit does and put the '.dim-label' class on them. In this case, I did the latter. Let me know if you want anything else.
Created attachment 313952 [details] [review] ui: Show 'No results' placeholder in user list if query does not find any users We currently do not show the user anything if they type a string into the user list search box that doesn't return any results. This patch creates a placeholder that is similar in style to gedit's and gnome-calendar's.
Review of attachment 313952 [details] [review]: Mostly nits. Regarding the commit message: the subject is too long (should fit an 80-char terminal without wrapping) - something like: "userList: Show placeholder when filter doesn't match any users" Also: s/This patch creates/Create/ (or "Add a placeholder ..." ::: src/userList.js @@ +375,3 @@ + orientation: Gtk.Orientation.VERTICAL, + visible: true }); + let innerBoxIcon = new Gtk.Image({ icon_name: "edit-find-symbolic", Style nit: single quotes for non-translatable strings @@ +378,3 @@ + pixel_size: 64, + visible: true }); + let innerBoxLabel = new Gtk.Label({ label: "No results", String needs to be marked for translation @@ +382,3 @@ + + placeHolderBox.add(innerBoxIcon); + placeHolderBox.add(innerBoxLabel); Nit: GTK+ uses "placeholder" as a single work (set_placeholder(), not set_place_holder()), so should be placeholderBox. (Feel free to ignore: the other names don't make too much sense to me either, I'd go with: let placeholder = new Gtk.Box(...); placeholder.add(new Gtk.Image({ icon_name: 'edit-find-symbolic', ...}); placeholder.add(new Gtk.Label({ label: _("No results"), ... });
Created attachment 313966 [details] [review] ui: Show placeholder when filter doesn't match any users We currently do not show the user anything if they type a string into the user list search box that doesn't return any results. Create a placeholder that is similar in style to gedit's and gnome-calendar's.
Hopefully that's better! (I admit, I do more work than I should when tired)
Review of attachment 313966 [details] [review]: Sorry :-) - use "userList" instead of "ui" as prefix in subject - patch should be standalone, not on top of previous version - it should actually work (see below) ::: src/userList.js @@ +385,1 @@ this._list.set_placeholder(placeHolderBox); Left-over placeHolderBox here
Aaaand I submitted the wrong commit. Hold on a minute. I'll get it right one of these days, haha.
Created attachment 313967 [details] [review] userList: Show placeholder when filter doesn't match any users We currently do not show the user anything if they type a string into the user list search box that doesn't return any results. Create a placeholder that is similar in style to gedit's and gnome-calendar's.
Also, I think I marked the other patches as obsolete, but I'm not sure yet how to make it diff to the original file.
Created attachment 313969 [details] [review] userList: Show placeholder when filter doesn't match any users We currently do not show the user anything if they type a string into the user list search box that doesn't return any results. Create a placeholder that is similar in style to gedit's and gnome-calendar's.
Review of attachment 313969 [details] [review]: Yup!
Attachment 313969 [details] pushed as 3182bc6 - userList: Show placeholder when filter doesn't match any users