From a4c9d30e22d827310c71fa30f7aee02f49f90e09 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sun, 20 Nov 2022 21:40:14 -0500 Subject: [PATCH] Use alphanumeric sorting for animation icon packs Otherwise it will missort numbers like "11" and "1" --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/pack.rs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8c54466..e6de683 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "alphanumeric-sort" +version = "1.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e9c9abb82613923ec78d7a461595d52491ba7240f3c64c0bbe0e6d98e0fce0" + [[package]] name = "anyhow" version = "1.0.66" @@ -535,6 +541,7 @@ dependencies = [ name = "parrotd" version = "0.1.0" dependencies = [ + "alphanumeric-sort", "glib", "gtk", "libappindicator", diff --git a/Cargo.toml b/Cargo.toml index 780e668..11f771c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,4 @@ libappindicator = "0.7" gtk = "0.15" glib = "0.15" sysinfo = "0.26" +alphanumeric-sort = "1.4" diff --git a/src/pack.rs b/src/pack.rs index 1d5caa6..7875859 100644 --- a/src/pack.rs +++ b/src/pack.rs @@ -69,7 +69,7 @@ impl IconPack { icons.push(name.split_at(name.len() - ".png".len()).0.to_string()); } - icons.sort(); // Alphanumerical ordering + alphanumeric_sort::sort_str_slice(&mut icons); // Alphanumerical ordering let num_icons = icons.len();