GListStore offers g_list_store_find_with_equal_func() to find an element inside the list store. One parameter of that function call is GEqualFunc equal_func, which compares each element in the store with a criterion to find the desired element.
The signature for a GEqualFunc is as follows:
gboolean (* GEqualFunc) ( gconstpointer a, gconstpointer b )
Is it true that a and b must point to objects of the same type? For example, must both a and b point to a GValue? I ask because I’ve tried passing objects of different types, such as a sublcass of GObject and GINT_TO_POINTER, but I get a runtime error when the callback runs.
A GListModel implementation, such as GListStore, can only store GObject instances of the same type, which means both a and b arguments of the GEqualFunc are a pointer to a GObject, and have the same GType.
You’re not supposed to pass the pointers yourself: you are given two pointers, and it’s up to you to compare them for equality. For instance, if we assume that you created a model such as: