[polari] userList: Show placeholder when filter doesn't match any users



commit 3182bc60c688ce8acc1c3259b1f2ffece3fa912a
Author: Cody Welsh <codyw protonmail com>
Date:   Fri Oct 23 11:17:10 2015 -0700

    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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756831

 src/userList.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index d08c696..e46914d 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -370,6 +370,20 @@ const UserList = new Lang.Class({
         this._list = new Gtk.ListBox({ vexpand: true });
         this.widget.add(this._list);
 
+        let placeholder = new Gtk.Box({ halign: Gtk.Align.CENTER,
+                                        valign: Gtk.Align.CENTER,
+                                        orientation: Gtk.Orientation.VERTICAL,
+                                        visible: true });
+        placeholder.add(new Gtk.Image({ icon_name: 'edit-find-symbolic',
+                                        pixel_size: 64,
+                                        visible: true }));
+        placeholder.add(new Gtk.Label({ label: _("No results"),
+                                        visible: true }));
+
+        placeholder.get_style_context().add_class('dim-label');
+
+        this._list.set_placeholder(placeholder);
+
         this._updateHeightId = 0;
         this._list.connect('size-allocate',
                            Lang.bind(this, this._updateContentHeight));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]