Skip to content

ListBox with list models  #224

@danirabbit

Description

@danirabbit

Problem

Frequently requested in Discord lately is how to work with Gtk.ListBox

Proposal

We should have a section that shows:

  • How to create a Gtk.ListBox bound to a ListModel with a CreateWidgetFunc
  • Granite style classes for lists like RICH_LIST and BOXED_LIST
  • How to sort and filter a list model
  • How to use placeholders
  • How to use header functions

I would probably do it in this order:

  1. Create a list of items and style it with rich_list and boxed_list
  2. Change the model to use a sort func
  3. Add a header func
  4. Add a search entry and connect it to a filter func. Maybe also use https://valadoc.org/gtk4/Gtk.SearchEntry.set_key_capture_widget.html while we’re here
  5. Add a placeholder for when there’s no search results

Prior Art (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions