# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1052803942 0 # Node ID 47273b6a850007c2bb5c585feda82223be5a99fd # Parent 1d7be77cbfb5779e940a33c18c0a5c9812803424 Fixes for signal removal. Some limitations still exist... like some signals won't be removed for widgets that have multiple subparts with signals attached, like comboboxes and the tree widget. This affects dw_signal_disconnect_by_window() and dw_signal_disconnect_by_data(). diff -r 1d7be77cbfb5 -r 47273b6a8500 gtk/dw.c --- a/gtk/dw.c Tue May 13 05:07:02 2003 +0000 +++ b/gtk/dw.c Tue May 13 05:32:22 2003 +0000 @@ -7758,6 +7758,29 @@ DW_MUTEX_UNLOCK; } +/* Get the actual signal window handle not the user window handle + * Should mimic the code in dw_signal_connect() below. + */ +static HWND _find_signal_window(HWND window, char *signame) +{ + HWND thiswindow = window; + + if(GTK_IS_SCROLLED_WINDOW(thiswindow)) + thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); + else if(GTK_IS_COMBO(thiswindow) && signame && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) + thiswindow = GTK_COMBO(thiswindow)->list; + else if(GTK_IS_COMBO(thiswindow) && signame && strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0) + thiswindow = GTK_COMBO(thiswindow)->entry; + else if(GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) || + GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow)) + thiswindow = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_adjustment"); +#if GTK_MAJOR_VERSION > 1 + else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) + thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); +#endif + return thiswindow; +} + /* * Add a callback to a window event. * Parameters: @@ -7909,16 +7932,24 @@ */ void dw_signal_disconnect_by_name(HWND window, char *signame) { - int z, count = (int)gtk_object_get_data(GTK_OBJECT(window), "_dw_sigcounter"); - void *thisfunc = _findsigfunc(signame); + HWND thiswindow; + int z, count; + void *thisfunc; + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + thiswindow = _find_signal_window(window, signame); + count = (int)gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_sigcounter"); + thisfunc = _findsigfunc(signame); for(z=0;z