#include ONCE "window9.bi"

function GetSelectedCountListView (iGadget as Long , iArray as long ptr = 0 ) as long export
	
	dim as GtkWidget ptr listview = cast(any ptr,GadgetId(iGadget))
	
	dim as GtkTreeSelection ptr selection = gtk_tree_view_get_selection (cast(any ptr,listview))
	
	dim as GtkListStore ptr liststore = cast(any ptr , gtk_tree_view_get_model(cast(any ptr,listview)))
	
	dim as Glist ptr list = gtk_tree_selection_get_selected_rows (selection , cast(any ptr,@liststore))
	
	dim as GtkTreePath ptr path
	
	dim as Glist ptr listtemp = g_list_first(list)
	
	dim as long iIndex
	
	while listtemp
		
		if iArray then
			
			path = cast(any ptr , listtemp->Data)
			
			iArray[iIndex] = *gtk_tree_path_get_indices(path)
			
			gtk_tree_path_free(path)
			
		EndIf	
		
		listtemp = listtemp->next
		
		iIndex +=1
		
	Wend
	
	g_list_free(list)
	
	return iIndex	
	
End Function