[polari/wip/fmuellner/drop-target: 3/6] entryArea: Make pasteText()/pasteImage() public



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

    entryArea: Make pasteText()/pasteImage() public
    
    Those are currently used to handle content pasted in the entry, but
    we will soon re-use them for dropped content as well.

 src/entryArea.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 3fc9810..8edb086 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -116,8 +116,14 @@ 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('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('changed', Lang.bind(this, this._onEntryChanged));
 
         this._chatEntry.connect('activate', Lang.bind(this,
@@ -231,7 +237,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?",
@@ -243,7 +249,7 @@ 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);


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