messageTray: Limit number of buttons in banners

The design states that notifications should have a maximum of three
buttons, so enforce this in the new banner actors.
This commit is contained in:
Florian Müllner 2015-02-17 03:53:00 +01:00
parent 53b3d2a6c2
commit 8ecf901dd4

View File

@ -30,6 +30,7 @@ const LONGER_HIDE_TIMEOUT = 0.6;
const MAX_NOTIFICATIONS_IN_QUEUE = 3;
const MAX_NOTIFICATIONS_PER_SOURCE = 3;
const MAX_NOTIFICATION_BUTTONS = 3;
// We delay hiding of the tray if the mouse is within MOUSE_LEFT_ACTOR_THRESHOLD
// range from the point where it left the tray.
@ -1170,6 +1171,9 @@ const NotificationBanner = new Lang.Class({
global.focus_manager.add_group(this._buttonBox);
}
if (this._buttonBox.get_n_children() >= MAX_NOTIFICATION_BUTTONS)
return null;
this._buttonBox.add(button);
button.connect('clicked', Lang.bind(this, function() {
callback();