diff options
author | Xan Lopez <xan@igalia.com> | 2013-03-19 17:30:58 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2013-03-19 17:30:58 +0800 |
commit | 6e1e6675b4ea682640020c2615d59a07e4a6d408 (patch) | |
tree | 415e566eb406a6ae2e40ae319c6d4886ae2c8a45 /embed | |
parent | 1068d46a3455abc13bfe0a4edaf64cea9f714b0a (diff) | |
download | gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.tar gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.tar.gz gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.tar.bz2 gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.tar.lz gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.tar.xz gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.tar.zst gsoc2013-epiphany-6e1e6675b4ea682640020c2615d59a07e4a6d408.zip |
ephy-web-view: disconnect form auth signal handler or dispose
The signal can (somewhat easily) be emitted on the shell after the web
view dies.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-web-view.c | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 439d83347..5692d0338 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1033,6 +1033,51 @@ icon_loaded_cb (EphyWebView *view, } #endif +#ifdef HAVE_WEBKIT2 +static void +form_auth_data_save_confirmation_response (GtkInfoBar *info_bar, + gint response_id, + gpointer user_data) +{ + GDBusProxy *web_extension; + guint request_id = GPOINTER_TO_INT (user_data); + + gtk_widget_destroy (GTK_WIDGET (info_bar)); + + web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ()); + if (!web_extension) + return; + + g_dbus_proxy_call (web_extension, + "FormAuthDataSaveConfirmationResponse", + g_variant_new ("(ub)", request_id, response_id == GTK_RESPONSE_YES), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); +} + +static void +form_auth_data_save_requested (EphyEmbedShell *shell, + guint request_id, + guint64 page_id, + const char *hostname, + const char *username, + WebKitWebView *web_view) +{ + GtkWidget *info_bar; + + if (webkit_web_view_get_page_id (web_view) != page_id) + return; + + info_bar = ephy_web_view_create_form_auth_save_confirmation_info_bar (EPHY_WEB_VIEW (web_view), + hostname, username); + g_signal_connect (info_bar, "response", + G_CALLBACK (form_auth_data_save_confirmation_response), + GINT_TO_POINTER (request_id)); + + gtk_widget_show (info_bar); +} +#endif + static void ephy_web_view_finalize (GObject *object) { @@ -1044,6 +1089,8 @@ ephy_web_view_finalize (GObject *object) #ifdef HAVE_WEBKIT2 g_signal_handlers_disconnect_by_func (object, icon_changed_cb, NULL); + + g_signal_handlers_disconnect_by_func (ephy_embed_shell_get_default (), form_auth_data_save_requested, object); #endif if (priv->non_search_regex) { @@ -2603,51 +2650,6 @@ zoom_changed_cb (WebKitWebView *web_view, } } -#ifdef HAVE_WEBKIT2 -static void -form_auth_data_save_confirmation_response (GtkInfoBar *info_bar, - gint response_id, - gpointer user_data) -{ - GDBusProxy *web_extension; - guint request_id = GPOINTER_TO_INT (user_data); - - gtk_widget_destroy (GTK_WIDGET (info_bar)); - - web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ()); - if (!web_extension) - return; - - g_dbus_proxy_call (web_extension, - "FormAuthDataSaveConfirmationResponse", - g_variant_new ("(ub)", request_id, response_id == GTK_RESPONSE_YES), - G_DBUS_CALL_FLAGS_NONE, - -1, NULL, NULL, NULL); -} - -static void -form_auth_data_save_requested (EphyEmbedShell *shell, - guint request_id, - guint64 page_id, - const char *hostname, - const char *username, - WebKitWebView *web_view) -{ - GtkWidget *info_bar; - - if (webkit_web_view_get_page_id (web_view) != page_id) - return; - - info_bar = ephy_web_view_create_form_auth_save_confirmation_info_bar (EPHY_WEB_VIEW (web_view), - hostname, username); - g_signal_connect (info_bar, "response", - G_CALLBACK (form_auth_data_save_confirmation_response), - GINT_TO_POINTER (request_id)); - - gtk_widget_show (info_bar); -} -#endif - #ifndef HAVE_WEBKIT2 static void add_do_not_track_header_cb (WebKitWebView *view, WebKitWebFrame *frame, |