[polari/wip/fmuellner/paste-confirmation: 4/16] pasteManager: Remove upload notifiation



commit 95414d658f5418fad0d52962ef5cb81d650386e3
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 11 21:03:11 2016 +0100

    pasteManager: Remove upload notifiation

 src/pasteManager.js |   56 ++++----------------------------------------------
 1 files changed, 5 insertions(+), 51 deletions(-)
---
diff --git a/src/pasteManager.js b/src/pasteManager.js
index 50ae365..39e1473 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -31,27 +31,9 @@ const PasteManager = new Lang.Class({
     },
 
     pasteText: function(text) {
-        let app = Gio.Application.get_default();
-        let n = new UploadNotification("text");
-        app.notificationQueue.addNotification(n);
-
-        this._pasteText(text, n);
-    },
-
-    pasteImage: function(data) {
-        let app = Gio.Application.get_default();
-        let n = new UploadNotification("image");
-        app.notificationQueue.addNotification(n);
-
-        this._pasteImage(data, n);
-    },
-
-    _pasteText: function(text, notification) {
         let room = this._roomManager.getActiveRoom();
-        if (!room) {
-            notification.close();
+        if (!room)
             return;
-        }
 
         let title;
         let nick = room.channel.connection.self_contact.alias;
@@ -63,10 +45,8 @@ const PasteManager = new Lang.Class({
 
         Utils.gpaste(text, title, Lang.bind(this,
             function(url) {
-                if (!url) {
-                    notification.close();
+                if (!url)
                     return;
-                }
 
                 let type = Tp.ChannelTextMessageType.NORMAL;
                 let message = Tp.ClientMessage.new_text(type, url);
@@ -77,17 +57,14 @@ const PasteManager = new Lang.Class({
                         } catch(e) {
                              logError(e, 'Failed to send message')
                         }
-                        notification.close();
                     }));
             }));
     },
 
-    _pasteImage: function(data, notification) {
+    pasteImage: function(data) {
         let room = this._roomManager.getActiveRoom();
-        if (!room) {
-            notification.close();
+        if (!room)
             return;
-        }
 
         let title;
         let nick = room.channel.connection.self_contact.alias;
@@ -99,10 +76,8 @@ const PasteManager = new Lang.Class({
 
         Utils.imgurPaste(data, title, Lang.bind(this,
             function(url) {
-                if (!url) {
-                    notification.close();
+                if (!url)
                     return;
-                }
 
                 let type = Tp.ChannelTextMessageType.NORMAL;
                 let message = Tp.ClientMessage.new_text(type, url);
@@ -113,7 +88,6 @@ const PasteManager = new Lang.Class({
                         } catch(e) {
                              logError(e, 'Failed to send message')
                         }
-                        notification.close();
                     }));
             }));
     }
@@ -259,23 +233,3 @@ const DropTargetIface = new Lang.Interface({
             }))
     }
 });
-
-const UploadNotification = new Lang.Class({
-    Name: 'UploadNotification',
-    Extends: AppNotifications.AppNotification,
-
-    _init: function(content) {
-        this.parent();
-
-        this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
-                                    column_spacing: 12 });
-
-        this._grid.add(new Gtk.Spinner({ active: true }));
-
-        let label = new Gtk.Label({ label: _("Uploading %s").format(content) });
-        this._grid.add(label);
-
-        this.add(this._grid);
-        this.show_all();
-    }
-});


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