[polari/wip/fmuellner/paste-confirmation: 6/16] pasteManager: Add generic pasteContent() method
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/paste-confirmation: 6/16] pasteManager: Add generic pasteContent() method
- Date: Fri, 12 Feb 2016 13:00:04 +0000 (UTC)
commit 9cd6391e400bf99fe72aad68deb60657d59f8e9a
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Feb 11 20:37:33 2016 +0100
pasteManager: Add generic pasteContent() method
src/pasteManager.js | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/pasteManager.js b/src/pasteManager.js
index 39e1473..2d1fe15 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -30,6 +30,19 @@ const PasteManager = new Lang.Class({
return;
},
+ pasteContent: function(content) {
+ if (typeof content == 'string') {
+ this.pasteText(content);
+ } else if (content instanceof GdkPixbuf.Pixbuf) {
+ let [success, buffer] = content.save_to_bufferv('png', [], []);
+ if (!success)
+ return;
+ this.pasteImage(buffer);
+ } else {
+ throw new Error('Unhandled content type');
+ }
+ },
+
pasteText: function(text) {
let room = this._roomManager.getActiveRoom();
if (!room)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]