[polari] userList: Only create user details on demand



commit 04e168aee4f607b787bb197885d5b4d2a6e71022
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Sep 21 00:16:16 2014 +0200

    userList: Only create user details on demand
    
    Just like the user list as a whole, a user's details may never be
    shown at all - in fact, for most users in the list this is the
    expected case. As the user details (for each user in the list!)
    contribute significantly to our excessive widget count, do the
    same as for the user list and only create the details widget
    when we are actually about to show it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732290

 src/userList.js |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index 1860f33..603d061 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -129,6 +129,7 @@ const UserListRow = new Lang.Class({
     },
 
     set expand(expand) {
+        this._ensureDetails();
         this._revealer.reveal_child = expand;
     },
 
@@ -152,8 +153,14 @@ const UserListRow = new Lang.Class({
         this._revealer = new Gtk.Revealer({ reveal_child: false });
         vbox.add(this._revealer);
 
+        this.widget.show_all();
+    },
+
+    _ensureDetails: function() {
+        if (this._revealer.get_child())
+            return;
+
         let frame = new Gtk.Frame({ hexpand: true });
-        this._revealer.add(frame);
 
         let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
                                 spacing: 6, margin: 6 });
@@ -171,6 +178,7 @@ const UserListRow = new Lang.Class({
                                            hexpand: true });
         box.add(this._detailsGrid);
 
+        let user = this.widget.user;
         if (user != user.connection.self_contact) {
             let button = new Gtk.Button({ label: _("Message"),
                                           margin_top: 12,
@@ -184,7 +192,8 @@ const UserListRow = new Lang.Class({
             box.add(button);
         }
 
-        this.widget.show_all();
+        this._revealer.add(frame);
+        frame.show_all();
     },
 
     _formatLast: function(seconds) {


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