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
@ -77,13 +77,13 @@ class KeyringDialog extends ModalDialog.ModalDialog {
|
||||
this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, true);
|
||||
|
||||
if (rtl) {
|
||||
layout.attach(this._workSpinner.actor, 0, row, 1, 1);
|
||||
layout.attach(this._workSpinner, 0, row, 1, 1);
|
||||
layout.attach(this._passwordEntry, 1, row, 1, 1);
|
||||
layout.attach(label, 2, row, 1, 1);
|
||||
} else {
|
||||
layout.attach(label, 0, row, 1, 1);
|
||||
layout.attach(this._passwordEntry, 1, row, 1, 1);
|
||||
layout.attach(this._workSpinner.actor, 2, row, 1, 1);
|
||||
layout.attach(this._workSpinner, 2, row, 1, 1);
|
||||
}
|
||||
row++;
|
||||
} else {
|
||||
@ -121,8 +121,8 @@ class KeyringDialog extends ModalDialog.ModalDialog {
|
||||
if (this.prompt.choice_visible) {
|
||||
let choice = new CheckBox.CheckBox();
|
||||
this.prompt.bind_property('choice-label', choice.getLabelActor(), 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||
this.prompt.bind_property('choice-chosen', choice.actor, 'checked', GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
|
||||
layout.attach(choice.actor, rtl ? 0 : 1, row, 1, 1);
|
||||
this.prompt.bind_property('choice-chosen', choice, 'checked', GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
|
||||
layout.attach(choice, rtl ? 0 : 1, row, 1, 1);
|
||||
row++;
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ var AuthenticationDialog = GObject.registerClass({
|
||||
this._userAvatar = new UserWidget.Avatar(this._user,
|
||||
{ iconSize: DIALOG_ICON_SIZE,
|
||||
styleClass: 'polkit-dialog-user-icon' });
|
||||
this._userAvatar.actor.hide();
|
||||
userBox.add(this._userAvatar.actor,
|
||||
this._userAvatar.hide();
|
||||
userBox.add(this._userAvatar,
|
||||
{ x_fill: true,
|
||||
y_fill: false,
|
||||
x_align: St.Align.END,
|
||||
@ -106,7 +106,7 @@ var AuthenticationDialog = GObject.registerClass({
|
||||
{ expand: true });
|
||||
|
||||
this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, true);
|
||||
this._passwordBox.add(this._workSpinner.actor);
|
||||
this._passwordBox.add(this._workSpinner);
|
||||
|
||||
this.setInitialKeyFocus(this._passwordEntry);
|
||||
this._passwordBox.hide();
|
||||
@ -305,7 +305,7 @@ var AuthenticationDialog = GObject.registerClass({
|
||||
_onUserChanged() {
|
||||
if (this._user.is_loaded && this._userAvatar) {
|
||||
this._userAvatar.update();
|
||||
this._userAvatar.actor.show();
|
||||
this._userAvatar.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ class ChatSource extends MessageTray.Source {
|
||||
|
||||
// We ack messages when the user expands the new notification
|
||||
let id = this._banner.connect('expanded', this._ackMessages.bind(this));
|
||||
this._banner.actor.connect('destroy', () => {
|
||||
this._banner.connect('destroy', () => {
|
||||
this._banner.disconnect(id);
|
||||
this._banner = null;
|
||||
});
|
||||
@ -799,9 +799,10 @@ class ChatLineBox extends St.BoxLayout {
|
||||
}
|
||||
});
|
||||
|
||||
var ChatNotificationBanner = class extends MessageTray.NotificationBanner {
|
||||
constructor(notification) {
|
||||
super(notification);
|
||||
var ChatNotificationBanner = GObject.registerClass(
|
||||
class ChatNotificationBanner extends MessageTray.NotificationBanner {
|
||||
_init(notification) {
|
||||
super._init(notification);
|
||||
|
||||
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
||||
x_expand: true,
|
||||
@ -886,8 +887,7 @@ var ChatNotificationBanner = class extends MessageTray.NotificationBanner {
|
||||
}
|
||||
|
||||
_addMessage(message) {
|
||||
let highlighter = new MessageList.URLHighlighter(message.body, true, true);
|
||||
let body = highlighter.actor;
|
||||
let body = new MessageList.URLHighlighter(message.body, true, true);
|
||||
|
||||
let styles = message.styles;
|
||||
for (let i = 0; i < styles.length; i++)
|
||||
@ -975,6 +975,6 @@ var ChatNotificationBanner = class extends MessageTray.NotificationBanner {
|
||||
this.notification.source.setChatState(Tp.ChannelChatState.ACTIVE);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var Component = TelepathyComponent;
|
||||
|
Reference in New Issue
Block a user