[polari/wip/kunaljain/image-paste-service: 2/2] Handle paste service errors
- From: Kunal Jain <kunaljain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/kunaljain/image-paste-service: 2/2] Handle paste service errors
- Date: Sat, 9 Jan 2016 05:06:51 +0000 (UTC)
commit 91bce225ddc5a69189c3fe01bb502f58c7b8cec3
Author: Kunaal Jain <kunaalus gmail com>
Date: Sat Jan 9 10:36:10 2016 +0530
Handle paste service errors
src/pasteManager.js | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/src/pasteManager.js b/src/pasteManager.js
index 9f8e1a8..ca8d242 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -10,6 +10,9 @@ const AppNotifications = imports.appNotifications;
const ChatroomManager = imports.chatroomManager;
const Lang = imports.lang;
const Utils = imports.utils;
+const Mainloop = imports.mainloop;
+
+const ERROR_NOTIFICATION_REVEAL_TIME = 5;
const DndTargetType = {
URI_LIST: 1,
@@ -107,7 +110,7 @@ const PasteManager = new Lang.Class({
Utils.gpaste(data, datatype, title, Lang.bind(this,
function(url) {
if (!url) {
- notification.close();
+ notification._showErrorNotification();
return;
}
@@ -303,15 +306,37 @@ const UploadNotification = new Lang.Class({
_init: function(content) {
this.parent();
- this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
+ this._stack = new Gtk.Stack();
+ let grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
column_spacing: 12 });
- this._grid.add(new Gtk.Spinner({ active: true }));
+ grid.add(new Gtk.Spinner({ active: true }));
let label = new Gtk.Label({ label: _("Uploading %s").format(content) });
- this._grid.add(label);
+ grid.add(label);
+
+ this._stack.add_named(grid,"uploading");
+
+ grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
+ column_spacing: 12 });
+
+ grid.add(new Gtk.Image({ icon_name: 'dialog-error-symbolic',
+ icon_size: Gtk.IconSize.MENU,
+ valign: Gtk.Align.BASELINE }));
- this.widget.add(this._grid);
+ label = new Gtk.Label({ label: _("Error in uploading %s").format(content) });
+ grid.add(label);
+
+ this._stack.add_named(grid,"error-in-uploading");
+ this._stack.set_visible_child_name("uploading");
+
+ this.widget.add(this._stack);
this.widget.show_all();
+ },
+
+ _showErrorNotification: function() {
+ Mainloop.timeout_add_seconds(ERROR_NOTIFICATION_REVEAL_TIME,
+ Lang.bind(this, this.close));
+ this._stack.set_visible_child_name("error-in-uploading");
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]