Commit Graph

20 Commits

Author SHA1 Message Date
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Matthias Clasen
825ffb9422 Merge branch 'ebassi/issue-3892' into 'master'
a11y: Update the level property for tree expanders

Closes #3892

See merge request GNOME/gtk!3470
2021-06-07 18:10:12 +00:00
Matthias Clasen
eb61f0fc63 treeexpander: Use focusable where we mean it
This does not fix keyboard activation for tree expanders,
but it is more correct than using can-focus.
2021-05-23 11:20:00 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Emmanuele Bassi
8789e78796 a11y: Update the level property for tree expanders
We already have the depth of a tree expander in order to compute the
indentation.

Fixes: #3892
2021-04-22 14:40:35 +01:00
Emmanuele Bassi
b24fedda49 a11y: Update the labelled-by relation of GtkTreeExpander
Whenever we change the :child property, we need to update the
labelled-by relation.
2021-04-21 11:43:16 +01:00
Emmanuele Bassi
57cc2c4918 a11y: Set state on the GtkTreeExpander widget
Instead of setting it on its internal child.
2021-04-21 11:43:11 +01:00
Matthias Clasen
d0b1e2f7de treeexpander: Convert docs 2021-03-11 16:37:37 +00:00
Emmanuele Bassi
0c8de4e561 Fix transfer of GtkTreeExpander.get_item()
We return a full reference to the item.

Fixes: #3428
2020-12-02 19:10:13 +00:00
Emmanuele Bassi
4f12df5f1c Annotate the return type for GtkTreeExpander.get_item()
We use gpointer for C convenience, but the returned value is really a
GObject.
2020-11-17 13:54:22 +00:00
Emmanuele Bassi
0d7fcdda28 a11y: Add more accessible data to GtkTreeExpander
Document the role of the GtkTreeExpander, and the behaviour of the
expander button.

Additionally, improve the label of the expander button, by adding a
fixed "Expand" label, and setting the "labelled-by" relation to the
child of the GtkTreeExpander.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
c5dc0e2e4c a11y: Use proper role and state for tree expander image
The "expander" image is a button, and it controls the expansion of the
row, so it has a state associated to it that we must update.
2020-11-05 13:46:43 +00:00
Emmanuele Bassi
88116712f6 a11y: Use "presentation" role instead of "hidden" state
The intended use case of the "presentation" role is

| […] when an element is used to change the look of the page but does not
| have all the functional, interactive, or structural relevance implied
| by the element type, or may be used to provide for an accessible
| fallback in older browsers that do not support WAI-ARIA.

One of the examples is, literally:

| An element whose content is completely presentational (like a spacer
| image, decorative graphic, or clearing element);

Which fits perfectly for the GtkTreeExpander's "indent" builtin icon
widget.
2020-11-05 13:25:53 +00:00
Emmanuele Bassi
1dde54b872 a11y: Hide the "indent" in GtkTreeExpander
It's just padding.
2020-11-04 19:38:14 +00:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
125ea5ee4a treeexpander: Be focusable
We need to be focusable so that we can take focus
if the child doesn't.
2020-07-13 15:06:35 -04:00
Matthias Clasen
9555e611e1 treeexpander: Auto-expand during DND
When hovering over a tree expander during DND,
expand the tree after a timeout. This matches
the behavior of GtkTreeView and GtkExpander.
2020-06-19 15:26:47 -04:00
Benjamin Otte
1dbd017766 treeexpander: Implement input support
This implements all the keybindings from GtkTreeView that can be
supported.

It does not implement expand-all, because supporting that means
causing the TreeListModel to emit lots of create_model vfuncs which in
turn would cause many items-changed signal which in turn would cause
many signal handlers to run which in turn would make "expand-all" very
reentrant, and I'm uneasy about supporting that.

For the mouse, just add a click gesture to the expander icon that toggles
expanded state.
2020-05-30 19:26:45 -04:00
Benjamin Otte
d7b5966fa7 inspector: Make the recorder node list use a ListView
It's quite a bit faster now, but the code is also a bit more awkward.

Pain points:

- GtkTreeListModel cannot be created in UI files because it needs
  a CreateModelFunc.
  Using a signal for this doesn't work because autoexpand wants to
  expand the model before the signal handler is connected.

- The list item factory usage is still awkward. It's bearable here
  because the list items are very simple, but still.
2020-05-30 19:26:45 -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