ui: Use natural order for sorting ports

This commit is contained in:
Florian Olk 2024-08-24 16:31:32 +02:00 committed by Link Mauve
parent 092febcb89
commit b9d767f82e
3 changed files with 10 additions and 2 deletions

7
Cargo.lock generated
View file

@ -564,6 +564,7 @@ dependencies = [
"libadwaita",
"libc",
"log",
"natord",
"once_cell",
"pipewire",
]
@ -702,6 +703,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "natord"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c"
[[package]]
name = "nix"
version = "0.27.1"

View file

@ -24,3 +24,4 @@ log = "0.4.11"
once_cell = "1.19"
libc = "0.2"
natord = "1.0.9"

View file

@ -129,8 +129,8 @@ mod imp {
_ => unreachable!(),
});
ports_out.sort_unstable_by_key(|port| port.name());
ports_in.sort_unstable_by_key(|port| port.name());
ports_out.sort_unstable_by(|&a, &b| natord::compare(&a.name(), &b.name()));
ports_in.sort_unstable_by(|&a, &b| natord::compare(&a.name(), &b.name()));
// In case no ports have been added to the port, hide the seperator as it is not needed
self.separator