[polari] roomList: Sort accounts with no rooms last
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] roomList: Sort accounts with no rooms last
- Date: Fri, 29 Jan 2016 15:35:09 +0000 (UTC)
commit 8a28956be273dbd7178919826f2428308a4ba824
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Jan 25 13:12:38 2016 +0100
roomList: Sort accounts with no rooms last
We now include inactive accounts in the list so the user can
manage them, but they are less interesting than accounts with
open conversations - make the sort order reflect that.
https://bugzilla.gnome.org/show_bug.cgi?id=709984
src/roomList.js | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index 142828a..a05c8ee 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -468,6 +468,11 @@ const RoomList = new Lang.Class({
this._placeholders[account] = placeholder;
this.widget.add(placeholder);
+ placeholder.connect('notify::visible', Lang.bind(this,
+ function() {
+ this.widget.invalidate_sort();
+ }));
+
this._updatePlaceholderVisibility(account);
},
@@ -560,6 +565,12 @@ const RoomList = new Lang.Class({
let account1 = row1.account;
let account2 = row2.account;
+ let hasRooms1 = !this._placeholders[account1].visible;
+ let hasRooms2 = !this._placeholders[account2].visible;
+
+ if (hasRooms1 != hasRooms2)
+ return hasRooms1 ? -1 : 1;
+
if (account1 != account2)
return account1.display_name.localeCompare(account2.display_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]