[polari/popover: 2/4] userList: Stop using a stack
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/popover: 2/4] userList: Stop using a stack
- Date: Wed, 5 Mar 2014 09:58:49 +0000 (UTC)
commit 4539f3b6429f84c7a23b87a9cc6df6d4d04d50de
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jan 23 09:00:14 2014 -0500
userList: Stop using a stack
By using a modal popover, the user list has now become a lot more
temporary. As a result, there is no longer a need for transitioning
between different lists on room switches, so we can just add the
correct list to the popover instead of keeping all lists around in
a stack. As GtkStack does a rather poor job at not propagating state
to non-visible children, this speeds up the UI significantly.
src/userList.js | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index 51a4577..8b82ced 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -69,10 +69,6 @@ const UserListPopover = new Lang.Class({
}));
frame.add(this._entry);
- this._stack = new Gtk.Stack({ hexpand: true, vexpand: true });
- this._stack.transition_type = Gtk.StackTransitionType.CROSSFADE;
- this._box.add(this._stack);
-
this._box.show_all();
},
@@ -83,8 +79,6 @@ const UserListPopover = new Lang.Class({
let userList = new UserList(room);
this._rooms[room.id] = userList;
- this._stack.add_named(userList.widget, room.id);
-
userList.widget.vadjustment.connect('changed',
Lang.bind(this, this._updateEntryVisibility));
},
@@ -100,12 +94,16 @@ const UserListPopover = new Lang.Class({
this._entry.text = '';
this._updateFilter();
+ let currentList = this._room ? this._rooms[this._room.id] : null;
+ if (currentList)
+ this._box.remove(currentList.widget);
+
this._room = room;
if (!room || !this._rooms[room.id])
return;
- this._stack.set_visible_child_name(room.id);
+ this._box.add(this._rooms[room.id].widget);
this._updateEntryVisibility();
},
@@ -325,7 +323,7 @@ const UserList = new Lang.Class({
Name: 'UserList',
_init: function(room) {
- this.widget = new Gtk.ScrolledWindow();
+ this.widget = new Gtk.ScrolledWindow({ hexpand: true, vexpand: true });
this.widget.hscrollbar_policy = Gtk.PolicyType.NEVER;
this._list = new Gtk.ListBox();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]