1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-06-28 14:35:28 +00:00
Commit Graph

25263 Commits

Author SHA1 Message Date
António Fernandes
80abefd369 Skip patched-mutter shenaningans for testing purposes 2024-06-24 13:43:42 +01:00
António Fernandes
adb8aeafe9 SAVE_FILE 2024-06-24 13:27:31 +01:00
António Fernandes
e73a8e88ec FIXUP-FC 2024-06-24 13:27:31 +01:00
António Fernandes
98296d71cc filename-validator: Support NULL current-directory
There is no need to treat this as a programming error. Simply don't
validade filename without a directory.

This is going to be needed by the FileChooser in SAVE_FILE mode, if
neither the client app nor the user has set a target directory yet.
2024-06-24 13:27:31 +01:00
António Fernandes
b1d7eaf666 filename-validator: Introduce :allow-override
This property is going to be set to TRUE by the upcoming FileChooser.

If turned on, the validator will still provide feedback on duplated
names, but it will accept them nonetheless if otherwise valid. It's
up to the FileChooser to confirm the user wants to override the
existing file.
2024-06-24 13:27:31 +01:00
António Fernandes
300c8af5da filename-validator: Cache processing
Instead of using out parameters and local variables, store booleans
in the instance structure.

This is required to introduce more nuanced behaviors, like allowing
to override existing files on FileChooser dialog.
2024-06-23 19:52:28 +01:00
António Fernandes
9223d69c4d toolbar: Adapt to SAVE_FILE and SAVE_FILES modes
Both require a button for the view.new-folder action.

The formet additionally requires hiding the window close button,
because design calls for an explicit Cancel button instead.
2024-06-23 19:05:55 +01:00
António Fernandes
13902e46c2 toolbar: Drop separators
They are hidden on narrow browser windows. And wide windows end up
having whitespace when the pathbar reaches maximum width.

But on FileChooser they are always visible and cause the toolbar not
to fit the minimum width on narrow windows.

Let's just remove the separators along with the boxes packing them
with the history and view controls.
2024-06-23 19:05:55 +01:00
António Fernandes
61475a03d2 WIP-PORTAL 2024-06-23 19:05:55 +01:00
António Fernandes
040dc0d641 portal: Introduce implementation stub
From now on nautilus claims to implement the FileChooser portal.

For now it's a lie. But the next few commits will make it true.
2024-06-23 00:04:23 +01:00
António Fernandes
80130fc32a window-slot: Make :selection property reliable
Currently, it caches the view selection through bindings.

Unfortunately, this cache may get out of sync with the view, because
NautilusView:selection is a file list that's generated on-demand, and
NautilusView::notify:selection is unreliable. E.g. when the view
switches to a new location, it empties the model, which effectively
clears selection, but this is not notified as a selection change.

Making NautilusView:selection's notifications reliable is going to
require quite a bit of refactoring, so that's for another time.

Drop the binding and proxy the selection property without caching it.
2024-06-23 00:04:23 +01:00
António Fernandes
1676b73f15 view-item-filter: Introduce filter for FileChooser
Instead of reimplementing GtkFileFilter, which conveniently takes
the GVariant format from the FileChooser portal interface, let's
wrap it with a filter of our own which translates NautilusViewItem
into a dummy GFileInfo.
2024-06-23 00:04:23 +01:00
António Fernandes
b60be36d01 window-slot: Introduce :filter property
This will allow the FileChooser window to indirectly set the filter
on the view model, through an internal binding.
2024-06-23 00:04:23 +01:00
António Fernandes
9d3813bf07 view-model: Introduce :filter property
This is going to be used in the FileChooser.

Also document the internal model structure.
2024-06-23 00:04:23 +01:00
António Fernandes
3b08536895 window-slot: Import directory star/unstar actions
To make them reusable in the upcoming FileChooser window.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
2024-06-23 00:04:23 +01:00
António Fernandes
84b31ec6c3 window-slot: Import directory bookmarking action
To make them reusable in the upcoming FileChooser window.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
2024-06-23 00:04:23 +01:00
António Fernandes
f35402d5e2 toolbar: Import location entry actions
To make them reusable in the upcoming FileChooser window.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
2024-06-23 00:04:23 +01:00
António Fernandes
2a22055d92 window-slot: Import Favorites keyboard shortcut
To make it reusable in the upcoming FileChooser window.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
2024-06-23 00:04:23 +01:00
António Fernandes
077ef3c8a4 window-slot: Handle go-home shortcuts
To make them reusable in the upcoming FileChooser window.

Reuse the slot.open-location and add macro for actions with arguments.

The "win.go-home" action is preserved for the pad controller, which
doesn't support passing parameters to actions.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
2024-06-23 00:04:23 +01:00
António Fernandes
38055570b3 window-slot: Import open-location action
This will allow the network address bar to use on the upcoming
FileChooser window.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
2024-06-23 00:04:23 +01:00
António Fernandes
83d595afa3 application: Initialize service channel display
This is going to allow the upcoming FileChooser portal implementation
to attach its window as a modal dialog to client applications, even
if they use different display servers (X11 and Wayland).
2024-06-23 00:04:05 +01:00
António Fernandes
b2ff00856e general: Add xdp-gnome imported code to the build
Make it a private static library to be used in commming commits.

Contrary to upstream, we use the imported *.impl.* definitions.

For convenience (not to move a lot of meson code around), define
the HAVE_GTK_WAYLAND and HAVE_GTK_X11 in config.h instead of
compiler flags.
2024-06-23 00:04:05 +01:00
António Fernandes
90b63ac2a2 xdp-gnome/data: Import portal impl interface defs
These are copied from [xdp-desktop-portal], to avoid adding it and all
its dependencies as buildtime dependencies of our own (and to the
flatpak manifest).

[xdp-desktop-portal]: https://github.com/flatpak/xdg-desktop-portal/
2024-06-23 00:04:05 +01:00
António Fernandes
944a0a8b4f externalwindow-wayland: Use our own service channel client id
This private mutter protocol requires each client to have a unique
hard-coded enum id.

Requires mutter patch to add this enum value on that side.
2024-06-23 00:04:05 +01:00
António Fernandes
c34f16cf49 externalwindow-wayland: Ignore shadowed variable
`x11_interop` is the symbol of a global variable, but gets reused for
a local one.

We should try to keep this code in sync with xdp-desktop-porta-gnome
so, instead of chaning the symbol, ignore the compiler error.
2024-06-23 00:04:05 +01:00
António Fernandes
be9297ca9f general: Copy code from xdg-desktop-portal-gnome
This is code copied from xdg-desktop-portal-gnome repository today[0].

We need it to implement the FileChooser portal ourselves.

It's not included in the build yet, as it needs modifications first.

[0] b92a8cc5f6
2024-06-23 00:04:05 +01:00
António Fernandes
b1a31dd3e1 window-slot: Don't extract from URI on FileChooser
When asked to open the URI leading to an archive file, the slot
marks the file for extraction as soon as the view is loaded.

In FileChooser modes we wouldn't extract anyway, since activation
is handled by the slot. But it would lead to other unexpected
results, like immediately sending the file to the portal as result.

This is really a corner case but let's avoid it anyway.
2024-06-23 00:03:23 +01:00
António Fernandes
f5a5ae9511 window-slot: Handle file activation on FileChooser
The view handles activation through mime-actions.c functions, which
allow, among other things, opening files in other apps.

We don't want that in the FileChooser modes. Opening folders is okay,
but what we want to do when double-clicking a file depends on the
exact mode and the filters that apply.

Prepare to handle activation at a higher lever: the expected action
will be implemented by the upcoming NautilusFileChooser, by handling
the new NautilusWindowSlot::activate-files signal.
2024-06-23 00:03:23 +01:00
António Fernandes
210a260fc9 mime-actions: Open locations directly on slot
While the FileChooser will not want to launch files in handler apps
on activation, it still needs to activate items that open in view.

For regular folders it would be trivial, but for mountables it would
have to reimplement logic that's already present in mime-actions.c

In order to make it possible to use `nautilus_mime_activate_files()`
from the FileChooser to open items in view, we need to stop relying
a NautilusApplication method, because the upcoming FileChooser will
not be a NautilusApplication window.

Since we already pass the slot as a pointer, we can just use the slot
method directly, which produces the same effect here anyway.
2024-06-23 00:03:23 +01:00
António Fernandes
a01c4f3ce8 list-base: Disable rubberband for single selection
It's only useful for multi-selection and doesn't really work with single
selections anyway.
2024-06-23 00:03:21 +01:00
António Fernandes
df76ccad24 list-base: Disable DND on FileChooser mode
Drag and drop to move files should be suppressed, as described on
https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/250
2024-06-22 18:54:54 +00:00
António Fernandes
c6f28cbb0e files-view: Adapt context menus to mode
As designed.

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/250
2024-06-22 18:54:54 +00:00
António Fernandes
a6509d9124 files-view: Disable some actions for FileChooser
Disable 35 actions, to ensure they cannot be activated (e.g. by
keyboard) even if not found on context menus:

"paste"
"paste_accel"
"create-link"
"create-link-shortcut"
"new-folder-with-selection"
"open-with-default-application"
"open-with-other-application"
"open-current-directory-with-other-application"
"open-item-new-window"
"open-item-new-tab"
"cut"
"copy"
"create-link-in-place"
"create-link-in-place-shortcut"
"move-to"
"copy-to"
"delete-from-trash"
"star"
"unstar"
"delete-permanently-shortcut"
"delete-permanently-menu-item"
"permanent-delete-permanently-menu-item"
"remove-from-recent"
"restore-from-trash"
"paste-into"
"extract-here"
"extract-to"
"compress"
"send-email"
"console"
"current-directory-console"
"properties"
"current-directory-properties"
"run-in-terminal"
"set-as-wallpaper"

Additionally disable "new-folder" in OPEN mode, as it is still wanted
in SAVE mode.

Note: "open-scripts-folder" in theory should also be disabled, but it's
not worth the effort, as there is no shortcut, no menu item, and no harm
(it would just open a Files application window).

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3414
2024-06-22 18:54:54 +00:00
António Fernandes
6fc2fe67e9 view-model: Support single selection mode
This is going to be used in some modes by the FileChooser window.
2024-06-22 18:54:54 +00:00
António Fernandes
25f29398aa files-view: Override ::constructed()
The slot is already a construct property, so it makes sense to
complete the initialization on `constructed()` instead.

This paves the way to do rely more on the slot during construction.
2024-06-22 18:54:54 +00:00
António Fernandes
82403ad89a window-slot: Introduce :mode property
The slot and its internals are going to be reused by the upcoming
FileChooser window, as part of a FileChooser portal implementation.

However, some behaviors and UI elements are going to be different.
So, the slot needs to know on which mode to operate from the start.

There are 3 FileChooser portal methods[0]:

  - OpenFile
  - SaveFile
  - SaveFiles

But OpenFile has 2 boolean options ("directory" and "multiple) which
mean there are actually 4 modes:

  1. select single file
  2. select single folder
  3. select multiple files
  4. select multiple folders

As such, we have 6 new modes to support, in addition to the "browse"
mode (i.e., business as usual).

[0]
https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html
2024-06-22 18:54:54 +00:00
Alexandre Franke
4fd70e94a0 progress-info: harmonize spelling 2024-06-22 09:54:06 +00:00
Khalid Abu Shawarib
054ad3f049 asan: Add adw_init to suppressed functions 2024-06-21 14:21:34 +00:00
Khalid Abu Shawarib
a926372a7c gtk/placessidebar: Fix leaks
The "start-icon" property is already set with the property bind between
the bookmark and the row in the same function, and the GIcon reference
generated by calling `nautilus_bookmark_get_symbolic_icon()` is not
dropped.
2024-06-21 10:08:02 +00:00
Khalid Abu Shawarib
dcbd17359b gtk/placessidebar: Connect row object to popover map/unmap
nautilus-bookmark-list is sending changed signals in the same callstack
where the rename button is pressed, which is before the popover is
unmapped. And thus is causing the sidebar to rebuild the rows, destroying
the row before the unmap callback is called on the row.

Change the binding of the signal to the lifetime of the row instead of
binding it to the sidebar.

This fixes a crash when renaming bookmarks.
2024-06-21 10:08:02 +00:00
Khalid Abu Shawarib
8ba056abd1 gtk/placessidebar: Disconnect bookmarks signal after the sidebar is gone
This was a small oversight in [1] that causes crashes when trying to
drag and drop new bookmarks after opening a new window and closing
the old one.

[1] 26480b7017
2024-06-21 10:08:02 +00:00
Милош Поповић
d196abfe47 Update Serbian translation 2024-06-19 22:47:07 +00:00
António Fernandes
744d8599ed placessidebar: Open location directly
Instead of sending a signal for NautilusWindow to open the requested
location, send it directly. This will make it easy to reuse the sidebar
in the upcoming FileChooser dialog.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3431
2024-06-15 15:36:31 +00:00
António Fernandes
5e8615e36d window: Erase wrong comment and workaround
The commit[0] which introduced this comment aimed to fix a bug which was
caused by double-clicking a folder on the view.[1]

This change was ineffective as per later comments on that bug report,
which is not surprising because the change was wrong: this code path was
(and still is) used only for changing locations using the pathbar and
sidebar. The bug happening with double-click on the view is uses another
code path, in mime-actions.c, which has later been patched[2].

So, let's remove the wrong FIXME comment and effectively revert [0],
which, as expected, doesn't introduce any bug in my testing.

[0] 49c03251ee
[1] https://bugzilla.gnome.org/show_bug.cgi?id=756499
[2] 755c771058
2024-06-15 15:36:31 +00:00
António Fernandes
a1e5c2b494 placessidebar: Reuse NautilusOpenFlags
This enum serves the same purpose. Translating between them is useless.

This prepares to drop the ::open-location signal.
2024-06-15 15:36:31 +00:00
António Fernandes
402ae03e0b placessidebar: Show error messages directly
Instead of relying on NautilusWindow. This will allow the sidebar to
show error messages when reused in the upcoming FileChooser dialog.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3431
2024-06-15 15:36:31 +00:00
António Fernandes
d4a066da31 placessidebar: Get location directly from slot
Instead of having NautilusWindow relay the change, have the sidebar
talking directly with the window slot.

This prepares the sidebar to be reused in the upcoming FileChooser
dialog which is not going to be a NautilusWindow.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3431
2024-06-15 15:36:31 +00:00
António Fernandes
ccf81c1b0d placessidebar: Drop ::show-starred-location
The public GtkPlacesSidebar in GTK3 couldn't make assumptions about a
place that was private to nautilus, so it would emit a specific signal
instead of regular ::open-location.

Now that it's all nautilus-internal, there is no reason not to use the
regular ::open-location signal. This way NautilusWindow doesn't have
to handle the special signal, which makes the upcoming FileChooser
implementation simpler.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3431
2024-06-15 15:36:31 +00:00
António Fernandes
24d4307b61 placessidebar: Drop now-unused row type 2024-06-15 15:36:31 +00:00
António Fernandes
6636a22ffd placessidebar: Update enum symbol
Around the 3.0 release, the sidebar featured section headers and there
was a section whose header was "Computer".

We still carry that name in an enum symbol. It makes no sense nowadays
if you don't know the history. So, let's rename it to the name by
which it is informally called in current design mockups.
2024-06-15 15:36:31 +00:00