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

@ -84,20 +84,19 @@ export const AuthList = GObject.registerClass({
this.label = new St.Label({style_class: 'login-dialog-auth-list-title'});
this.add_child(this.label);
this._scrollView = new St.ScrollView({
style_class: 'login-dialog-auth-list-view',
});
this._scrollView.set_policy(
St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
this.add_child(this._scrollView);
this._box = new St.BoxLayout({
vertical: true,
style_class: 'login-dialog-auth-list',
pseudo_class: 'expanded',
});
this._scrollView.add_child(this._box);
this._scrollView = new St.ScrollView({
style_class: 'login-dialog-auth-list-view',
hscrollbar_policy: St.PolicyType.NEVER,
child: this._box,
});
this.add_child(this._scrollView);
this._items = new Map();
this.connect('key-focus-in', this._moveFocusToItems.bind(this));
@ -129,7 +128,7 @@ export const AuthList = GObject.registerClass({
scrollToItem(item) {
let box = item.get_allocation_box();
let adjustment = this._scrollView.get_vscroll_bar().get_adjustment();
const {adjustment} = this._scrollView.vscroll;
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
adjustment.ease(value, {