From 3b0ca028ea015f4aa62f9e46d17ff53e158ae8ef Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Sun, 21 Aug 2022 19:47:02 -0700 Subject: batch-rename-dialog: Fix default sort order The list should be sorted by name-ascending, that state is set when the action is created. The sort is set when the action state is changed, and since the action state isn't changed after creation, the sort never happens. This leads to an inconsistent state where the list is not sorted, but the button label indicates that the list is sorted. Change the numbering-order state to name-ascending after the actions are created (even though that state is already set) in order to force list sorting. Also remove, the default label on the sort button in order to prevent this issue in the future (the label gets set anyways when the state is changed). --- src/nautilus-batch-rename-dialog.c | 5 +++++ src/resources/ui/nautilus-batch-rename-dialog.ui | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c index 5eeceedcf..df6a5f8c9 100644 --- a/src/nautilus-batch-rename-dialog.c +++ b/src/nautilus-batch-rename-dialog.c @@ -1576,6 +1576,11 @@ nautilus_batch_rename_dialog_initialize_actions (NautilusBatchRenameDialog *dial check_metadata_for_selection (dialog, dialog->selection, dialog->metadata_cancellable); + + /* Make sure that the state is initialized to name-ascending */ + action = g_action_map_lookup_action (G_ACTION_MAP (dialog->action_group), + "numbering-order-changed"); + g_action_change_state (action, g_variant_new_string ("name-ascending")); } static void diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui b/src/resources/ui/nautilus-batch-rename-dialog.ui index 0b4793400..01db45181 100644 --- a/src/resources/ui/nautilus-batch-rename-dialog.ui +++ b/src/resources/ui/nautilus-batch-rename-dialog.ui @@ -216,7 +216,6 @@ numbering_order_menu - Original Name (Ascending) True -- cgit v1.2.1