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);
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);
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();
try {
u.start("replace");
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
try {
u.stop("replace");
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
try {
u.reload("replace");
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
try {
u.restart("replace");
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
try {
j.cancel();
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
try {
manager.reload();
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
unit_type_combo_box.set_active(8);
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
}
+
+ public void show_error(string e) {
+ var m = new MessageDialog(this,
+ DialogFlags.DESTROY_WITH_PARENT,
+ MessageType.ERROR,
+ ButtonsType.CLOSE, "%s", e);
+ m.run();
+ m.destroy();
+ }
+
}
static const OptionEntry entries[] = {
{ null }
};
+void show_error(string e) {
+ var m = new MessageDialog(null, 0, MessageType.ERROR, ButtonsType.CLOSE, "%s", e);
+ m.run();
+ m.destroy();
+}
+
int main (string[] args) {
try {
Gtk.main();
} catch (DBus.Error e) {
- message("%s", e.message);
+ show_error(e.message);
} catch (GLib.Error e) {
- message("%s", e.message);
+ show_error(e.message);
}
return 0;