]> spindle.queued.net Git - midori/commitdiff
Disable WebKit's authentication dialog if needed
authorChristian Dywan <christian@twotoasts.de>
Sat, 28 Feb 2009 22:46:41 +0000 (23:46 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 28 Feb 2009 22:46:41 +0000 (23:46 +0100)
We need to handle WebKit possibly having an authentication
dialog more expressly. Obviously we only ever want to
see one dialog and we choose our own simply because it
is localized.

katze/katze-http-auth.c
midori/main.c

index fd15d87c14101d578e4112e3ef841e8534ec8d1a..4e4cd8a143fe80e3e4fc137aa442a7c6828ca2a8 100644 (file)
@@ -161,11 +161,28 @@ katze_http_auth_session_authenticate_cb (SoupSession* session,
 }
 
 static void
-katze_http_auth_attach (SoupSessionFeature* feature,
-                        SoupSession*        session)
+katze_http_auth_session_request_queued_cb (SoupSession* session,
+                                           SoupMessage* msg,
+                                           gpointer     data)
 {
+    /* WebKit has its own authentication dialog in recent versions.
+       We want only one, and we choose our own to have localization. */
+    GType type = g_type_from_name ("WebKitSoupAuthDialog");
+    if (type)
+        soup_session_remove_feature_by_type (session, type);
+
     g_signal_connect (session, "authenticate",
         G_CALLBACK (katze_http_auth_session_authenticate_cb), NULL);
+    g_signal_handlers_disconnect_by_func (session,
+        katze_http_auth_session_request_queued_cb, NULL);
+}
+
+static void
+katze_http_auth_attach (SoupSessionFeature* feature,
+                        SoupSession*        session)
+{
+    g_signal_connect (session, "request-queued",
+        G_CALLBACK (katze_http_auth_session_request_queued_cb), NULL);
 }
 
 static void
@@ -174,6 +191,8 @@ katze_http_auth_detach (SoupSessionFeature* feature,
 {
     g_signal_handlers_disconnect_by_func (session,
         katze_http_auth_session_authenticate_cb, NULL);
+    g_signal_handlers_disconnect_by_func (session,
+        katze_http_auth_session_request_queued_cb, NULL);
 }
 
 static void
index c474f6a5c29feaaabeb3c5df3fe65ed9b4cd4d2b..bf2eceaee5ddec44632ce2ba791a64493eb43649 100644 (file)
@@ -1354,10 +1354,7 @@ soup_session_constructed_cb (GObject* object)
     g_signal_connect (settings, "notify::ident-string",
         G_CALLBACK (soup_session_settings_notify_ident_string_cb), object);
 
-    /* Only add the Auth feature if WebKit didn't already */
-    if (!g_signal_has_handler_pending (session,
-        g_signal_lookup ("authenticate", SOUP_TYPE_SESSION), 0, FALSE))
-        soup_session_add_feature_by_type (session, KATZE_TYPE_HTTP_AUTH);
+    soup_session_add_feature_by_type (session, KATZE_TYPE_HTTP_AUTH);
     midori_soup_session_debug (session);
 
     feature = g_object_new (KATZE_TYPE_HTTP_COOKIES, NULL);