add browse-peers action and use it instead of button clicked signal

think about just use GtkLinkButton instead of overcomplicated xdg-open call
This commit is contained in:
Nikolay Brovko 2020-01-28 03:42:35 +03:00
parent 9512c02bff
commit 49f9364445
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
2 changed files with 15 additions and 7 deletions

View File

@ -65,12 +65,6 @@ namespace Yggtk {
Process.spawn_command_line_sync ("yggdrasil -genconf -json", out yggconf);
parse (yggconf, peer_ip_entry);
} else {
Process.spawn_command_line_sync (
"xdg-open https://github.com/yggdrasil-network/public-peers"
);
}
});

View File

@ -44,7 +44,7 @@ namespace Yggtk {
Gtk.main_quit ();
}
}
private void add_actions () {
SimpleAction update_yggtk_action = new SimpleAction ("update-yggtk", null);
update_yggtk_action.activate.connect (update_yggtk);
@ -57,6 +57,10 @@ namespace Yggtk {
SimpleAction set_service_state_action = new SimpleAction ("set-service-state", VariantType.BOOLEAN);
set_service_state_action.activate.connect (set_service_state);
add_action (set_service_state_action);
SimpleAction browse_peers_action = new SimpleAction ("browse-peers", null);
browse_peers_action.activate.connect (browse_peers);
add_action (browse_peers_action);
}
private void set_service_state (SimpleAction action, Variant? state) {
@ -127,6 +131,16 @@ namespace Yggtk {
}
}
private void browse_peers () {
try {
Process.spawn_command_line_sync (
"xdg-open https://github.com/yggdrasil-network/public-peers"
);
} catch (SpawnError e) {
stderr.printf ("Unable to open link with xdg-open: %s\n", e.message);
}
}
protected override void activate () {
if (window == null) {
window = new AppWindow (this);