]> spindle.queued.net Git - midori/commitdiff
Confirmation for insecure sites instead of urlbar color
authorChristian Dywan <christian@twotoasts.de>
Sun, 15 Jul 2012 14:54:11 +0000 (16:54 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 15 Jul 2012 15:25:07 +0000 (17:25 +0200)
Fixes: https://bugs.launchpad.net/midori/+bug/996697
data/gtk3.css
midori/midori-locationaction.c
midori/midori-view.c

index 01ad05cb5a2cbfda25377d42b9253ec98d7f38c2..2a6d8f44fc0f592514053302a23ebf24b5b5ac9d 100644 (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;
index 5ded1a33a4c4108bea874a308ba9f6bf3a3e050f..1d44a22e2b2d3982791b2ee94a5524d93432a160 100644 (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
-        }
     }
 }
index a509f06ebfa788ad6894f8e8f7c79a75ccbbc049..f1c0b766dd5bf76c9196f782e643f30d280aab24 100644 (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;