[polari/wip/fmuellner/paste-confirmation: 10/16] entryArea: Insert returned URL instead of sending it directly
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/paste-confirmation: 10/16] entryArea: Insert returned URL instead of sending it directly
- Date: Fri, 12 Feb 2016 13:00:24 +0000 (UTC)
commit e65a8a8bcee27699e71fb6d391b4c8a5e4d87b9f
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Feb 11 21:35:21 2016 +0100
entryArea: Insert returned URL instead of sending it directly
src/entryArea.js | 25 +++++++------------------
1 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 29c30f7..1b46285 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -1,5 +1,6 @@
const Gdk = imports.gi.Gdk;
const GdkPixbuf = imports.gi.GdkPixbuf;
+const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
@@ -222,7 +223,6 @@ const EntryArea = new Lang.Class({
this._pasteButton.grab_focus();
this.visible_child_name = 'paste-confirmation';
} else {
- this._chatEntry.text = '';
this._chatEntry.grab_focus_without_selecting();
this.visible_child_name = 'default';
}
@@ -251,24 +251,13 @@ const EntryArea = new Lang.Class({
title = _("Paste from %s").format(nick);
let app = Gio.Application.get_default();
- app.pasteManager.pasteContent(this._pasteContent, title, Lang.bind(this,
- function(url) {
- if (!url)
- return;
-
- let type = Tp.ChannelTextMessageType.NORMAL;
- let message = Tp.ClientMessage.new_text(type, url);
- this._room.channel.send_message_async(message, 0, Lang.bind(this,
- function(c, res) {
- try {
- c.send_message_finish(res);
- } catch(e) {
- logError(e, 'Failed to send message')
- }
- }));
+ app.pasteManager.pasteContent(this._pasteContent, title,
+ Lang.bind(this, function(url) {
+ // TODO: handle errors
+ this._setPasteContent(null);
+ if (url)
+ this._chatEntry.emit('insert-at-cursor', url);
}));
-
- this._setPasteContent(null);
},
_onCancelClicked: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]