chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
execute: fix bad jump
[elogind.git]
/
systemadm.vala
diff --git
a/systemadm.vala
b/systemadm.vala
index 423528aa3f552a5b37bde2aef14f6479c1c80eb7..fdc84648dc2cb1108ee214f5b1d761274b918c22 100644
(file)
--- a/
systemadm.vala
+++ b/
systemadm.vala
@@
-385,8
+385,19
@@
public class MainWindow : Window {
current_unit_id = unit.id;
unit_id_label.set_text_or_na(current_unit_id);
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);
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) {
uint64 t = unit.active_enter_timestamp;
if (t > 0) {
- Time
Val tv = { (long) (t / 1000000), (long) (t % 1000000) }
;
- unit_active_enter_timestamp_label.set_text_or_na(t
v.to_iso8601(
));
+ Time
timestamp = Time.local((time_t) (t / 1000000))
;
+ unit_active_enter_timestamp_label.set_text_or_na(t
imestamp.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) {
} else
unit_active_enter_timestamp_label.set_text_or_na();
t = unit.active_exit_timestamp;
if (t > 0) {
- Time
Val tv = { (long) (t / 1000000), (long) (t % 1000000) }
;
- unit_active_exit_timestamp_label.set_text_or_na(t
v.to_iso8601(
));
+ Time
timestamp = Time.local((time_t) (t / 1000000))
;
+ unit_active_exit_timestamp_label.set_text_or_na(t
imestamp.format("%a, %d %b %Y %H:%M:%S %z"
));
} else
unit_active_exit_timestamp_label.set_text_or_na();
} else
unit_active_exit_timestamp_label.set_text_or_na();
@@
-475,7
+486,7
@@
public class MainWindow : Window {
try {
u.start("replace");
} catch (DBus.Error e) {
try {
u.start("replace");
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
}
}
}
@@
-488,7
+499,7
@@
public class MainWindow : Window {
try {
u.stop("replace");
} catch (DBus.Error e) {
try {
u.stop("replace");
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
}
}
}
@@
-501,7
+512,7
@@
public class MainWindow : Window {
try {
u.reload("replace");
} catch (DBus.Error e) {
try {
u.reload("replace");
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
}
}
}
@@
-514,7
+525,7
@@
public class MainWindow : Window {
try {
u.restart("replace");
} catch (DBus.Error e) {
try {
u.restart("replace");
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
}
}
}
@@
-527,7
+538,7
@@
public class MainWindow : Window {
try {
j.cancel();
} catch (DBus.Error e) {
try {
j.cancel();
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
}
}
}
@@
-672,7
+683,7
@@
public class MainWindow : Window {
try {
manager.reload();
} catch (DBus.Error e) {
try {
manager.reload();
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
}
}
}
@@
-684,9
+695,19
@@
public class MainWindow : Window {
unit_type_combo_box.set_active(8);
} catch (DBus.Error e) {
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[] = {
}
static const OptionEntry entries[] = {
@@
-695,6
+716,12
@@
static const OptionEntry entries[] = {
{ null }
};
{ 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 {
int main (string[] args) {
try {
@@
-705,9
+732,9
@@
int main (string[] args) {
Gtk.main();
} catch (DBus.Error e) {
Gtk.main();
} catch (DBus.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
} catch (GLib.Error e) {
} catch (GLib.Error e) {
-
message("%s",
e.message);
+
show_error(
e.message);
}
return 0;
}
return 0;