Refactor: Simplify box order save code in PrefsBOLEmptyPlaceholder

Do this by simply using the `saveBoxOrderToSettings` method of
`PrefsBoxOrderListBox`.
This commit is contained in:
Julian 2023-01-22 21:18:58 +01:00
parent f7309e7f65
commit 398793d1a0
Signed by: julian
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);
} }
}); });