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 756831 - userList: If no match found, show "No match found" instead of empty space.
userList: If no match found, show "No match found" instead of empty space.
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: Polari maintainers
Polari maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-19 23:20 UTC by Bastian Ilsø
Modified: 2015-10-23 21:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
left: gnome-calendar, middle: proposal, right: gedit (83.05 KB, image/png)
2015-10-19 23:20 UTC, Bastian Ilsø
  Details
ui: Show 'No results' placeholder in user list if query does not find any users (1.81 KB, patch)
2015-10-23 18:21 UTC, Cody Welsh
none Details | Review
ui: Show placeholder when filter doesn't match any users (2.33 KB, patch)
2015-10-23 20:23 UTC, Cody Welsh
none Details | Review
userList: Show placeholder when filter doesn't match any users (1.28 KB, patch)
2015-10-23 20:36 UTC, Cody Welsh
none Details | Review
userList: Show placeholder when filter doesn't match any users (1.67 KB, patch)
2015-10-23 20:51 UTC, Cody Welsh
committed Details | Review

Description Bastian Ilsø 2015-10-19 23:20:46 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
Comment 1 Bastian Ilsø 2015-10-19 23:21:42 UTC
I think this might be decent gnome-love material.
Comment 2 Cody Welsh 2015-10-23 08:04:35 UTC
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.
Comment 3 Florian Müllner 2015-10-23 09:10:26 UTC
(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.
Comment 4 Cody Welsh 2015-10-23 18:20:44 UTC
(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.
Comment 5 Cody Welsh 2015-10-23 18:21:21 UTC
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.
Comment 6 Florian Müllner 2015-10-23 19:57:08 UTC
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"),
                                    ... });
Comment 7 Cody Welsh 2015-10-23 20:23:35 UTC
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.
Comment 8 Cody Welsh 2015-10-23 20:24:15 UTC
Hopefully that's better! (I admit, I do more work than I should when tired)
Comment 9 Florian Müllner 2015-10-23 20:27:52 UTC
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
Comment 10 Cody Welsh 2015-10-23 20:30:16 UTC
Aaaand I submitted the wrong commit. Hold on a minute. I'll get it right one of these days, haha.
Comment 11 Cody Welsh 2015-10-23 20:36:07 UTC
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.
Comment 12 Cody Welsh 2015-10-23 20:42:04 UTC
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.
Comment 13 Cody Welsh 2015-10-23 20:51:09 UTC
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.
Comment 14 Florian Müllner 2015-10-23 20:55:37 UTC
Review of attachment 313969 [details] [review]:

Yup!
Comment 15 Florian Müllner 2015-10-23 21:06:13 UTC
Attachment 313969 [details] pushed as 3182bc6 - userList: Show placeholder when filter doesn't match any users