Commit Graph

12 Commits

Author SHA1 Message Date
Matthias Clasen
20c1fb0a0a docs: Tweak documentation for list widgets
Fix numerous cases of : vs :: for signal references,
add some more details here and there.
2020-08-03 18:43:25 -04:00
Matthias Clasen
ccb9dcc86b singleselection: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 18:04:40 -04:00
Benjamin Otte
795d3122cc selectionmodels: Add set_model() support
Now that we don't care about item types anymore, we can make the child
models settable.

We try to retain the selection, even when the model changes.
2020-07-05 02:59:21 +02:00
Benjamin Otte
5080730728 listmodels: Stop respecting item-type
Simplify all view model APIs and always return G_TYPE_OBJECT as the
item-type for every model.

It turns out nobody uses item-type anyway.

So instead of adding lots of APIs, forcing people to think about it and
trying to figure out how to handle filter or map models that modify item
types, just having an easy life is a better approach.

All the models need to be able to deal with any type of object going
through anyway.
2020-07-05 02:59:21 +02:00
Benjamin Otte
8395698090 selectionmodel: Replace query_range() with get_selection() 2020-06-26 07:13:32 +02:00
Matthias Clasen
e72c243aca singleselection: Clarify docs
Mention persistence and sorting.
2020-06-06 11:53:33 -04:00
Mohammed Sadiq
cfc44e09a0 singleselection: Fix a memory leak 2020-03-22 14:05:56 +05:30
Benjamin Otte
9f5ee77a44 singleselection: Fix model property
1. Make the model property construct-only. Allowing to change the
   model has invalid side effects.

2. Add a getter for the model property.
2019-10-15 07:17:07 +02:00
Benjamin Otte
07054ca20d singleselection: Add forgotten notify emission
Also, add docs for the model property while I'm looking at the file.
2019-03-19 08:48:22 +01:00
Benjamin Otte
07722582ef simpleselection: Improve items-changed
Make items-changed never emit 2 signals, instead, always emit only one,
potentially by extending the range reported in items-changed.

And be a lot more exhaustive about autoselect tests.
2019-02-15 06:46:04 +01:00
Benjamin Otte
1f56f5c2e9 selectionmodel: Change prototype of query_range()
1. Do not make position an inout variable
The function is meant to return a range for a given position, not modify
a position. So it makes no conceptual sense to use an inout variable.
2. Pass the selected state as an out variable
Using a boolean return value - in particular in an interface full of
boolean return values - makes the return value intuitively feel like a
success/failure return. Using an out variable clarifies the usage.
3. Allow passing every position value
Define what happens when position >= list.n_items
4. Clarify the docs about how this function should behave
In particular, mention the case from point (3)
5. Add more tests
Again, (3) needs testing.
2019-02-15 06:28:35 +01:00
Benjamin Otte
30386bbaca gtk: Add GtkSingleSelection
GtkSingleSelection is a GtkSelectionModel that allows selecting a single
item.
2019-02-10 18:43:59 -05:00