Disable WebKit's authentication dialog if needed

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.
This commit is contained in:
Christian Dywan 2009-02-28 23:46:41 +01:00
parent dc357a40aa
commit ff9085b400
2 changed files with 22 additions and 6 deletions

View file

@ -160,12 +160,29 @@ katze_http_auth_session_authenticate_cb (SoupSession* session,
gtk_widget_show (dialog);
}
static void
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, "authenticate",
G_CALLBACK (katze_http_auth_session_authenticate_cb), NULL);
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

View file

@ -1354,9 +1354,6 @@ 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);
midori_soup_session_debug (session);