Refactor: Simplify box order save code in PrefsBOLEmptyPlaceholder

Do this by simply using the `saveBoxOrderToSettings` method of
`PrefsBoxOrderListBox`.
This commit is contained in:
June 2023-01-22 21:18:58 +01:00
commit 398793d1a0
No known key found for this signature in database
GPG key ID: 094C2AC34192FA11

View file

@ -26,18 +26,7 @@ var PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({
ownListBox.insert(value, 0); ownListBox.insert(value, 0);
/// Finally save the box orders to settings. /// Finally save the box orders to settings.
settings.set_strv(ownListBox.boxOrder, [value.item]); ownListBox.saveBoxOrderToSettings();
valueListBox.saveBoxOrderToSettings();
let updatedBoxOrder = [ ];
for (let potentialListBoxRow of valueListBox) {
// Only process PrefsBoxOrderItemRows.
if (potentialListBoxRow.constructor.$gtype.name !== "PrefsBoxOrderItemRow") {
continue;
}
const item = potentialListBoxRow.item;
updatedBoxOrder.push(item);
}
settings.set_strv(valueListBox.boxOrder, updatedBoxOrder);
} }
}); });