Refactor: Don't add ScrollManag. inst. to this, since thats not needed

This commit is contained in:
Julian 2023-01-28 22:46:10 +01:00
parent 4ba00915e0
commit 0401790fed
Signed by: julian
GPG Key ID: 094C2AC34192FA11

View File

@ -34,7 +34,7 @@ var PrefsPage = GObject.registerClass({
// Pass `this.get_first_child()` to the ScrollManager, since this // Pass `this.get_first_child()` to the ScrollManager, since this
// `PrefsPage` extends an `Adw.PreferencesPage` and the first child of // `PrefsPage` extends an `Adw.PreferencesPage` and the first child of
// an `Adw.PreferencesPage` is the built-in `Gtk.ScrolledWindow`. // an `Adw.PreferencesPage` is the built-in `Gtk.ScrolledWindow`.
this._scrollManager = new ScrollManager.ScrollManager(this.get_first_child()); const scrollManager = new ScrollManager.ScrollManager(this.get_first_child());
/// Setup GtkDropControllerMotion event controller and make use of its /// Setup GtkDropControllerMotion event controller and make use of its
/// events. /// events.
@ -44,18 +44,18 @@ var PrefsPage = GObject.registerClass({
controller.connect("motion", (_, _x, y) => { controller.connect("motion", (_, _x, y) => {
// If the pointer is currently in the upper ten percent of this // If the pointer is currently in the upper ten percent of this
// widget, then scroll up. // widget, then scroll up.
if (y <= this.get_allocated_height() * 0.1) this._scrollManager.startScrollUp(); if (y <= this.get_allocated_height() * 0.1) scrollManager.startScrollUp();
// If the pointer is currently in the lower ten percent of this // If the pointer is currently in the lower ten percent of this
// widget, then scroll down. // widget, then scroll down.
else if (y >= this.get_allocated_height() * 0.9) this._scrollManager.startScrollDown(); else if (y >= this.get_allocated_height() * 0.9) scrollManager.startScrollDown();
// Otherwise stop scrolling. // Otherwise stop scrolling.
else this._scrollManager.stopScrollAll(); else scrollManager.stopScrollAll();
}); });
// Make sure scrolling stops, when DND operation ends. // Make sure scrolling stops, when DND operation ends.
this._dndEnded = true; this._dndEnded = true;
const stopScrollAllAtDNDEnd = () => { const stopScrollAllAtDNDEnd = () => {
this._scrollManager.stopScrollAll(); scrollManager.stopScrollAll();
this._dndEnded = true; this._dndEnded = true;
}; };
controller.connect("leave", () => { controller.connect("leave", () => {