[polari] entryArea: Make paste handlers public



commit afba5fa12c2be5f1572aafe0aa447493c2589330
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 12 01:07:47 2016 +0100

    entryArea: Make paste handlers public
    
    Those are currently used to handle content pasted in the entry, but
    we will soon re-use them for dropped content as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766068

 src/entryArea.js |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index dd2d853..3fd1636 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -124,9 +124,18 @@ const EntryArea = new Lang.Class({
             }));
         this._nickPopover.set_default_widget(this._changeButton);
 
-        this._chatEntry.connect('text-pasted', Lang.bind(this, this._onTextPasted));
-        this._chatEntry.connect('image-pasted', Lang.bind(this, this._onImagePasted));
-        this._chatEntry.connect('file-pasted', Lang.bind(this, this._onFilePasted));
+        this._chatEntry.connect('text-pasted', Lang.bind(this,
+            function(entry, text, nLines) {
+                this.pasteText(text, nLines);
+            }));
+        this._chatEntry.connect('image-pasted', Lang.bind(this,
+            function(entry, image) {
+                this.pasteImage(image);
+            }));
+        this._chatEntry.connect('file-pasted', Lang.bind(this,
+            function(entry, file) {
+                this.pasteFile(file);
+            }));
         this._chatEntry.connect('changed', Lang.bind(this, this._onEntryChanged));
 
         this._chatEntry.connect('activate', Lang.bind(this,
@@ -240,7 +249,7 @@ const EntryArea = new Lang.Class({
         }
     },
 
-    _onTextPasted: function(entry, text, nLines) {
+    pasteText: function(text, nLines) {
         this._confirmLabel.label =
             ngettext("Paste %s line of text to public paste service?",
                      "Paste %s lines of text to public paste service?",
@@ -252,13 +261,13 @@ const EntryArea = new Lang.Class({
         this._setPasteContent(text);
     },
 
-    _onImagePasted: function(entry, pixbuf) {
+    pasteImage: function(pixbuf) {
         this._confirmLabel.label = _("Upload image to public paste service?");
         this._uploadLabel.label = _("Uploading image to public paste service…");
         this._setPasteContent(pixbuf);
     },
 
-    _onFilePasted: function(entry, file) {
+    pasteFile: function(file) {
         file.query_info_async(Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
                               Gio.FileQueryInfoFlags.NONE,
                               GLib.PRIORITY_DEFAULT, null,


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