Commit Graph

10 Commits

Author SHA1 Message Date
Matthias Clasen
dd1c0c0b22 treelistmodel: Make constructor transfer full
Make gtk_tree_list_model_new() take the root model
as first argument, and make it transfer full, for
consistency with other wrapping list constructors.

Update all callers.

Still missing here: Make the model property writable,
and allow passing NULL in the constructor.
2020-07-26 18:04:40 -04:00
Matthias Clasen
fb344e8108 Trivial typo fix 2020-06-05 17:08:43 -04:00
Matthias Clasen
d683d085c0 tree list model: Add a missing annotation
The GtkTreeListModelCreateModelFunc returns
a new reference.
2019-12-08 00:30:32 -05:00
Benjamin Otte
2c84049769 treelistmodel: Improve naming a bit
The complexity with model items vs row items is really confusing. Add to
that treelistmodel position vs child model position vs parent position,
and you're so confused, even the best naming can't help.

And once you're there, consider passthrough vs non-passthrough...
2018-09-18 08:03:03 +02:00
Benjamin Otte
29c700d1c7 listmodels: Clarify documentation for function prototypes
Fixes #1341
2018-09-18 08:02:21 +02:00
Rico Tzschichholz
f3e6d00db1 gtk: Fix some g-i annotations warnings 2018-09-17 13:00:36 +02:00
Benjamin Otte
9ffd88012d docs: Add missing TreeListModel docs 2018-09-16 19:39:39 +02:00
Benjamin Otte
d6161e09cd treelistmodel: Add more API to navigate the tree
This adds functionality from GtkTreeIter into GtkTreeListRow that allows
finding items in the model and getting their position for use in
GtkListBox.
2018-09-16 18:50:17 +02:00
Benjamin Otte
4b5fb5ec79 treelistmodel: Refactor to add GtkTreeListRow
This patch does multiple things:

1. Add a custom persistent per-row object.
2. Move all per-row API to that object. This means notifications are now
   possible.
3. Add a "passthrough" construct-only property to the TreeListModel that
   influences if the model returns these new object or passes through
   the ones from the model.

This greatly simplifies the code needed to be written for widgetry,
because one can just connect the per-row object to the expanders that
expand and collapse rows.

As an added power feature, these objects can also be passed through
further models (like filter models).

It also adds kind of a hack to Adwaita to make the test look neat.
2018-09-16 18:50:17 +02:00
Benjamin Otte
573c63973a gtk: Add GtkTreeListModel
This is a GListModel implementation with a neat API that can be used to
implement trees inside GtkListBox.
2018-09-16 18:50:17 +02:00