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

25263 Commits

Author SHA1 Message Date
António Fernandes
bb9231b6a0 window-slot: Don't access the tab view
The slot accesses the window's tab view to change the selected tab.

This is a layer violation, which is both completely unnecessary and
is getting in the way of reusing the slot widget in a tabs-less
window (such as the upcoming FileChooser window).

So, have NautilusWindow manage the selected tab directly. This is
one less NautilusWindow method being called by NautilusWindowSlot.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402
2024-06-05 11:50:09 +01:00
António Fernandes
6bd4e06faa window-slot: Rework and document grab_focus() call
We'v been relying on a gtk_widget_grab_focus() call to avoid broken
focus states after view (re)loading.

But there is one particular case where we must not do it: if the
popover menu is shown. This is a rare situation which is currently
only possible to trigger by pressing [Spacebar] while the "Show
Hidden Files" menu item has focus.

But this currently relies on the slot calling a NautilusWindow method,
which is a layer violation which is getting in the way of reusing
NautilusWindowSlot in the FileChooser window[4].

Let's use generic GTK/GDK API to assess wether the menu is shown,
and drop the NautilusWindow method.

Originally I've just removed the grab_focus() call, but came to
realize it was still needed, so let's also document my findings here.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3402
2024-06-05 11:50:09 +01:00
António Fernandes
c960cfa439 files-view: Make logic order look intentional
The selection check is done after the emission of delayed singals which
may change it, as per commit 09f4546d50.

However, nowadays we have a habit of combining declaration and
assingment into a single statement. So, during future hacking, one
might be tempted to move the assignments into the declaration lines,
effectively reverting that commit.

Let's keep declaration and assingment together but after that call,
and also add a comment to make it clear this order is intentional.
2024-06-04 23:09:54 +01:00
António Fernandes
e5e53ea2c9 window: Don't leak file 2024-06-04 22:29:20 +01:00
Martin
10d823295a Update Slovenian translation 2024-06-04 07:33:02 +00:00
Khalid Abu Shawarib
d4bc511f69 test/file-utilities-get-common-filename-prefix: Add tests
Adds tests for `nautilus_get_common_filename_prefix()`
2024-06-04 01:59:56 +00:00
Khalid Abu Shawarib
89ae1730b9 test/file-utilities-get-common-filename-prefix: Increase test level
Embed the existing tests in a new category in preperation for
adding another one.
2024-06-04 01:59:56 +00:00
António Fernandes
fceb9ee923 window: Drop actual wayland export handle
We've not been dropping handles properly, and we've been getting
warnings from gdk_wayland_toplevel_real_unexport_handle() as such.

This is because we are passing the "wayland:"-prefixed string, but
the actual wayland export handle is only the part after the colon.

Fixes a regression from commit ad865de618


(cherry picked from commit 4fc8812040)
2024-06-04 01:43:05 +00:00
José Guilherme
fa7b77fe6c window: Add Star Folder context menu entries
Add starring and unstarring actions to the pathbar context menu.

In order to disallow starring the home directory, add a new function to
the tag manager, which checks if a given directory can be starred.
2024-06-04 01:42:36 +00:00
piegames
626a04509c Floating-bar: Make background slightly darker
This improves the contrast against the background, and is consistent
with the background color of the path bar.
2024-06-03 20:28:32 +00:00
António Fernandes
16b81477b3 internal-place-file: Don't access self pointer after destruction
If the file is destroyed before the mount operation is completed,
we cancel the mount operation.

However, due to the nature of GAsyncResult, the callback is still
called in a future iteration of the main loop, when the file is
long gone. But since it's passed as callback data, we try to
cast it, with predictably bad results.

Access the file pointer only if the operation hasn't been cancelled.
2024-06-02 17:18:55 +01:00
António Fernandes
12980ee1bd files-view: Update actions immediately on selection change
In the network view, if the row is not selected, clicking the unmount
button does nothing. Indeed, the action is still disabled, despite an
elligible item being selected already.

This happens because the actions state is updated on idle along with
the context menus. This is reasonable as the context menus update can
be expensive.

However, not updating actions state imimediately is unexpected, so
let's immediately update them when selection changes.
2024-06-02 15:39:09 +00:00
António Fernandes
e4deb16def files-view: Disable a few more action on network view
The Properties dialog is useless unless locations are mounted.

Also, disable a few current location menu actions.
2024-06-02 15:39:09 +00:00
António Fernandes
37634b960b files-view: Add network view actions 2024-06-02 15:39:09 +00:00
António Fernandes
fcbfcd4c5d files-view: Omit some menu sections on Network View
These actions do not make sense on the virtual files of that view.
2024-06-02 15:39:09 +00:00
António Fernandes
6d47c4c1f3 network-view: Disable background context menu
It's useless here.
2024-06-02 15:39:09 +00:00
António Fernandes
0ff13a90f0 files-view: Add network view empty state 2024-06-02 15:39:09 +00:00
António Fernandes
3494cd79df network-cell: Show spinner while mounting/unmounting 2024-06-02 15:39:09 +00:00
António Fernandes
c674046e29 files-view: Prevent use-after-free with mount and stop
Unmount and eject are already doing this since commit 80dd8fb8ff

Let's do the same for mount and stop, and use g_autoptr() to emphasize
the callback taking ownership of the reference passed to the method.
2024-06-02 15:39:09 +00:00
António Fernandes
da79c2f3bf files-view: Update file mount info when mounted
Otherwise, nautilus_file_can_unmount() will still return FALSE for
a file which is already mounted, until the can-unmount attribute
is updated asynchronously by the file monitor.

This is needed for the next commit to be able to check whether
unmount is possible as soon as the mount operation completes.
2024-06-02 15:39:09 +00:00
António Fernandes
7e6af9d61d general: Introduce Network place
And request network view for network view directory.

Remember whether the previous view was grid or list, to preserve
per-window settings.
2024-06-02 15:39:09 +00:00
António Fernandes
d1437e9fd6 network-view: Introduce new view and cells
This is the replacement for the Other Locations.

See https://gitlab.gnome.org/GNOME/nautilus/-/issues/2785
2024-06-02 15:39:09 +00:00
António Fernandes
41b3bed264 pathbar: Add support for custom network view scheme 2024-06-02 15:39:09 +00:00
António Fernandes
a157d6d07f file: Enhance mountables and shortcuts support
We have barely been exposing to these file types since the Computer and
Network places were replaced by Other Locations.

Now that NautilusNetworkDirectory brings them back into use, we need
to account for their special status.

Both mountables and shortcuts to folders open in view, acknowledge it.
And use mountable target URI (if available) as its activation URI.
2024-06-02 15:39:09 +00:00
António Fernandes
e845387f80 view-model: Provide section sorter setter 2024-06-02 15:39:09 +00:00
António Fernandes
8ce91a54b6 recent-servers: Load on idle
GBookmarkFile doesn't provide an asynchronous loading API. Given how
GtkPlacesView has always been doing it in the main thread, I suppose
it's fine.

Still, least it cause some delays, let's do it on idle.
2024-06-02 15:39:09 +00:00
António Fernandes
b72f62f65c recent-servers: Expose functions for UI
For the purpose of these functions, there is no need to set up a file
monitor, nor for the NautilusRecentServers object at all. But they are
provided here to keep context and reuse server_list_load().

The network address bar is going to be adding servers to the list,
while the upcoming network view is going to allow to remove them.
2024-06-02 15:39:09 +00:00
António Fernandes
0a78f8cee2 network-directory: Provide recent servers
These used to be displayed in a popover attached to the address entry
in the old Other Locations view.

The new design asks for them to be provided in-line with other items
in the view.

As such, reuse and expand the recent servers code to produce GFileInfo
models for the NautilusNetworkDirectory to create new virtual files
from. Unlike the virtual files aggregated sourced from the network:///
and computer:/// GVFS backends, these virtual NautilusFiles have no
corresponding GVFS presence, and are entirely "nautilus-land" files.

Big credit goes to the people who designed the nautilus directory and
file abstractions with this in mind.
2024-06-02 15:39:09 +00:00
António Fernandes
a0a54a72dd recent-servers: New recycled object 2024-06-02 15:39:09 +00:00
António Fernandes
2e9fca4510 gtkplacesview: Format with uncrustify 2024-06-02 15:39:09 +00:00
António Fernandes
c19589fc43 gtkplacesview: Drop non-reusable code 2024-06-02 15:39:09 +00:00
António Fernandes
1906daebd8 network-address-bar: Add clear button
It had already been added once[0], later replaced by the info icon[1].

[0] 9341f64c19
[1] bb8b459407
2024-06-02 15:39:09 +00:00
António Fernandes
1d9332c6c9 network-address-bar: Use new icon
As per mockups.

Part of: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2785
2024-06-02 15:39:09 +00:00
António Fernandes
62c4a979ba network-address-bar: Recycle widgetry (step 2/2)
The new design for Network view uses an address entry bar which is
similar to the one from Other Locations view. Instead of reinventing
the wheel, let's salvage some code.

In addition to formatting the code to nautilus style, this also makes
a couple of visual changes to match the design requests.

https://gitlab.gnome.org/GNOME/nautilus/-/issues/2785
2024-06-02 15:39:09 +00:00
António Fernandes
2e59a031c1 network-address-bar: Recycle widgetry (step 1/2)
Rename file before applying changes to it, for git to preserve its
history. Otherwise it will look like the XML is new.
2024-06-02 15:39:09 +00:00
António Fernandes
7c12611bd0 gtkplacesview: Remove from build
Now that NautilusPlacesView is gone, we don't use this anymore.

But there is quite a bit of recycleable code here. So, let's take this
out of the build pipeline in order to disassemble it freely.
2024-06-02 15:39:09 +00:00
António Fernandes
6997f3a5eb general: Remove Other Locations
It's going to be replaced with a new Network view.[0]

For now this removes only the direct support in nautilus code proper.
The code imported from GtkPlacesView is kept to be recycled for a new
purpose.

[0] https://gitlab.gnome.org/GNOME/nautilus/-/issues/2785
2024-06-02 15:39:09 +00:00
António Fernandes
b85d0773a4 gtkplacessidebar: Drop unused places and options
This used to be shared with GTK, and even public GTK API, before GTK 4.

Therefore, it has optional behaviors we don't use. Drop them.
2024-06-02 15:39:09 +00:00
Martin
cbee15bd21 Update Slovenian translation 2024-06-02 05:39:26 +00:00
Khalid Abu Shawarib
13f3ec9f35 proprties: Don't scale up the image
In [1], a frame and an overlay were introduced for the redesign of the
thumbnail editor so that the new edit and clear buttons will not be
entirely inside the image frame. This was inside a GtkStack with
another a image which caused it to be scaled since the stack enforces
size homogeneity by default. This is undesirable, so disable it.

[1] 1c70bab1f0

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3422#note_2128815
2024-06-01 14:03:54 +00:00
António Fernandes
41c0c1f624 internal-place-file: Mount network:/// on ready request
The whole application freezes the first time `x-network-view:///` is
visited during a session (or after `killall gvfsd-network`).

This happens because GDaemonFile makes sync DBus calls to mount the
`network:///` location when we call `g_file_monitor_directory()`[0],
which is done by the view when the ready callback is invoked.

In order to avoid this, ensure the `network:///` location is mounted
before invoking the ready callback for the `x-network-view:///` file.

(This achieves a result which is similar to accessing `network:///`
directly, or any other location which is slow to mount: the location
is not changed until after the mount succeeds. I don't think this is
good UX, but it's an entirely different problem which is not specific
to the Network view at all.)

[0] More context on https://gitlab.gnome.org/GNOME/gvfs/-/issues/455
2024-06-01 11:57:05 +00:00
António Fernandes
f0d250d0cc network-directory: Introduce new directory subclass
This aggregates files from two sources:

* network:// for discoverable network resources
* computer:// for remote mounts and volumes

For the second case, we need to filter out local mounts and volumes.
For the time being, this is implemented by relying on the the icon
names, until a new file attribute is provided by GVFS.
2024-06-01 11:57:05 +00:00
António Fernandes
7776f13c69 internal-place-file: Introduce new file subclass
Instead of special casing the NautilusFile for the starred:/// URI,
give it a proper display name as part of a new specialized subclass.

This is prepared to handle more cases, like the upcoming Network view.
2024-06-01 11:57:05 +00:00
António Fernandes
61032380f3 file: Document vtable
Ensure no virtual method is left undefined by subclasses.
2024-06-01 11:57:05 +00:00
António Fernandes
6d47fce9c9 file: Make get_where_string() non-polymorphic
Similarly to .get_date(), addressed by the previous commit, this has
been added for the sake of NautilusTrashFile[0] for it to say it lives:

   "on the desktop"

We have no desktop anymore. NautilusSearchDirectoryFile is not on
desktop nor in any view, and it doesn't have a parent, so it doesn't
need this either.

[0] commit d23bb1b5be
2024-06-01 11:57:05 +00:00
António Fernandes
ce35cd2441 file: Make get_date() method non-polymorphic
It was born as a virtual method with 2 implementations: NautilusVfsFile
and NautilusTrashFile: commit e82bab8c49

Nowadays only the NautilusVfsFile implements it anyway, so, rather than
leaving it undefined for other subclasses it's best to move the
implementation to the parent class and drop the vfunc.

An undefined virtual method obviously can cause problems. A crash
can be reproduced through FileManager1 D-Bus method ShowItemProperties
with the parameters (["x-nautilus-search://0/"],""). We are lucky this
probably never happens under regular usage.
2024-06-01 11:57:05 +00:00
António Fernandes
c7d515942b search-directory: Create own file
There is no reason for nautilus-directory.c to include the header for
a subclass just to implement a virtual method the subclass could have
implemented itself.

So, have NautilusSearchDirectory create NautilusSearchDirectoryFile
and stop including unneeded headers in directory.c.

Also do precondition checking in the method, not the implementation.

This sets a pattern for upcoming new NautilusFile subclasses.
2024-06-01 11:57:05 +00:00
António Fernandes
3c23786c8c file: Make directory a construct property
We always call nautilus_file_set_directory() right after creating the
object, and a file is not expected to live without a directory.

Therefore, it makes sense to require the directory to be passed upon
object construction.

This is not just about adopting idiomatic GObject patterns: it's
going to become useful later for new file subclasses who will need to
know something about their parent directory upon construction.
2024-06-01 11:57:05 +00:00
Jordi Mas i Hernandez
3153252095 Update Catalan translation 2024-05-31 22:12:16 +00:00
Pawan Chitrakar
4511a7ab9b Update Nepali translation
(cherry picked from commit ea10fe4a07)
2024-05-28 16:36:45 +00:00