nautilus:wip/antoniof/filechooser-prep-part-1

Last commit made on 2024-05-20
Get this branch:
git clone -b wip/antoniof/filechooser-prep-part-1 https://git.launchpad.net/nautilus

Branch merges

Branch information

Name:
wip/antoniof/filechooser-prep-part-1
Repository:
lp:nautilus

Recent commits

13af754... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

general: Stop importing nautilus-window.h where unnecessary

90caac7... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

window-slot: Drop :window property

We need NautilusWindowSlot to be reusable in the FileChooser window.

This means it cannot assume its parent is a NautilusWindow.

For NautilusWindowSlot code, rely on gtk_widget_get_root().
For NautilusApplication we can assume a NautilusWindow ancestor.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402

ec9fa78... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

window-slot: Clean up location loading error handling

We have a whole branch of dead code under the condition that a window
is not visible. This is dead code because, as of GTK4, the :visible
property is TRUE by default; but even before that, I doubt the window
wasn't presented already before this callback.

The logic on this conditional branch is ancient[0] and employs rather
drastic measures: destroy the window if it failed to load its initial
location. At a later point[1], a special case hase been added not to
destroy the window if there is no other nautilus window. It would open
Home instead, or, failing that, the filesystem root. But if both fail,
it would still resort to destroying the window.

Not only is destroying the window unecessary, the special case of a
single application window assumes NautilusWindowSlot can only exist
inside a NautilusWindow (belonging to NautilusApplication). This is
going to be a problem for the FileChooser window, which will not be
a NautilusWindow, not belong to the NautilusApplication, but still
run in the same process.

Let's drop the dead branch. But salvage the handling of rare cases
where $HOME fails to load for some reason.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402

[0] commit 4ce7b8ead389ada57be40d1a0b7e7af9527a3950
[1] commit 06f5c771336ea78e19f14428c7ea728c9198ea3a

2676748... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

files-view: Don't assume NautilusWindow ancestor

We don't need to, for a matter of fact. `gtk_widget_get_root()` is
just as effective and is going to make it easier to reuse in the
upcoming FileChoser window.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402

e826c9c... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

previewer: Manage window handles internally

We've been expecting NautilusFilesView to pass a window handle to
nautilus_previewer_call_show_file(), requiring it to call async
methods from NautilusWindow to get them.

There are a few problems with this approach:

  1. It's a layer violation for the view to call into the window.
     Not only is this conceptually wrong, it's keeping us from
     reusing the view in other windows which are not NautilusWindow
     instances, like as the upcoming FileChooser window.
  2. It's leaking details of the NautilusPreviewer2 D-Bus API into
     NautilusFilesView and NautilusWindow, namely the expected format
     of the window handle.
  3. Even though this format is a de-facto standard nowadays, we are
     not using it for anything else, so there is no value in keeping
     it in NautilusWindow API.
  4. Even if we start using it for other purposes, there it nothing
     specific to NautilusWindow in how to generate a window handle;
     it's the same process for any toplevel surface.
  5. Tying the window handle's validity to the lifetime of the
     NautilusWindow instance means we keep it exported even if no
     longer used by the previewer, and in theory we would use the
     same handle for multiple peers.

So, have NautilusFilesView pass a generic GtkRoot pointer instead
and handle the exporting and unexporting lifetime of window handles
in the previewer glue code instead.

The NautilusWindow API, no unused, is also removed. If the need arises
in the future to reuse this export/unexport logic, we can always move
it into ui-utilities.c or something like that.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402

fa5f6ee... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

previewer: Drop ununsed XID parameter

It's been supperceeded by the window handle string, which, for X11
windows, is a concatenation of "x11:" and the XID.

2f6f16d... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

history-controls: Don't assume NautilusWindow

Middle click on back/forward buttons opens the previous/next location
in a new tab.

We want to reuse the history controls for FileChooser window, but it
will neither have tabs nor be a NautilusWindow at all.

So, make this feature conditional on the root widget being an instance
of NautilusWindow.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402

1e28526... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

pathbar: Don't call NautilusWindow nor NautilusApplication

We want to make the pathbar reusable for the FileChooser window,
which is neither going to be a NautilusWindow nor part of the
NautilusApplication instance.

But we don't really need anything from the application or window
classes which cannot be done directly with the slot class. And
the slot is going to be reused in FileChooser too.

In order to have access to the slot, expect the pathbar owner
(currently only NautilusToolbar) to set it as a property. The
FileChooser is going to be able to set the slot itself as well.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402

0e35fe8... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

toolbar: Have PathBar and LocationEntry in UI template

We have "container" boxes in the .ui file to which we add the
actual widgets in code.

I believe this was done back when we desired these UI files to
be editable in Glade, which didn't know our custom widgets.

But we no longer care about that, so let's do everything in the
UI template. This will make the next commit simpler by enabling
bindings to be declared in the UI template as well.

63084c4... by =?utf-8?q?Ant=C3=B3nio_Fernandes?= <email address hidden>

files-view: Stop getting active slot from the window

We can ask the slot directly whether it is the active one.

This removes one NautilusWindow method call from inner widgets,
which is a layer violation and gets in the way of reusing them
for the upcoming FileChooser window.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402