iconGrid: Use class handlers for ::child-{added,removed}

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3014>
This commit is contained in:
Zander Brown 2023-11-09 15:44:00 +00:00
parent 0204920d8c
commit d013555392

View File

@ -1192,12 +1192,10 @@ export const IconGrid = GObject.registerClass({
this._currentPage = 0;
this._currentMode = -1;
this.connect('child-added', this._childAdded.bind(this));
this.connect('child-removed', this._childRemoved.bind(this));
this.connect('destroy', () => layoutManager.disconnect(pagesChangedId));
}
_childAdded(grid, child) {
vfunc_child_added(child) {
child._iconGridKeyFocusInId = child.connect('key-focus-in', () => {
this._ensureItemIsVisible(child);
});
@ -1247,7 +1245,7 @@ export const IconGrid = GObject.registerClass({
this._setGridMode(bestMode);
}
_childRemoved(grid, child) {
vfunc_child_removed(child) {
child.disconnect(child._iconGridKeyFocusInId);
delete child._iconGridKeyFocusInId;
}