[systemd-devel] [PATCH 03/14] systemadm: display dependencies sorted

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Sep 19 04:24:18 PDT 2011


Maybe there's an easier way to sort strings in vala... I admit
that this patch is not very pretty.
---
 src/systemadm.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/systemadm.vala b/src/systemadm.vala
index 21177bf..9861ae4 100644
--- a/src/systemadm.vala
+++ b/src/systemadm.vala
@@ -442,6 +442,11 @@ public class MainWindow : Window {
         }
 
         public string make_dependency_string(string? prefix, string word, string[] dependencies) {
+                List<string> sorted = new List<string>();
+                foreach (string i in dependencies)
+                        sorted.append(i);
+                sorted.sort(strcmp);
+
                 bool first = true;
                 string r;
 
@@ -450,7 +455,7 @@ public class MainWindow : Window {
                 else
                         r = prefix;
 
-                foreach (string i in dependencies) {
+                foreach (string i in sorted) {
                         if (r != "")
                                 r += first ? "\n" : ",";
 
-- 
1.7.5.4



More information about the systemd-devel mailing list