[polari] entryArea: Insert paste URL instead of sending it directly
- From: Florian MĂźllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] entryArea: Insert paste URL instead of sending it directly
- Date: Thu, 18 Feb 2016 00:16:52 +0000 (UTC)
commit 4a920bdae502f602cc6c54d6c8d2cf2d507303de
Author: Florian MĂźllner <fmuellner gnome org>
Date: Thu Feb 11 21:35:21 2016 +0100
entryArea: Insert paste URL instead of sending it directly
It usually makes sense to provide some context when sending a paste
URL, so allow that by inserting the returned paste URL into the
entry instead of sending it directly. Pasting content as URL is
now a two-step operation - confirming the upload and sending the
message - but hopefully that'll just be minor annoyance compared
to the usefulness of the feature.
https://bugzilla.gnome.org/show_bug.cgi?id=760315
src/entryArea.js | 21 +++++----------------
1 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 138a22f..43a89f0 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;
@@ -224,7 +225,6 @@ const EntryArea = new Lang.Class({
this._pasteButton.grab_focus();
} else {
this.visible_child_name = 'default';
- this._chatEntry.text = '';
this._chatEntry.grab_focus_without_selecting();
}
},
@@ -255,27 +255,16 @@ const EntryArea = new Lang.Class({
try {
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')
- }
- }));
+ // TODO: handle errors
+ this._setPasteContent(null);
+ if (url)
+ this._chatEntry.emit('insert-at-cursor', url);
}));
} catch(e) {
let type = typeof this._pasteContent;
Utils.debug('Failed to paste content of type ' +
(type == 'object' ? this._pasteContent.toString() : type));
}
-
- this._setPasteContent(null);
},
_onCancelClicked: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]