From 62edfeb06e1513059c76b72e6f57596401644892 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 26 Apr 2009 17:11:16 +0200 Subject: [PATCH] Disconnect panel toolitem destroy handler when detaching --- midori/midori-panel.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 8c2fa0bb..e96bc600 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -218,6 +218,15 @@ midori_panel_detached_window_delete_event_cb (GtkWidget* window, return FALSE; } +static void +midori_panel_widget_destroy_cb (GtkWidget* viewable, + GtkWidget* widget) +{ + gtk_widget_destroy (widget); + g_signal_handlers_disconnect_by_func ( + viewable, midori_panel_widget_destroy_cb, widget); +} + static void midori_panel_button_detach_clicked_cb (GtkWidget* toolbutton, MidoriPanel* panel) @@ -246,6 +255,9 @@ midori_panel_button_detach_clicked_cb (GtkWidget* toolbutton, gtk_container_add (GTK_CONTAINER (window), vbox); if (menuitem) gtk_widget_hide (menuitem); + g_signal_handlers_disconnect_by_func ( + _midori_panel_child_for_scrolled (panel, scrolled), + midori_panel_widget_destroy_cb, toolitem); gtk_container_remove (GTK_CONTAINER (panel->toolbar), GTK_WIDGET (toolitem)); g_object_ref (toolbar); gtk_container_remove (GTK_CONTAINER (panel->toolbook), toolbar); @@ -537,15 +549,6 @@ midori_panel_viewable_destroy_cb (GtkWidget* viewable, viewable, midori_panel_viewable_destroy_cb, panel); } -static void -midori_panel_widget_destroy_cb (GtkWidget* viewable, - GtkWidget* widget) -{ - gtk_widget_destroy (widget); - g_signal_handlers_disconnect_by_func ( - viewable, midori_panel_widget_destroy_cb, widget); -} - static GtkToolItem* midori_panel_construct_tool_item (MidoriPanel* panel, MidoriViewable* viewable)