[polari] roomStack: Keep all views around (again)
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] roomStack: Keep all views around (again)
- Date: Wed, 7 Oct 2015 17:02:30 +0000 (UTC)
commit 86915d682e9375a7372c77f7e62e232395399cab
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Oct 2 18:22:12 2015 +0200
roomStack: Keep all views around (again)
Commit 13299455 worked around stack performance issues by only keeping
one or two (during transitions) visible children in the stack. However
this introduced a race condition where no view at all would be visible
when switching channels quickly, and GtkStack performance has improved
significantly, so revert that commit.
https://bugzilla.gnome.org/show_bug.cgi?id=753420
src/roomStack.js | 27 ++++-----------------------
1 files changed, 4 insertions(+), 23 deletions(-)
---
diff --git a/src/roomStack.js b/src/roomStack.js
index 2156a60..b06f7b4 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -13,7 +13,8 @@ const RoomStack = new Lang.Class({
_init: function(inputSizeGroup) {
this._inputSizeGroup = inputSizeGroup;
- this.widget = new Gtk.Stack();
+ this.widget = new Gtk.Stack({ homogeneous: true,
+ transition_type: Gtk.StackTransitionType.CROSSFADE });
this.widget.show_all();
this._roomManager = ChatroomManager.getDefault();
@@ -36,8 +37,7 @@ const RoomStack = new Lang.Class({
this._rooms[id] = view;
this._inputSizeGroup.add_widget(view.inputWidget);
- if (!this.widget.visible_child)
- this.widget.add(view.widget);
+ this.widget.add_named(view.widget, id);
},
_roomAdded: function(roomManager, room) {
@@ -50,26 +50,7 @@ const RoomStack = new Lang.Class({
},
_activeRoomChanged: function(manager, room) {
- let previous = this.widget.visible_child;
- let next = this._rooms[room ? room.id : 'placeholder'];
-
- if (!next.widget.get_parent())
- this.widget.add(next.widget);
- this.widget.set_visible_child(next.widget);
- this.widget.transition_type = room ? Gtk.StackTransitionType.CROSSFADE
- : Gtk.StackTransitionType.NONE;
-
- if (!previous)
- return;
-
- let id = this.widget.connect('notify::transition-running', Lang.bind(this,
- function() {
- if (this.widget.transition_running)
- return;
- if (previous.get_parent())
- this.widget.remove(previous);
- this.widget.disconnect(id);
- }));
+ this.widget.set_visible_child_name(room ? room.id : 'placeholder');
},
_updateSensitivity: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]