Gio.ListStore.insert_sorted() broken
@gnumdk
Submitted by Cédric Bellegarde Link to original bug (#778290)
Description
When using Gio.ListStore.insert_sorted() with a GLib.CompareDataFunc, liststore pass int as args to sort function instead of GObject.
GLib.CompareDataFunc(a, b, user_data) Parameters: a (object or None) – a value b (object or None) – a value to compare with user_data (object or None) – user data
Actual result: $ python liststore.py 12028736 12028768
#!/usr/bin/env python3
from gi.repository import Gio, GObject
class Item(GObject.GObject):
name = GObject.Property(type=str,
default='')
def sort(row1, row2):
print(row1, row2)
return 0
model = Gio.ListStore()
item1 = Item()
item1.set_property('name', 'plop')
item2 = Item()
item2.set_property('name', 'plop')
model.insert_sorted(item1, sort)
model.insert_sorted(item2, sort)
Edited by Christoph Reiter