[polari] entryArea: Use ::paste-clipboard signal instead of vfunc



commit 6f1eaa546b9fd6da5cf2eee095e042110450d30b
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 24 16:16:56 2021 +0200

    entryArea: Use ::paste-clipboard signal instead of vfunc
    
    The vfunc is gone in GTK4, so switch to the corresponding signal
    and stop the default handler, which works in both versions.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/225>

 src/entryArea.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 304c8624..1714f9fe 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -41,6 +41,8 @@ export const ChatEntry = GObject.registerClass({
         });
 
         this._useDefaultHandler = false;
+
+        this.connect('paste-clipboard', this._onPasteClipboard.bind(this));
     }
 
     // eslint-disable-next-line camelcase
@@ -58,11 +60,11 @@ export const ChatEntry = GObject.registerClass({
         super.vfunc_drag_data_received(context, x, y, data, info, time);
     }
 
-    vfunc_paste_clipboard() {
-        if (!this.editable || this._useDefaultHandler) {
-            super.vfunc_paste_clipboard();
+    _onPasteClipboard(editable) {
+        if (!this.editable || this._useDefaultHandler)
             return;
-        }
+
+        editable.stop_emission_by_name('paste-clipboard');
 
         let clipboard = Gtk.Clipboard.get_default(this.get_display());
         clipboard.request_uris((cb, uris) => {


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