Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/MainView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public class Network.MainView : Gtk.Box {
hexpand = true
};
content.add_named (airplane_mode, "airplane-mode-info");
content.add_child (vpn_page);
content.add_child (proxy.page);
content.add_named (vpn_page, "vpn");
content.add_named (proxy.page, "proxy");

var scrolled_window = new Gtk.ScrolledWindow () {
child = device_list,
Expand Down Expand Up @@ -161,6 +161,10 @@ public class Network.MainView : Gtk.Box {
}
}

public void push (string location) {
content.visible_child_name = location;
}

private void device_removed_cb (NM.Device device) {
foreach (var widget_interface in network_interface) {
if (widget_interface.device == device) {
Expand Down Expand Up @@ -273,21 +277,27 @@ public class Network.MainView : Gtk.Box {
}

private void add_interface (Widgets.Page page) {
if (content.get_page (page) != null) {
return;
}

Widgets.DeviceItem item;
if (page is Widgets.HotspotInterface) {
item = new Widgets.DeviceItem.from_page (page) {
item_type = VIRTUAL
};


content.add_named (page, "hotspot");

return;
} else if (page.device.get_iface ().has_prefix ("usb")) {
item = new Widgets.DeviceItem.from_page (page, "drive-removable-media");
} else {
item = new Widgets.DeviceItem.from_page (page);
}

if (content.get_page (page) == null) {
content.add_child (page);
}

content.add_named (page, page.device.udi);
device_list.append (item);
update_networking_state ();
}
Expand Down
12 changes: 8 additions & 4 deletions src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ namespace Network {

var settings = new Gee.TreeMap<string, string?> (null, null);
settings.set ("network", null);
settings.set ("network/hotspot", "hotspot");
settings.set ("network/proxy", "proxy");
settings.set ("network/vpn", "vpn");

Object (category: Category.NETWORK,
code_name: "io.elementary.settings.network",
display_name: _("Network"),
Expand Down Expand Up @@ -61,7 +65,7 @@ namespace Network {
}

public override void search_callback (string location) {

main_view.push (location);
}

// 'search' returns results like ("Keyboard → Behavior → Duration", "keyboard<sep>behavior")
Expand All @@ -72,11 +76,11 @@ namespace Network {
search_results.set ("%s → %s".printf (display_name, _("Wireless")), "");
search_results.set ("%s → %s".printf (display_name, _("Wi-Fi")), "");
search_results.set ("%s → %s".printf (display_name, _("WLAN")), "");
search_results.set ("%s → %s".printf (display_name, _("Proxy")), "");
search_results.set ("%s → %s".printf (display_name, _("Proxy")), "proxy");
search_results.set ("%s → %s".printf (display_name, _("Airplane Mode")), "");
search_results.set ("%s → %s".printf (display_name, _("IP Address")), "");
search_results.set ("%s → %s".printf (display_name, _("Hotspot")), "");
search_results.set ("%s → %s".printf (display_name, _("VPN")), "");
search_results.set ("%s → %s".printf (display_name, _("Hotspot")), "hotspot");
search_results.set ("%s → %s".printf (display_name, _("VPN")), "vpn");
return search_results;
}
}
Expand Down