Michal Schmidt e43452
From 5581802cca0ebea3b8a3193f94c80cfc4d0a3111 Mon Sep 17 00:00:00 2001
Michal Schmidt e43452
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Michal Schmidt e43452
Date: Sun, 18 Sep 2011 17:00:12 +0200
Michal Schmidt f1996e
Subject: [PATCH] systemadm: coalesce id and decription fields
Michal Schmidt e43452
Michal Schmidt e43452
This is just in interest of saving space (e.g. 5 lines for multi-user.target).
Michal Schmidt e43452
(cherry picked from commit 8f38d5a4c6e627180809db739b2bdaa5ca0c645a)
Michal Schmidt e43452
---
Michal Schmidt e43452
 src/systemadm.vala |   24 +++++++++++-------------
Michal Schmidt e43452
 1 files changed, 11 insertions(+), 13 deletions(-)
Michal Schmidt e43452
Michal Schmidt e43452
diff --git a/src/systemadm.vala b/src/systemadm.vala
Michal Schmidt e43452
index d420800..4cb5c55 100644
Michal Schmidt e43452
--- a/src/systemadm.vala
Michal Schmidt e43452
+++ b/src/systemadm.vala
Michal Schmidt e43452
@@ -96,7 +96,6 @@ public class MainWindow : Window {
Michal Schmidt e43452
         private Manager manager;
Michal Schmidt e43452
 
Michal Schmidt e43452
         private RightLabel unit_id_label;
Michal Schmidt e43452
-        private RightLabel unit_aliases_label;
Michal Schmidt e43452
         private RightLabel unit_dependency_label;
Michal Schmidt e43452
         private RightLabel unit_description_label;
Michal Schmidt e43452
         private RightLabel unit_load_state_label;
Michal Schmidt e43452
@@ -220,7 +219,6 @@ public class MainWindow : Window {
Michal Schmidt e43452
                 job_vbox.pack_start(scroll, true, true, 0);
Michal Schmidt e43452
 
Michal Schmidt e43452
                 unit_id_label = new RightLabel();
Michal Schmidt e43452
-                unit_aliases_label = new RightLabel();
Michal Schmidt e43452
                 unit_dependency_label = new RightLabel();
Michal Schmidt e43452
                 unit_description_label = new RightLabel();
Michal Schmidt e43452
                 unit_load_state_label = new RightLabel();
Michal Schmidt e43452
@@ -255,8 +253,6 @@ public class MainWindow : Window {
Michal Schmidt e43452
 
Michal Schmidt e43452
                 unit_table.attach(new LeftLabel("Id:"),                     0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
                 unit_table.attach(unit_id_label,                            1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
-                unit_table.attach(new LeftLabel("Aliases:"),                0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
-                unit_table.attach(unit_aliases_label,                       1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
                 unit_table.attach(new LeftLabel("Description:"),            0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
                 unit_table.attach(unit_description_label,                   1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
                 unit_table.attach(new LeftLabel("Dependencies:"),           0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
Michal Schmidt e43452
@@ -443,7 +439,6 @@ public class MainWindow : Window {
Michal Schmidt e43452
                 restart_button.set_sensitive(false);
Michal Schmidt e43452
 
Michal Schmidt e43452
                 unit_id_label.set_text_or_na();
Michal Schmidt e43452
-                unit_aliases_label.set_text_or_na();
Michal Schmidt e43452
                 unit_description_label.set_text_or_na();
Michal Schmidt e43452
                 unit_description_label.set_text_or_na();
Michal Schmidt e43452
                 unit_load_state_label.set_text_or_na();
Michal Schmidt e43452
@@ -507,20 +502,23 @@ public class MainWindow : Window {
Michal Schmidt e43452
         public void show_unit(Unit unit) {
Michal Schmidt e43452
                 current_unit_id = unit.id;
Michal Schmidt e43452
 
Michal Schmidt e43452
-                unit_id_label.set_text_or_na(current_unit_id);
Michal Schmidt e43452
-
Michal Schmidt e43452
-                string a = "";
Michal Schmidt e43452
+                string id_display = current_unit_id;
Michal Schmidt e43452
+                bool has_alias = false;
Michal Schmidt e43452
                 foreach (string i in unit.names) {
Michal Schmidt e43452
                         if (i == current_unit_id)
Michal Schmidt e43452
                                 continue;
Michal Schmidt e43452
 
Michal Schmidt e43452
-                        if (a == "")
Michal Schmidt e43452
-                                a = i;
Michal Schmidt e43452
-                        else
Michal Schmidt e43452
-                                a += "\n" + i;
Michal Schmidt e43452
+                        if (!has_alias) {
Michal Schmidt e43452
+                                id_display += " (aliases:";
Michal Schmidt e43452
+                                has_alias = true;
Michal Schmidt e43452
+                        }
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        id_display += " " + i;
Michal Schmidt e43452
                 }
Michal Schmidt e43452
+                if(has_alias)
Michal Schmidt e43452
+                        id_display += ")";
Michal Schmidt e43452
 
Michal Schmidt e43452
-                unit_aliases_label.set_text_or_na(a);
Michal Schmidt e43452
+                unit_id_label.set_text_or_na(id_display);
Michal Schmidt e43452
 
Michal Schmidt e43452
                 string[]
Michal Schmidt e43452
                         requires = unit.requires,