[nautilus/wip/corey/batch-rename: 2/2] batch-rename-dialog: Fix default sort order




commit c9cdcdcacdcec9f7e9e3cae3c220e679b71031b7
Author: Corey Berla <corey berla me>
Date:   Sun Aug 21 19:47:02 2022 -0700

    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 @@
                                 <child>
                                   <object class="GtkMenuButton" id="numbering_order_button">
                                     <property name="menu-model">numbering_order_menu</property>
-                                    <property name="label" translatable="yes">Original Name 
(Ascending)</property>
                                     <property name="always-show-arrow">True</property>
                                   </object>
                                 </child>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]