screenShield: Replace child properties

It turns out https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/780
helped with some redrawing issues on the screen shield, so cherry-pick the
relevant bits to the stable branch.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1836
This commit is contained in:
Florian Müllner 2019-10-21 20:44:00 +02:00 committed by Florian Müllner
parent cf249ab870
commit 9b0d42309b

View File

@ -53,11 +53,17 @@ var Clock = class {
this.actor = new St.BoxLayout({ style_class: 'screen-shield-clock', this.actor = new St.BoxLayout({ style_class: 'screen-shield-clock',
vertical: true }); vertical: true });
this._time = new St.Label({ style_class: 'screen-shield-clock-time' }); this._time = new St.Label({
this._date = new St.Label({ style_class: 'screen-shield-clock-date' }); style_class: 'screen-shield-clock-time',
x_align: Clutter.ActorAlign.CENTER,
});
this._date = new St.Label({
style_class: 'screen-shield-clock-date',
x_align: Clutter.ActorAlign.CENTER,
});
this.actor.add(this._time, { x_align: St.Align.MIDDLE }); this.actor.add_child(this._time);
this.actor.add(this._date, { x_align: St.Align.MIDDLE }); this.actor.add_child(this._date);
this._wallClock = new GnomeDesktop.WallClock({ time_only: true }); this._wallClock = new GnomeDesktop.WallClock({ time_only: true });
this._wallClock.connect('notify::clock', this._updateClock.bind(this)); this._wallClock.connect('notify::clock', this._updateClock.bind(this));
@ -93,7 +99,7 @@ var NotificationsBox = class {
style_class: 'screen-shield-notifications-container' }); style_class: 'screen-shield-notifications-container' });
this._scrollView.add_actor(this._notificationBox); this._scrollView.add_actor(this._notificationBox);
this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START }); this.actor.add_child(this._scrollView);
this._sources = new Map(); this._sources = new Map();
Main.messageTray.getSources().forEach(source => { Main.messageTray.getSources().forEach(source => {
@ -134,10 +140,10 @@ var NotificationsBox = class {
_makeNotificationSource(source, box) { _makeNotificationSource(source, box) {
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE); let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
box.add(sourceActor, { y_fill: true }); box.add_child(sourceActor);
let textBox = new St.BoxLayout({ vertical: true }); let textBox = new St.BoxLayout({ vertical: true });
box.add(textBox, { y_fill: false, y_align: St.Align.START }); box.add_child(textBox);
let title = new St.Label({ text: source.title, let title = new St.Label({ text: source.title,
style_class: 'screen-shield-notification-label' }); style_class: 'screen-shield-notification-label' });
@ -160,7 +166,7 @@ var NotificationsBox = class {
box.add(sourceBin); box.add(sourceBin);
let textBox = new St.BoxLayout({ vertical: true }); let textBox = new St.BoxLayout({ vertical: true });
box.add(textBox, { y_fill: false, y_align: St.Align.START }); box.add_child(textBox);
let title = new St.Label({ text: source.title, let title = new St.Label({ text: source.title,
style_class: 'screen-shield-notification-label' }); style_class: 'screen-shield-notification-label' });
@ -222,7 +228,7 @@ var NotificationsBox = class {
obj.sourceBox = new St.BoxLayout({ style_class: 'screen-shield-notification-source', obj.sourceBox = new St.BoxLayout({ style_class: 'screen-shield-notification-source',
x_expand: true }); x_expand: true });
this._showSource(source, obj, obj.sourceBox); this._showSource(source, obj, obj.sourceBox);
this._notificationBox.add(obj.sourceBox, { x_fill: false, x_align: St.Align.START }); this._notificationBox.add_child(obj.sourceBox);
obj.sourceCountChangedId = source.connect('count-updated', source => { obj.sourceCountChangedId = source.connect('count-updated', source => {
this._countChanged(source, obj); this._countChanged(source, obj);
@ -1133,16 +1139,13 @@ var ScreenShield = class {
vertical: true, vertical: true,
style_class: 'screen-shield-contents-box' }); style_class: 'screen-shield-contents-box' });
this._clock = new Clock(); this._clock = new Clock();
this._lockScreenContentsBox.add(this._clock.actor, { x_fill: true, this._lockScreenContentsBox.add_child(this._clock.actor);
y_fill: true });
this._lockScreenContents.add_actor(this._lockScreenContentsBox); this._lockScreenContents.add_actor(this._lockScreenContentsBox);
this._notificationsBox = new NotificationsBox(); this._notificationsBox = new NotificationsBox();
this._wakeUpScreenId = this._notificationsBox.connect('wake-up-screen', this._wakeUpScreen.bind(this)); this._wakeUpScreenId = this._notificationsBox.connect('wake-up-screen', this._wakeUpScreen.bind(this));
this._lockScreenContentsBox.add(this._notificationsBox.actor, { x_fill: true, this._lockScreenContentsBox.add_child(this._notificationsBox.actor);
y_fill: true,
expand: true });
this._hasLockScreen = true; this._hasLockScreen = true;
} }