add yggdrasil service watcher (update every 1s, think about freq)

This commit is contained in:
Nikolay Brovko 2020-01-26 21:56:04 +03:00
parent bb67130d5e
commit f22f3f9504
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
1 changed files with 4 additions and 1 deletions

View File

@ -77,7 +77,7 @@ namespace Yggtk {
} }
} }
private void display_current_service_state () { private bool display_current_service_state () {
try { try {
if (window != null) { if (window != null) {
window.set_service_state (yggdrasil_service.get_status ()); window.set_service_state (yggdrasil_service.get_status ());
@ -85,6 +85,8 @@ namespace Yggtk {
} catch (SpawnError e) { } catch (SpawnError e) {
stderr.printf ("Unable to get service state: %s\n", e.message); stderr.printf ("Unable to get service state: %s\n", e.message);
} }
return true;
} }
private void update_yggtk () { private void update_yggtk () {
@ -130,6 +132,7 @@ namespace Yggtk {
window = new AppWindow (this); window = new AppWindow (this);
} }
display_current_service_state (); display_current_service_state ();
Timeout.add_seconds (1, display_current_service_state);
window.show (); window.show ();
} }