[polari] appNotifications: Add 2nd notification queue for local command output
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] appNotifications: Add 2nd notification queue for local command output
- Date: Thu, 8 Aug 2013 13:07:06 +0000 (UTC)
commit 5ee83e9ac9c84c76cb83b1180ce8b6a3fd3dadc3
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Aug 8 08:15:12 2013 +0200
appNotifications: Add 2nd notification queue for local command output
We will add support at least for some IRC commands via command line
shortly. In case a command has some outputs, most IRC clients just
dump the local output to the main chat view. This is not a very
compelling solution, as it blurs the distinction between remotely
visible content and strictly local output. So instead, we will use
a dedicated area similar to in-app notifications.
data/resources/application.css | 9 +++++++++
src/appNotifications.js | 30 ++++++++++++++++++++++++++++++
src/application.js | 1 +
src/mainWindow.js | 1 +
4 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/data/resources/application.css b/data/resources/application.css
index 904b20b..3d2f755 100644
--- a/data/resources/application.css
+++ b/data/resources/application.css
@@ -44,3 +44,12 @@
.polari-chat-stack:backdrop {
background-color: @theme_unfocused_base_color;
}
+
+.irc-feedback {
+ background-color: @theme_bg_color;
+ border-style: solid;
+ border-color: @borders;
+ border-width: 1px 1px 0 1px;
+ border-radius: 6px 6px 0 0;
+ padding: 6px;
+}
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 775c186..ea8c30b 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -1,6 +1,10 @@
const Gtk = imports.gi.Gtk;
+const Pango = imports.gi.Pango;
const Lang = imports.lang;
+const Mainloop = imports.mainloop;
+
+const COMMAND_OUTPUT_REVEAL_TIME = 3;
const AppNotification = new Lang.Class({
Name: 'AppNotification',
@@ -24,6 +28,20 @@ const AppNotification = new Lang.Class({
}
});
+const CommandOutputNotification = new Lang.Class({
+ Name: 'CommandOutputNotification',
+ Extends: AppNotification,
+ Abstract: true,
+
+ _init: function() {
+ this.parent();
+
+ this.widget.transition_type = Gtk.RevealerTransitionType.SLIDE_UP;
+ Mainloop.timeout_add_seconds(COMMAND_OUTPUT_REVEAL_TIME,
+ Lang.bind(this, this.close));
+ }
+});
+
const NotificationQueue = new Lang.Class({
Name: 'NotificationQueue',
@@ -51,3 +69,15 @@ const NotificationQueue = new Lang.Class({
this.widget.hide();
}
});
+
+const CommandOutputQueue = new Lang.Class({
+ Name: 'CommandOutputQueue',
+ Extends: NotificationQueue,
+
+ _init: function() {
+ this.parent();
+
+ this.widget.valign = Gtk.Align.END;
+ this.widget.get_style_context().add_class('irc-feedback');
+ }
+});
diff --git a/src/application.js b/src/application.js
index 539778b..688561c 100644
--- a/src/application.js
+++ b/src/application.js
@@ -40,6 +40,7 @@ const Application = new Lang.Class({
this._accountManager = Tp.AccountManager.dup();
this.notificationQueue = new AppNotifications.NotificationQueue();
+ this.commandOutputQueue = new AppNotifications.CommandOutputQueue();
let builder = new Gtk.Builder();
builder.add_from_resource('/org/gnome/polari/app-menu.ui');
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 46cc489..c1ec257 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -28,6 +28,7 @@ const MainWindow = new Lang.Class({
let overlay = builder.get_object('overlay');
overlay.add_overlay(app.notificationQueue.widget);
+ overlay.add_overlay(app.commandOutputQueue.widget);
this._roomManager = new ChatroomManager.getDefault();
this._roomManager.connect('room-added',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]