[polari/wip/bastianilso/error-handling: 7/10] appnotifications now extends gtk.revealer
- From: Bastian Ilsø Hougaard <bastianilso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/bastianilso/error-handling: 7/10] appnotifications now extends gtk.revealer
- Date: Wed, 29 Jul 2015 22:26:50 +0000 (UTC)
commit 6c219bf80c4f9451d7c3e8783f155ffbc439151b
Author: Bastian Ilsø <bastianilso src gnome org>
Date: Tue Jul 28 19:19:54 2015 +0200
appnotifications now extends gtk.revealer
src/appNotifications.js | 46 ++++++++++++++++++++++------------------------
1 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/src/appNotifications.js b/src/appNotifications.js
index b047031..de37c1a 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -13,23 +13,24 @@ const TP_CURRENT_TIME = GLib.MAXUINT32;
const AppNotification = new Lang.Class({
Name: 'AppNotification',
Abstract: true,
+ Extends: Gtk.Revealer,
_init: function() {
- this.widget = new Gtk.Revealer({ reveal_child: false });
- this.widget.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN;
+ this.parent();
+ this.reveal_child = false;
+ this.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN;
},
close: function() {
- this.widget.reveal_child = false;
- this.widget.destroy();
- this.widget = null;
+ this.reveal_child = false;
+ this.destroy();
},
open: function() {
- this.widget.reveal_child = true;
+ this.show_all();
+ this.reveal_child = true;
},
-
get statusReason() {
return this._statusReason;
},
@@ -43,7 +44,7 @@ const CommandOutputNotification = new Lang.Class({
_init: function() {
this.parent();
- this.widget.transition_type = Gtk.RevealerTransitionType.SLIDE_UP;
+ this.transition_type = Gtk.RevealerTransitionType.SLIDE_UP;
Mainloop.timeout_add_seconds(COMMAND_OUTPUT_REVEAL_TIME,
Lang.bind(this, this.close));
}
@@ -59,8 +60,8 @@ const SimpleOutput = new Lang.Class({
let label = new Gtk.Label({ label: text,
vexpand: true,
visible: true });
- this.widget.add(label);
- this.widget.show_all();
+ this.add(label);
+ this.show_all();
}
});
@@ -91,8 +92,8 @@ const GridOutput = new Lang.Class({
}
row++;
}
- this.widget.add(grid);
- this.widget.show_all();
+ this.add(grid);
+ this.show_all();
}
});
@@ -115,8 +116,7 @@ const ErrorNotification = new Lang.Class({
this._populateNotification(requestData.error);
this._grid.add(this._label);
this._grid.add(this._button);
- this.widget.add(this._grid);
- this.widget.show_all();
+ this.add(this._grid);
this._statusReason = requestData.error;
},
@@ -191,11 +191,11 @@ const ErrorNotification = new Lang.Class({
return;
this._reconnectAccountAction();
- this.close();
}));
},
_reconnectAccountAction: function() {
+ log('reconnecting account..');
// Not sure we actually need this..
let action = this._app.lookup_action('reconnect-account');
let accountPath = GLib.Variant.new('o', this._account.get_object_path());
@@ -251,14 +251,14 @@ const NotificationQueue = new Lang.Class({
this.widget.get_style_context().add_class('app-notification');
this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
- row_spacing: 6, visible: true });
+ row_spacing: 6 });
this.widget.add(this._grid);
this._notifications = {};
this._activeNotifications = {};
let initParams = {};
this._activeNotifications['room'] = initParams;
this._activeNotifications['account'] = initParams;
- this._updateVisibility();
+ //this._updateVisibility();
},
setNotification: function(params) {
@@ -309,16 +309,14 @@ const NotificationQueue = new Lang.Class({
//log('_displayNotification: true. removing visible notification');
//this._activeNotifications[params.type].notification.close();
//log('grid children: ' + this._grid.get_children().length);
- if (this._activeNotifications[params.type].notification.widget) {
//log('removing ' + this._activeNotifications[params.type].notification);
// If the next notification is null and we're still displaying for the same room.
// Then we should just make the active notification null.
if (!params.notification && params.identifier ==
this._activeNotifications[params.type].identifier) {
this._activeNotifications[params.type].notification.close();
} else {
- this._grid.remove(this._activeNotifications[params.type].notification.widget);
+ this._grid.remove(this._activeNotifications[params.type].notification);
}
- }
}
//log('storing parameters inside this._activeNotifications[' + params.type + ']..');
this._activeNotifications[params.type] = params;
@@ -329,9 +327,9 @@ const NotificationQueue = new Lang.Class({
return;
}
- this._grid.add(params.notification.widget);
+ this._grid.add(params.notification);
params.notification.open();
- params.notification.widget.connect('destroy',
+ params.notification.connect('destroy',
Lang.bind(this, this._updateVisibility));
this.widget.show();
},
@@ -363,9 +361,9 @@ const CommandOutputQueue = new Lang.Class({
},
addNotification: function(notification) {
- this._grid.add(notification.widget);
+ this._grid.add(notification);
- notification.widget.connect('destroy',
+ notification.connect('destroy',
Lang.bind(this, this._onChildDestroy));
this.widget.show();
notification.open();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]