Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pygobject pygobject
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 279
    • Issues 279
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • pygobjectpygobject
  • Issues
  • #130

Closed
Open
Created Feb 07, 2017 by Bugzilla@bugzilla-migration💬Reporter

Gio.ListStore.insert_sorted() broken

Submitted by Cédric Bellegarde @gnumdk

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 Jan 11, 2018 by Christoph Reiter
Assignee
Assign to
Time tracking