calendar: Add Media section

We lost media controls outside of notification banners when
implementing the new notification designs. Reimplement this
functionality as a dedicated "Media" section in the message
list based on MPRIS.

https://bugzilla.gnome.org/show_bug.cgi?id=756491
This commit is contained in:
Florian Müllner
2016-02-15 12:13:22 +01:00
parent ee8fd1e613
commit 3ecdfaffd2
8 changed files with 318 additions and 2 deletions

View File

@ -324,6 +324,9 @@ const Message = new Lang.Class({
vertical: true, x_expand: true });
hbox.add_actor(contentBox);
this._mediaControls = new St.BoxLayout();
hbox.add_actor(this._mediaControls);
let titleBox = new St.BoxLayout();
contentBox.add_actor(titleBox);
@ -405,6 +408,15 @@ const Message = new Lang.Class({
this._actionBin.visible = this.expanded;
},
addMediaControl: function(iconName, callback) {
let icon = new St.Icon({ icon_name: iconName, icon_size: 16 });
let button = new St.Button({ style_class: 'message-media-control',
child: icon });
button.connect('clicked', callback);
this._mediaControls.add_actor(button);
return button;
},
setExpandedBody: function(actor) {
if (actor == null) {
if (this._bodyStack.get_n_children() > 1)
@ -476,7 +488,7 @@ const Message = new Lang.Class({
},
canClose: function() {
return true;
return this._mediaControls.get_n_children() == 0;
},
_sync: function() {