Skip to content

Commit

Permalink
icon name in enum
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Oct 15, 2023
1 parent 01716c3 commit e848a0a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public class Captive.MainWindow : Hdy.ApplicationWindow {
}

private void update_security (TabbedWebView web_view) {
string icon_name = web_view.security_to_icon_name ();
string icon_name = web_view.security.to_icon_name ();
cert_button.image = new Gtk.Image.from_icon_name (icon_name, BUTTON);
cert_button.tooltip_text = web_view.security_to_string ();

Expand Down
36 changes: 18 additions & 18 deletions src/TabbedWebView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,24 @@ public class Captive.TabbedWebView : WebKit.WebView {
NONE,
SECURE,
LOADING,
MIXED_CONTENT
MIXED_CONTENT;

public string to_icon_name () {
switch (this) {
case NONE:
return "security-low-symbolic";

case SECURE:
return "security-high-symbolic";

case MIXED_CONTENT:
return "security-medium-symbolic";

case LOADING:
default:
return "content-loading-symbolic";
};
}
}

public TabbedWebView (bool load_cookies) {
Expand Down Expand Up @@ -86,23 +103,6 @@ public class Captive.TabbedWebView : WebKit.WebView {
};
}

public string security_to_icon_name () {
switch (security) {
case NONE:
return "security-low-symbolic";

case SECURE:
return "security-high-symbolic";

case MIXED_CONTENT:
return "security-medium-symbolic";

case LOADING:
default:
return "content-loading-symbolic";
};
}

private void update_tls_info () {
TlsCertificate cert;
TlsCertificateFlags cert_flags;
Expand Down

0 comments on commit e848a0a

Please sign in to comment.