chiark / gitweb /
systemadm: format dates in local time
[elogind.git] / systemadm.vala
index bf25adbf3d0ba3cf4452dd9e69d831f06e0c00c6..167340cc9ca56251abc37b73f062d3353a5430ed 100644 (file)
@@ -199,15 +199,15 @@ public class MainWindow : Window {
                 job_vbox.pack_start(job_table, false, true, 0);
 
                 unit_table.attach(new LeftLabel("Id:"),                     0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
-                unit_table.attach(unit_id_label,                            1, 5, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+                unit_table.attach(unit_id_label,                            1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
                 unit_table.attach(new LeftLabel("Aliases:"),                0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
-                unit_table.attach(unit_aliases_label,                       1, 5, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+                unit_table.attach(unit_aliases_label,                       1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
                 unit_table.attach(new LeftLabel("Description:"),            0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
-                unit_table.attach(unit_description_label,                   1, 5, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+                unit_table.attach(unit_description_label,                   1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
                 unit_table.attach(new LeftLabel("Fragment Path:"),          0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
-                unit_table.attach(unit_fragment_path_label,                 1, 5, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+                unit_table.attach(unit_fragment_path_label,                 1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
                 unit_table.attach(new LeftLabel("Control Group:"),          0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
-                unit_table.attach(unit_cgroup_label,                        1, 5, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
+                unit_table.attach(unit_cgroup_label,                        1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
 
                 unit_table.attach(new LeftLabel("Load State:"),             0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
                 unit_table.attach(unit_load_state_label,                    1, 2, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
@@ -385,8 +385,19 @@ public class MainWindow : Window {
                 current_unit_id = unit.id;
 
                 unit_id_label.set_text_or_na(current_unit_id);
-                unit_aliases_label.set_text_or_na(string.joinv("\n", unit.names));
 
+                string a = "";
+                foreach (string i in unit.names) {
+                        if (i == current_unit_id)
+                                continue;
+
+                        if (a == "")
+                                a = i;
+                        else
+                                a += "\n" + i;
+                }
+
+                unit_aliases_label.set_text_or_na(a);
                 unit_description_label.set_text_or_na(unit.description);
                 unit_load_state_label.set_text_or_na(unit.load_state);
                 unit_active_state_label.set_text_or_na(unit.active_state);
@@ -395,15 +406,15 @@ public class MainWindow : Window {
 
                 uint64 t = unit.active_enter_timestamp;
                 if (t > 0) {
-                        TimeVal tv = { (long) (t / 1000000), (long) (t % 1000000) };
-                        unit_active_enter_timestamp_label.set_text_or_na(tv.to_iso8601());
+                        Time timestamp = Time.local((time_t) (t / 1000000));
+                        unit_active_enter_timestamp_label.set_text_or_na(timestamp.format("%a, %d %b %Y %H:%M:%S %z"));
                 } else
                         unit_active_enter_timestamp_label.set_text_or_na();
 
                 t = unit.active_exit_timestamp;
                 if (t > 0) {
-                        TimeVal tv = { (long) (t / 1000000), (long) (t % 1000000) };
-                        unit_active_exit_timestamp_label.set_text_or_na(tv.to_iso8601());
+                        Time timestamp = Time.local((time_t) (t / 1000000));
+                        unit_active_exit_timestamp_label.set_text_or_na(timestamp.format("%a, %d %b %Y %H:%M:%S %z"));
                 } else
                         unit_active_exit_timestamp_label.set_text_or_na();