[polari/wip/fmuellner/window-experiments: 31/32] mainWindow: Add construct-only :single-room property
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/window-experiments: 31/32] mainWindow: Add construct-only :single-room property
- Date: Tue, 19 Jul 2016 16:52:28 +0000 (UTC)
commit c36c35dcebb959aad709d6a658c58fa377ed960b
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jul 19 18:31:42 2016 +0200
mainWindow: Add construct-only :single-room property
src/mainWindow.js | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 799d8af..5f1987f 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -119,7 +119,13 @@ const MainWindow = new Lang.Class({
'active-room-id',
'active-room-id',
GObject.ParamFlags.READABLE,
- '')
+ ''),
+ 'single-room': GObject.ParamSpec.boolean('single-room',
+ 'single-room',
+ 'single-room',
+ GObject.ParamFlags.READWRITE |
+ GObject.ParamFlags.CONSTRUCT_ONLY,
+ false)
},
Signals: { 'active-room-state-changed': {} },
@@ -131,6 +137,7 @@ const MainWindow = new Lang.Class({
this._entries = {};
this._room = null;
+ this._singleRoom = false;
this._displayNameChangedId = 0;
this._topicChangedId = 0;
@@ -191,18 +198,25 @@ const MainWindow = new Lang.Class({
state: GLib.Variant.new('b', false),
accels: ['F9', '<Primary>u'] },
{ name: 'next-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
accels: ['<Primary>Page_Down', '<Alt>Down'] },
{ name: 'previous-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
accels: ['<Primary>Page_Up', '<Alt>Up'] },
{ name: 'first-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
accels: ['<Primary>Home'] },
{ name: 'last-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
accels: ['<Primary>End'] },
{ name: 'nth-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
parameter_type: GLib.VariantType.new('i') },
{ name: 'next-pending-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
accels: ['<Alt><Shift>Down', '<Primary><Shift>Page_Down']},
{ name: 'previous-pending-room',
+ create_hook: Lang.bind(this, this._roomNavCreateHook),
accels: ['<Alt><Shift>Up', '<Primary><Shift>Page_Up']}
];
Utils.addActionEntries(this, 'win', actionEntries);
@@ -247,6 +261,18 @@ const MainWindow = new Lang.Class({
return this._subtitle.length > 0;
},
+ get single_room() {
+ return this._singleRoom;
+ },
+
+ set single_room(value) {
+ if (this._singleRoom == value)
+ return;
+
+ this._singleRoom = value;
+ this.notify('single-room');
+ },
+
_onWindowStateEvent: function(widget, event) {
let state = event.get_window().get_state();
@@ -266,8 +292,8 @@ const MainWindow = new Lang.Class({
},
_onAccountsChanged: function(am) {
- let accounts = am.dupAccounts();
- this._roomListRevealer.reveal_child = accounts.some(a => a.enabled);
+ let hasAccounts = am.dupAccounts().some(a => a.enabled);
+ this._roomListRevealer.reveal_child = !this._singleRoom && hasAccounts;
},
_updateDecorations: function() {
@@ -392,6 +418,10 @@ const MainWindow = new Lang.Class({
this._updateUserListAction(action);
},
+ _roomNavCreateHook: function(action) {
+ action.enabled = !this._singleRoom;
+ },
+
_updateUserListLabel: function() {
let numMembers = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]