[polari/wip/fmuellner/paste-confirmation: 14/16] entryArea: Support pasting files



commit 656bf1954408c4295f564cf76d6cb4b959726835
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 12 05:30:45 2016 +0100

    entryArea: Support pasting files

 src/entryArea.js |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 5cc278c..fe51b79 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -255,6 +255,27 @@ const EntryArea = new Lang.Class({
         this._setPasteContent(pixbuf);
     },
 
+    pasteFile: function(file) {
+        file.query_info_async(Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+                              Gio.FileQueryInfoFlags.NONE,
+                              GLib.PRIORITY_DEFAULT, null,
+                              Lang.bind(this, this._onFileInfoReady));
+    },
+
+    _onFileInfoReady: function(file, res) {
+        let fileInfo = null;
+        try {
+            fileInfo = file.query_info_finish(res);
+        } catch(e) {
+            return;
+        }
+
+        let name = fileInfo.get_display_name();
+        this._confirmLabel.label = _("Upload “%s” to public paste service?").format(name);
+        this._uploadLabel.label = _("Uploading “%s” to public paste service …").format(name);
+        this._setPasteContent(file);
+    },
+
     _onPasteClicked: function() {
         let title;
         let nick = this._room.channel.connection.self_contact.alias;


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