From da5f257314735863f310dc4e63f0a87979c7c131 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20St=C3=B6sel?= Date: Fri, 13 Apr 2012 19:26:30 +0200 Subject: [PATCH] Fix for "tab registration" in adblock Fixes: https://bugs.launchpad.net/midori/+bug/977981 --- extensions/adblock.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/extensions/adblock.c b/extensions/adblock.c index aa64eeb1..06137872 100644 --- a/extensions/adblock.c +++ b/extensions/adblock.c @@ -1031,14 +1031,6 @@ static void adblock_deactivate_cb (MidoriExtension* extension, MidoriBrowser* browser); -static void -adblock_add_tab_foreach_cb (MidoriView* view, - MidoriBrowser* browser, - MidoriExtension* extension) -{ - adblock_add_tab_cb (browser, view, extension); -} - static void adblock_app_add_browser_cb (MidoriApp* app, MidoriBrowser* browser, @@ -1046,6 +1038,8 @@ adblock_app_add_browser_cb (MidoriApp* app, { GtkWidget* statusbar; GtkWidget* image; + GtkWidget* view; + gint i; statusbar = katze_object_get_object (browser, "statusbar"); image = NULL; @@ -1055,8 +1049,10 @@ adblock_app_add_browser_cb (MidoriApp* app, g_object_set_data_full (G_OBJECT (browser), "status-image", image, (GDestroyNotify)gtk_widget_destroy); - midori_browser_foreach (browser, - (GtkCallback)adblock_add_tab_foreach_cb, extension); + i = 0; + while((view = midori_browser_get_nth_tab(browser, i++))) + adblock_add_tab_cb (browser, MIDORI_VIEW (view), extension); + g_signal_connect (browser, "add-tab", G_CALLBACK (adblock_add_tab_cb), extension); g_signal_connect (browser, "remove-tab", @@ -1514,6 +1510,8 @@ static void adblock_deactivate_cb (MidoriExtension* extension, MidoriBrowser* browser) { + gint i; + GtkWidget* view; MidoriApp* app = midori_extension_get_app (extension); MidoriWebSettings* settings = katze_object_get_object (app, "settings"); @@ -1527,7 +1525,10 @@ adblock_deactivate_cb (MidoriExtension* extension, browser, adblock_add_tab_cb, extension); g_signal_handlers_disconnect_by_func ( browser, adblock_remove_tab_cb, extension); - midori_browser_foreach (browser, (GtkCallback)adblock_deactivate_tabs, extension); + + i = 0; + while((view = midori_browser_get_nth_tab(browser, i++))) + adblock_deactivate_tabs (MIDORI_VIEW (view), browser, extension); adblock_destroy_db (); midori_web_settings_remove_style (settings, "adblock-blockcss"); -- 2.39.5