cleanup: Use inheritance for Actor classes instead of composition
Remove the `this.actor = ...` and `this.actor._delegate = this` patterns in most of classes, by inheriting all the actor container classes. Uses interfaces when needed for making sure that multiple classes will implement some required methods or to avoid redefining the same code multiple times. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:

committed by
Florian Müllner

parent
f67b409fc1
commit
c4c5c4fd5c
@ -1,5 +1,5 @@
|
||||
/* exported MediaSection */
|
||||
const { Gio, Shell, St } = imports.gi;
|
||||
const { Gio, GObject, Shell, St } = imports.gi;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const Calendar = imports.ui.calendar;
|
||||
@ -19,9 +19,10 @@ const MprisPlayerProxy = Gio.DBusProxy.makeProxyWrapper(MprisPlayerIface);
|
||||
|
||||
const MPRIS_PLAYER_PREFIX = 'org.mpris.MediaPlayer2.';
|
||||
|
||||
var MediaMessage = class MediaMessage extends MessageList.Message {
|
||||
constructor(player) {
|
||||
super('', '');
|
||||
var MediaMessage = GObject.registerClass(
|
||||
class MediaMessage extends MessageList.Message {
|
||||
_init(player) {
|
||||
super._init('', '');
|
||||
|
||||
this._player = player;
|
||||
|
||||
@ -79,7 +80,7 @@ var MediaMessage = class MediaMessage extends MessageList.Message {
|
||||
this._updateNavButton(this._prevButton, this._player.canGoPrevious);
|
||||
this._updateNavButton(this._nextButton, this._player.canGoNext);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var MprisPlayer = class MprisPlayer {
|
||||
constructor(busName) {
|
||||
@ -194,9 +195,10 @@ var MprisPlayer = class MprisPlayer {
|
||||
};
|
||||
Signals.addSignalMethods(MprisPlayer.prototype);
|
||||
|
||||
var MediaSection = class MediaSection extends MessageList.MessageListSection {
|
||||
constructor() {
|
||||
super();
|
||||
var MediaSection = GObject.registerClass(
|
||||
class MediaSection extends MessageList.MessageListSection {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
this._players = new Map();
|
||||
|
||||
@ -247,4 +249,4 @@ var MediaSection = class MediaSection extends MessageList.MessageListSection {
|
||||
if (newOwner && !oldOwner)
|
||||
this._addPlayer(name);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user