Commit Graph

11 Commits

Author SHA1 Message Date
Benjamin Otte
30f09ea10b listitem: Make this a GObject
This splits GtkListItem into 2 parts:

1. GtkListItem
   This is purely a GObject with public API for developers who want to
   populate lists. There is no chance to cause conflict with GtkWidget
   properties that the list implementation assumed control over and
   defines a clear boundary.
2. GtkListItemWidget
   The widget part of the listitem. This is not only fully in control of
   the list machinery, the machinery can also use different widget
   implementations for different list widgets like I inted to for
   GtkColumnView.
2020-05-30 19:26:46 -04:00
Benjamin Otte
affd2737d5 gridview: Implement minimum row height
We only allocate a certain amount of widgets - and we don't want to run
out of them. So we make all widgets high enough for this to never
happen.
2020-05-30 19:26:46 -04:00
Benjamin Otte
7451e51619 Add GtkTreeExpander
This is a container widget that takes over all the duties of tree
expanding and collapsing.
It has to be a container so it can capture keybindings while focus is
inside the listitem.

So far, this widget does not allow interacting with it, but it shows the
expander arrow in its correct state.

Also, testlistview uses this widget now instead of implementing
expanding itself.
2020-05-30 19:26:45 -04:00
Benjamin Otte
626c525706 listview: Expose GtkListItemFactory APIs
Due to the many different ways to set factories, it makes sense to
expose them as custom objects.

This makes the actual APIs for the list widgets simpler, because they
can just have a regular "factory" property.

As a convenience function, gtk_list_view_new_with_factory() was added
to make this whole approach easy to use from C.
2020-05-30 19:26:45 -04:00
Benjamin Otte
360a728d77 tests: Add a rough form of multiselection
Just store a "filechooser::selected" attribute in the GFileInfo if
the file is meant to be selected.
2020-05-30 19:26:45 -04:00
Benjamin Otte
7c38ac1954 testlistview: Load icons async
Speeds up loading by 4x, because out of view icons aren't loaded
anymore.
2020-05-30 19:26:45 -04:00
Benjamin Otte
dbe802f685 testlistview: Port to directory list 2020-05-30 19:26:45 -04:00
Benjamin Otte
d8eec549f0 testlistview: Create widgets only once
Previously, we were recreating all widgets every time the list item was
rebound, which caused a lot of extra work every time we scrolled.

Now we keep the widgets around and only set their properties again when
the item changes.
2020-05-30 19:26:45 -04:00
Benjamin Otte
7389e704dc testlistview: Show the row number
Always show the current row. This is mostly useful for debugging, not
for beauty.
2020-05-30 19:26:45 -04:00
Benjamin Otte
e5add36a17 listview: Change how binding is done
We now don't let the functions create widgets for the item from the
listmodel, instead we hand out a GtkListItem for them to add a widget
to.

GtkListItems are created in advance and can only be filled in by the
binding code by gtk_container_add()ing a widget.
However, they are GObjects, so they can provide properties that the
binding code can make use of - either via notify signals or GBinding.
2020-05-30 19:26:45 -04:00
Benjamin Otte
c835ae2a02 listview: Make widget actually do something
The thing we're actually doing is create and maintain a widget for every
row. That's it.

Also add a testcase using this. The testcase quickly allocates too many
rows though and then becomes unresponsive though. You have been warned.
2020-05-30 19:26:44 -04:00