From 398793d1a069055b3fa22c4737c9ed478f9b141f Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Sun, 22 Jan 2023 21:18:58 +0100 Subject: [PATCH] Refactor: Simplify box order save code in `PrefsBOLEmptyPlaceholder` Do this by simply using the `saveBoxOrderToSettings` method of `PrefsBoxOrderListBox`. --- .../PrefsBoxOrderListEmptyPlaceholder.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js b/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js index a95481d..c4aa14b 100644 --- a/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js +++ b/src/prefsModules/PrefsBoxOrderListEmptyPlaceholder.js @@ -26,18 +26,7 @@ var PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({ ownListBox.insert(value, 0); /// Finally save the box orders to settings. - settings.set_strv(ownListBox.boxOrder, [value.item]); - - 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); + ownListBox.saveBoxOrderToSettings(); + valueListBox.saveBoxOrderToSettings(); } });