The path bar does a lot of manual management of buttons, mostly to
be able to show navigation arrows when there's not enough space to
show the full path.
Since the GTK4 migration, this is slightly broken in some cases, due
to the 'need_sliders' variable being always set to TRUE. Furthermore,
after the introduction of the Recent button as a special cased fake
root, the allocation of the buttons is generating warnings.
Reimplement the path bar as a GtkBox, inside a GtkScrolledWindow.
This mimics what Nautilus does, and allows us to make navigation more
predictable, and remove most of the complexity from GtkPathBar. It
also prevents it from generating allocation warnings.
The path bar itself now doesn't override GtkWidget.measure nor
GtkWidget.allocate; instead, it delegates layout to the GtkBinLayout
layout manager.
CSS is adjusted to account for the changed hierarchy of buttons.
It's positioned and looks exactly like the browse_toggle_view_button,
but due to the way things are organized, we cannot simply reuse that
button.
Add a clone of browse_toggle_view_button in the search entry page of
the toolbar stack. Make it toggle the same action as of the original
button, and bind the icon name and tooltip texts to it too.
Most of the pointer comparisons against 'browse_files_column_view'
should actually be performed against the current view widget. As
it turns out, it weren't that many places after all.
Add a grid view outside of the widgetry tree. The grid view mimics
the column view using bindings, so we only need to manage the column
view.
Also add a button in the path bar section to toggle the view. This
is handled as a new 'toggle-view' action in the file chooser.
The way switching between views currently work is by setting either
the column or grid view as the child of the GtkScrolledWindow. This
has the benefit of unmapping the unused view, which is nice and can
avoid some tricky situations with thumbnails.
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/233
A Drag surface does not have a parent surface. Therefore, if we initialize
it with one, it's inheriting the frame clock from the parent, but the
drag surface is not linked to the parent. Once the drag surface is destroyed,
it's disposing the frame clock, which results in a "frozen" application.
This is an extra safeguard that avoids grabbing resources longer than
nessecary. It also ensures the resource is removed from the drag,
so it is not freed again.
Notifications are not going to be emitted during the finalization, and
GObject will warn if you try to acquire and release a reference to the
notification queue when the reference count of an object has reached
zero.
Fixes: #5420
Recommend that scope implementations should fall
back to or derive from GtkBuilderCScope in order
to not lose GTK's type-guessing machinery.
Related: #5398