js: Cleanup usage of StScrollView

Whilst you *can* use add_actor() with ScrollView, it's more idiomatic to
work on :child

Cleanup a few extras along the way

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3010>
This commit is contained in:
Zander Brown
2023-11-07 10:47:14 +00:00
committed by Marge Bot
parent c72742486f
commit 49cca32ca5
12 changed files with 55 additions and 56 deletions

View File

@ -168,10 +168,8 @@ const UserList = GObject.registerClass({
style_class: 'login-dialog-user-list-view',
x_expand: true,
y_expand: true,
hscrollbar_policy: St.PolicyType.NEVER,
});
this.set_policy(
St.PolicyType.NEVER,
St.PolicyType.AUTOMATIC);
this._box = new St.BoxLayout({
vertical: true,
@ -179,7 +177,7 @@ const UserList = GObject.registerClass({
pseudo_class: 'expanded',
});
this.add_child(this._box);
this.child = this._box;
this._items = {};
}
@ -226,7 +224,7 @@ const UserList = GObject.registerClass({
scrollToItem(item) {
let box = item.get_allocation_box();
let adjustment = this.get_vscroll_bar().get_adjustment();
const {adjustment} = this.vscroll;
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
adjustment.ease(value, {
@ -238,7 +236,7 @@ const UserList = GObject.registerClass({
jumpToItem(item) {
let box = item.get_allocation_box();
let adjustment = this.get_vscroll_bar().get_adjustment();
const {adjustment} = this.vscroll;
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
@ -487,17 +485,16 @@ export const LoginDialog = GObject.registerClass({
this._userSelectionBox.add_child(this._notListedButton);
const bannerBox = new St.BoxLayout({vertical: true});
this._bannerView = new St.ScrollView({
style_class: 'login-dialog-banner-view',
opacity: 0,
vscrollbar_policy: St.PolicyType.AUTOMATIC,
hscrollbar_policy: St.PolicyType.NEVER,
child: bannerBox,
});
this.add_child(this._bannerView);
let bannerBox = new St.BoxLayout({vertical: true});
this._bannerView.add_child(bannerBox);
this._bannerLabel = new St.Label({
style_class: 'login-dialog-banner',
text: '',