diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2011-03-03 22:20:19 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2011-09-20 01:07:27 +0200 |
commit | 23b51f17b1cf473bff3ae5332477e2028a5c5f53 (patch) | |
tree | 86a0eba5556573ed9d6401d5d74c78a262bc3c61 /src | |
parent | 8278f06953f5339646e5ff98900321f1525c0a21 (diff) |
systemadm: use color for dependency links
Diffstat (limited to 'src')
-rw-r--r-- | src/systemadm.vala | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/systemadm.vala b/src/systemadm.vala index 088ba26be9..eed46b57e9 100644 --- a/src/systemadm.vala +++ b/src/systemadm.vala @@ -457,6 +457,25 @@ public class MainWindow : Window { unit_cgroup_label.set_text_or_na(); } + public string format_unit_link(string i) { + Unit? u = get_unit(i); + if(u == null) + return "<span color='grey'>" + i + "</span"; + + string color; + switch (u.sub_state) { + case "active": color = "blue"; break; + case "dead": color = "red"; break; + case "running": color = "green"; break; + default: color = "black"; break; + } + string span = "<span underline='none' color='" + color + "'>" + + i + "(" + + u.sub_state + ")" + "</span>"; + return " <a href='" + i + "'>" + span + "</a>"; + } + + public string make_dependency_string(string? prefix, string word, string[] dependencies) { Gee.Collection<unowned string> sorted = new Gee.TreeSet<string>(); foreach (string i in dependencies) @@ -479,7 +498,7 @@ public class MainWindow : Window { first = false; } - r += " <a href=\"" + i + "\">" + i + "</a>"; + r += format_unit_link(i); } return r; |