mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
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:
parent
c72742486f
commit
49cca32ca5
12 changed files with 55 additions and 56 deletions
|
|
@ -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, {
|
||||
|
|
|
|||
|
|
@ -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: '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue