[polari] mainWindow: Expose view height property
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] mainWindow: Expose view height property
- Date: Sun, 21 Apr 2019 22:11:02 +0000 (UTC)
commit 7ad2694c23f3640a6652f57d93f17e682a9224fc
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Apr 18 02:40:18 2019 +0000
mainWindow: Expose view height property
We want to allow the userlist to grow as big as the corresponding view,
so we need to know the maximum size to impose on the popover. Simply
export it as a property on the toplevel.
https://bugzilla.gnome.org/show_bug.cgi?id=768851
src/mainWindow.js | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 2e264ea..c5c8229 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -99,7 +99,11 @@ var MainWindow = GObject.registerClass({
'active-room': GObject.ParamSpec.object(
'active-room', 'active-room', 'active-room',
GObject.ParamFlags.READWRITE,
- Polari.Room.$gtype)
+ Polari.Room.$gtype),
+ 'view-height': GObject.ParamSpec.uint(
+ 'view-height', 'view-height', 'view-height',
+ GObject.ParamFlags.READABLE,
+ 0, GLib.MAXUINT32, 0)
},
Signals: {
'active-room-state-changed': {}
@@ -135,6 +139,10 @@ var MainWindow = GObject.registerClass({
if (GLib.get_application_name().toLowerCase().includes('snapshot'))
this.get_style_context().add_class('snapshot');
+ this._roomStack.connect('size-allocate', () => {
+ this.notify('view-height');
+ });
+
// command output notifications should not pop up over
// the input area, but appear to emerge from it, so
// set up an appropriate margin
@@ -205,6 +213,11 @@ var MainWindow = GObject.registerClass({
return this._subtitle.length > 0;
}
+ // eslint-disable-next-line camelcase
+ get view_height() {
+ return this._roomStack.get_allocated_height() - this._roomStack.entry_area_height;
+ }
+
_onWindowStateEvent(widget, event) {
let state = event.get_window().get_state();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]