#include Once "window9.bi"

Sub FreeResourceGadget (hWin As hwnd) Export
	
	For i As Long = 1 To 65536
		
		Dim As ListT Ptr pTemp = pGlobalTypeWindow9->ListGadgets->findNodeFunc(i)
		
		If pTemp <> 0 Then
			
			Dim As hwnd pWidget = Cast(hwnd,pTemp->anyTwoData)
			
			if pTemp->anyThreeData = 24 then
				
				pWidget = gadgetid(pTemp->anyFourData)
				
				If pWidget andalso gtk_widget_get_toplevel (gadgetid(pTemp->anyFourData)) = hWin Then
					
					DelToolTip(pTemp->anyFourData , pTemp->anyOneData)
					
				EndIf
				
			elseIf Getwindowproperty(pWidget , "SYS_TRAY_INIT") = 0 Then
				
				If gtk_widget_get_toplevel (pWidget) = hWin Then
					
					pGlobalTypeWindow9->ListGadgets->removeNodeSub(Cint(i))
					
				Endif
				
			Endif
			
		Endif
		
	Next
	
End Sub

Sub Close_window( hw As HWND ) Export
	
	FreeResourceGadget(hw)
	
	pGlobalTypeWindow9->ListWinAndContainers->removeNodeSub(Cint(hw))
	
	gtk_widget_destroy(hw)
	
End Sub