Skip to content

Commit

Permalink
Auto select active network (#407)
Browse files Browse the repository at this point in the history
* Auto select active network

* Don't auto switch while plug is already open
  • Loading branch information
vjr authored Oct 8, 2024
1 parent 7a7755b commit b41c3fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/MainView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ public class Network.MainView : Gtk.Box {
unowned NetworkManager network_manager = NetworkManager.get_default ();
if (network_manager.client.networking_get_enabled ()) {
device_list.sensitive = true;
unowned var child = device_list.get_first_child ();
while (child != null) {
if (child is Widgets.DeviceItem && ((Widgets.DeviceItem) child).page.state == NM.DeviceState.ACTIVATED) {
child.activate ();
return;
}
child = child.get_next_sibling ();
}
device_list.get_row_at_index (0).activate ();
} else {
device_list.sensitive = false;
Expand Down

0 comments on commit b41c3fc

Please sign in to comment.