[polari] roomStack: Stop using ::size-allocate signal



commit 142693a4f3410b81e9fdf4d0abd579f3d9f0c9d3
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Sep 25 19:33:39 2020 +0200

    roomStack: Stop using ::size-allocate signal
    
    The signal is gone is GTK4, so replace it with a more future-proof
    vfunc.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/225>

 src/roomStack.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/roomStack.js b/src/roomStack.js
index 6983cb38..872f752a 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -35,12 +35,6 @@ export default GObject.registerClass({
         this.add_named(new ChatPlaceholder(this._sizeGroup), 'placeholder');
 
         this._entryAreaHeight = 0;
-        this._sizeGroup.get_widgets()[0].connect('size-allocate', (w, rect) => {
-            if (this._entryAreaHeight !== rect.height - 1) {
-                this._entryAreaHeight = rect.height - 1;
-                this.notify('entry-area-height');
-            }
-        });
 
         this.connect('destroy', () => {
             this._roomManager.disconnect(this._roomAddedId);
@@ -61,6 +55,17 @@ export default GObject.registerClass({
         this._updateSensitivity();
     }
 
+    vfunc_size_allocate(allocation) {
+        super.vfunc_size_allocate(allocation);
+
+        const [firstEntry] = this._sizeGroup.get_widgets();
+        const entryHeight = firstEntry.get_allocated_height() - 1;
+        if (this._entryAreaHeight !== entryHeight) {
+            this._entryAreaHeight = entryHeight;
+            this.notify('entry-area-height');
+        }
+    }
+
     // eslint-disable-next-line camelcase
     get entry_area_height() {
         return this._entryAreaHeight;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]