diff --git a/src/Utils.vala b/src/Utils.vala index c4d71eef..be8b7ee1 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -81,12 +81,10 @@ namespace Network { return true; } - public enum CustomMode { + public enum ProxyMode { PROXY_NONE = 0, PROXY_MANUAL, PROXY_AUTO, - HOTSPOT_ENABLED, - HOTSPOT_DISABLED, INVALID } diff --git a/src/Views/ProxyPage.vala b/src/Views/ProxyPage.vala index 4a838f18..e94be72a 100644 --- a/src/Views/ProxyPage.vala +++ b/src/Views/ProxyPage.vala @@ -75,23 +75,20 @@ namespace Network.Widgets { } private void update_mode () { - var mode = Utils.CustomMode.INVALID; + var mode = Utils.ProxyMode.INVALID; switch (Network.Plug.proxy_settings.get_string ("mode")) { case "none": - mode = Utils.CustomMode.PROXY_NONE; + mode = Utils.ProxyMode.PROXY_NONE; status_switch.active = false; break; case "manual": - mode = Utils.CustomMode.PROXY_MANUAL; + mode = Utils.ProxyMode.PROXY_MANUAL; status_switch.active = true; break; case "auto": - mode = Utils.CustomMode.PROXY_AUTO; + mode = Utils.ProxyMode.PROXY_AUTO; status_switch.active = true; break; - default: - mode = Utils.CustomMode.INVALID; - break; } owner.switch_status (mode); diff --git a/src/Views/VPNPage.vala b/src/Views/VPNPage.vala index 36153fc0..359a09a5 100644 --- a/src/Views/VPNPage.vala +++ b/src/Views/VPNPage.vala @@ -167,7 +167,7 @@ public class Network.VPNPage : Network.Widgets.Page { } } - owner.switch_status (Utils.CustomMode.INVALID, state); + owner.switch_status (Utils.ProxyMode.INVALID, state); update_switch (); } diff --git a/src/Widgets/DeviceItem.vala b/src/Widgets/DeviceItem.vala index 518695c5..775fe29c 100644 --- a/src/Widgets/DeviceItem.vala +++ b/src/Widgets/DeviceItem.vala @@ -46,9 +46,9 @@ namespace Network.Widgets { page.bind_property ("title", this, "title"); page.bind_property ("icon-name", this, "icon-name", GLib.BindingFlags.SYNC_CREATE); - switch_status (Utils.CustomMode.INVALID, page.state); + switch_status (Utils.ProxyMode.INVALID, page.state); page.notify["state"].connect (() => { - switch_status (Utils.CustomMode.INVALID, page.state); + switch_status (Utils.ProxyMode.INVALID, page.state); }); } @@ -101,7 +101,7 @@ namespace Network.Widgets { show_all (); } - public void switch_status (Utils.CustomMode custom_mode, NM.DeviceState? state = null) { + public void switch_status (Utils.ProxyMode custom_mode, NM.DeviceState? state = null) { if (state != null) { switch (state) { case NM.DeviceState.ACTIVATED: @@ -123,24 +123,25 @@ namespace Network.Widgets { } else { subtitle = Utils.state_to_string (state); } - } else if (custom_mode != Utils.CustomMode.INVALID) { + } else { switch (custom_mode) { - case Utils.CustomMode.PROXY_NONE: + case Utils.ProxyMode.PROXY_NONE: subtitle = _("Disabled"); status_image.icon_name = "user-offline"; break; - case Utils.CustomMode.PROXY_MANUAL: + case Utils.ProxyMode.PROXY_MANUAL: subtitle = _("Enabled (manual mode)"); status_image.icon_name = "user-available"; break; - case Utils.CustomMode.PROXY_AUTO: + case Utils.ProxyMode.PROXY_AUTO: subtitle = _("Enabled (auto mode)"); status_image.icon_name = "user-available"; break; - default: - // do nothing - return; - } + case Utils.ProxyMode.INVALID: + subtitle = _("Disabled (error)"); + status_image.icon_name = "user-busy"; + break; + } } subtitle = "" + subtitle + "";