ListG.insertSortedWithData

Inserts a new element into the list, using the given comparison function to determine its position.

If you are adding many new elements to a list, and the number of new elements is much larger than the length of the list, use g_list_prepend() to add the new items and sort the list afterwards with g_list_sort().

class ListG
insertSortedWithData
(
void* data
,
GCompareDataFunc func
,
void* userData
)

Parameters

data void*

the data for the new element

func GCompareDataFunc

the function to compare elements in the list. It should return a number > 0 if the first parameter comes after the second parameter in the sort order.

userData void*

user data to pass to comparison function

Return Value

Type: ListG

the (possibly changed) start of the #GList

Meta

Since

2.10