Confirmation for insecure sites instead of urlbar color

Fixes: https://bugs.launchpad.net/midori/+bug/996697
This commit is contained in:
Christian Dywan 2012-07-15 16:54:11 +02:00
parent 377a01948f
commit 83609a1a88
3 changed files with 20 additions and 53 deletions

View file

@ -7,24 +7,6 @@
padding: 0;
}
.entry.progressbar {
background-image: -gtk-gradient(linear,
left top, left bottom, from (@selected_bg_color), to (@selected_bg_color));
color: @selected_fg_color;
}
.entry.security_unknown {
background-image: -gtk-gradient(linear,
left top, left bottom, from (#ef7070), to(#ef7070));
color: #000;
}
.entry.security_trusted {
background-image: -gtk-gradient(linear,
left top, left bottom, from (#d1eeb9), to(#d1eeb9));
color: #000;
}
GtkOverlay > * {
padding: 4px;
border-style: solid;

View file

@ -1691,10 +1691,6 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data))
{
#if !GTK_CHECK_VERSION (3, 0, 0)
const gchar* bg_color = NULL;
const gchar* fg_color = NULL;
#endif
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
GdkScreen* screen = gtk_widget_get_screen (entry);
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
@ -1702,8 +1698,6 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
if (hint == MIDORI_SECURITY_UNKNOWN)
{
#if !GTK_CHECK_VERSION (3, 0, 0)
bg_color = "#ef7070";
fg_color = "#000";
#endif
#if !HAVE_HILDON
if (gtk_icon_theme_has_icon (icon_theme, "channel-insecure-symbolic"))
@ -1722,8 +1716,6 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
else if (hint == MIDORI_SECURITY_TRUSTED)
{
#if !GTK_CHECK_VERSION (3, 0, 0)
bg_color = "#d1eeb9";
fg_color = "#000";
#endif
#if !HAVE_HILDON
if (gtk_icon_theme_has_icon (icon_theme, "channel-secure-symbolic"))
@ -1750,32 +1742,5 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Open, unencrypted connection"));
}
{
#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext* context = gtk_widget_get_style_context (entry);
if (hint == MIDORI_SECURITY_UNKNOWN)
{
gtk_style_context_add_class (context, "security_unknown");
gtk_style_context_remove_class (context, "security_trusted");
}
else if (hint == MIDORI_SECURITY_TRUSTED)
{
gtk_style_context_add_class (context, "security_trusted");
gtk_style_context_remove_class (context, "security_unknown");
}
else if (hint == MIDORI_SECURITY_NONE)
{
gtk_style_context_remove_class (context, "security_unknown");
gtk_style_context_remove_class (context, "security_trusted");
}
#else
GdkColor color = { 0 };
if (bg_color) gdk_color_parse (bg_color, &color);
gtk_widget_modify_base (entry, GTK_STATE_NORMAL, bg_color ? &color : NULL);
if (fg_color) gdk_color_parse (fg_color, &color);
gtk_widget_modify_text (entry, GTK_STATE_NORMAL, fg_color ? &color : NULL);
#endif
}
}
}

View file

@ -1017,6 +1017,15 @@ webkit_web_view_load_started_cb (WebKitWebView* web_view,
g_object_thaw_notify (G_OBJECT (view));
}
static gboolean
midori_view_display_error (MidoriView* view,
const gchar* uri,
const gchar* title,
const gchar* message,
const gchar* description,
const gchar* try_again,
WebKitWebFrame* web_frame);
static void
webkit_web_view_load_committed_cb (WebKitWebView* web_view,
WebKitWebFrame* web_frame,
@ -1069,6 +1078,17 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
if (message
&& soup_message_get_flags (message) & SOUP_MESSAGE_CERTIFICATE_TRUSTED)
view->security = MIDORI_SECURITY_TRUSTED;
else if (!view->special)
{
view->security = MIDORI_SECURITY_UNKNOWN;
midori_view_stop_loading (view);
midori_view_display_error (
view, view->uri, view->title ? view->title : view->uri,
_("Security unknown"),
_("The certificate is invalid or unknown"),
_("Load Page"),
NULL);
}
else
#endif
view->security = MIDORI_SECURITY_UNKNOWN;