[polari/wip/fmuellner/window-experiments: 11/15] 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: 11/15] mainWindow: Add construct-only :single-room property
- Date: Thu, 21 Jul 2016 02:57:15 +0000 (UTC)
commit 3ac0c0f15a24cf3290ef69566b4d923b76f4598b
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 6045d78..1455e29 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': {} },
@@ -128,6 +134,7 @@ const MainWindow = new Lang.Class({
params.show_menubar = false;
this._room = null;
+ this._singleRoom = false;
this._displayNameChangedId = 0;
this._topicChangedId = 0;
@@ -188,18 +195,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);
@@ -243,6 +257,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();
@@ -262,8 +288,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() {
@@ -390,6 +416,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]