js: Stop using {v,h}scroll properties

We only use them to access the corresponding adjustments, and
ScrollView now exposes those directly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
This commit is contained in:
Florian Müllner 2023-11-15 14:31:37 +01:00 committed by Marge Bot
parent a63d5b6b09
commit 998d703bc2
8 changed files with 16 additions and 17 deletions

View File

@ -128,7 +128,7 @@ export const AuthList = GObject.registerClass({
scrollToItem(item) {
let box = item.get_allocation_box();
const {adjustment} = this._scrollView.vscroll;
const adjustment = this._scrollView.vadjustment;
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
adjustment.ease(value, {

View File

@ -224,7 +224,7 @@ const UserList = GObject.registerClass({
scrollToItem(item) {
let box = item.get_allocation_box();
const {adjustment} = this.vscroll;
const adjustment = this.vadjustment;
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
adjustment.ease(value, {
@ -236,7 +236,7 @@ const UserList = GObject.registerClass({
jumpToItem(item) {
let box = item.get_allocation_box();
const {adjustment} = this.vscroll;
const adjustment = this.vadjustment;
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);

View File

@ -32,7 +32,7 @@ export function adjustAnimationTime(msecs) {
* @param {Clutter.Actor} actor - the actor
*/
export function ensureActorVisibleInScrollView(scrollView, actor) {
const {adjustment} = scrollView.vscroll;
const adjustment = scrollView.vadjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
let offset = 0;

View File

@ -529,8 +529,7 @@ var BaseAppView = GObject.registerClass({
this._scrollTimeoutId = 0;
this._scrollView.connect('scroll-event', this._onScroll.bind(this));
const scroll = this._scrollView.hscroll;
this._adjustment = scroll.adjustment;
this._adjustment = this._scrollView.hadjustment;
this._adjustment.connect('notify::value', adj => {
const value = adj.value / adj.page_size;
this._pageIndicators.setCurrentPosition(value);
@ -2375,7 +2374,7 @@ export const FolderIcon = GObject.registerClass({
open() {
this._ensureFolderDialog();
this.view._scrollView.vscroll.adjustment.value = 0;
this.view._scrollView.vadjustment.value = 0;
this._dialog.popup();
}

View File

@ -890,8 +890,8 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
// Keep track of the bottom position for the current adjustment and
// force a scroll to the bottom if things change while we were at the
// bottom
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
this._oldMaxScrollValue = this._scrollArea.vadjustment.value;
this._scrollArea.vadjustment.connect('changed', adjustment => {
if (adjustment.value === this._oldMaxScrollValue)
this.scrollTo(St.Side.BOTTOM);
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
@ -917,7 +917,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
}
scrollTo(side) {
let adjustment = this._scrollArea.vscroll.adjustment;
let adjustment = this._scrollArea.vadjustment;
if (side === St.Side.TOP)
adjustment.value = adjustment.lower;
else if (side === St.Side.BOTTOM)

View File

@ -179,7 +179,7 @@ const Notebook = GObject.registerClass({
scrollview.hide();
this.add_child(scrollview);
let vAdjust = scrollview.vscroll.adjustment;
const vAdjust = scrollview.vadjustment;
vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData));
vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData));
@ -238,7 +238,7 @@ const Notebook = GObject.registerClass({
}
_onAdjustValueChanged(tabData) {
let vAdjust = tabData.scrollView.vscroll.adjustment;
const vAdjust = tabData.scrollView.vadjustment;
if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5))
tabData._scrolltoBottom = false;
}
@ -246,7 +246,7 @@ const Notebook = GObject.registerClass({
_onAdjustScopeChanged(tabData) {
if (!tabData._scrollToBottom)
return;
let vAdjust = tabData.scrollView.vscroll.adjustment;
const vAdjust = tabData.scrollView.vadjustment;
vAdjust.value = vAdjust.upper - vAdjust.page_size;
}

View File

@ -751,7 +751,7 @@ export const SearchResultsView = GObject.registerClass({
_onPan(action) {
let [dist_, dx_, dy] = action.get_motion_delta(0);
let adjustment = this._scrollView.vscroll.adjustment;
let adjustment = this._scrollView.vadjustment;
adjustment.value -= (dy / this.height) * adjustment.page_size;
return false;
}

View File

@ -501,7 +501,7 @@ export const SwitcherList = GObject.registerClass({
this._highlighted = index;
let adjustment = this._scrollView.hscroll.adjustment;
const adjustment = this._scrollView.hadjustment;
let [value] = adjustment.get_values();
let [absItemX] = this._items[index].get_transformed_position();
let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0);
@ -513,7 +513,7 @@ export const SwitcherList = GObject.registerClass({
}
_scrollToLeft(index) {
let adjustment = this._scrollView.hscroll.adjustment;
const adjustment = this._scrollView.hadjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
let item = this._items[index];
@ -536,7 +536,7 @@ export const SwitcherList = GObject.registerClass({
}
_scrollToRight(index) {
let adjustment = this._scrollView.hscroll.adjustment;
const adjustment = this._scrollView.hadjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
let item = this._items[index];