[polari/wip/fmuellner/window-experiments: 352/356] 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: 352/356] mainWindow: Add construct-only :single-room property
- Date: Mon, 20 Mar 2017 21:33:28 +0000 (UTC)
commit 774040baed201485c2956daf9e03b1d63e9a93ed
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 | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index b2460f7..2092d2a 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -121,7 +121,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._room = null;
this._lastActiveRoom = null;
+ this._singleRoom = false;
this._displayNameChangedId = 0;
this._topicChangedId = 0;
@@ -197,18 +204,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);
@@ -259,6 +273,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();
@@ -317,7 +343,7 @@ const MainWindow = new Lang.Class({
_onAccountsChanged: function(am) {
let hasAccounts = this._accountsMonitor.enabledAccounts.length > 0;
- this._roomListRevealer.reveal_child = hasAccounts;
+ this._roomListRevealer.reveal_child = !this._singleRoom && hasAccounts;
},
_updateDecorations: function() {
@@ -453,6 +479,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]