Nautilus uses NautilusPreviewer regardless of if we are using the
development or default profile. Now that Sushi has introduced a
nightly version, let's default the Nautilus nightly version to use
Sushi nightly when available. If NautilusPreviewerDevel is not
available then fall back to NautilusPreviewer
TIL hidden files were not allowed to be displayed on the desktop.
Unused ever since nautilus-desktop/nautilus-desktop-canvas-view.c was
removed by 74dd9c9f72
This is called for every item in the ::bind signal hanlder.
There are only 2 usages, and the only reason not to move the
definition inline is because it's too verbose and long.
In other words, it's just a shorthand, let's avoid the overhead
of a function call.
Nautilus sends updates to previewer when there's changes to the view's
selection. This works in all cases, except context switches where
the view's selection hasn't actually changed. When we are switching
tabs, although the selection for the view hasn't changed, the selection
in terms of how the user perceives it *has* changed.
I'd argue that the logic is slightly more complicated when switching
between two windows. For example two windows could be side by side,
in which case the user won't want to switch the previewer, unless
specifically selecting a new file in the other window).
Send previewer updates when switching tabs (slots)
The "Safely Remove Drive" action is currently not shown when the
volume is mounted. This is regression from the commit gtk@60d28132.
Let's show this action again even when the volume is mounted.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2550
Currently, the Format action is offered also for the MTP volumes when
they are unmounted. This is a regression from the commit ab1d3019. This
is because the `uri` variable is `NULL` for unmounted volumes. This
amoung other causes critical warnings when opening popover menu for
unmounted volumes. Let's check that the activation root is native file
instead to avoid the mention issue. This will also correctly hide the
Format action also for GPhoto2 devices that are mentioned in the original
commit, but unhandled currently.
vala bindings were removed in [1] which is causing out pipelines to
fail. We don't need them anyways, so disable the build options for
libportal and libcloudproviders.
[1] 6a9ed593d3
I've added g_steal_pointer() to clearly indicate that the callback
takes ownership. However, the same call where this pointer is stolen
also dereferences it for other 2 parameters (parent window and the
cancellable).
So, use a comment instead and pass the pointer directly without
clearing the local variable.
Fixes bug introduced by commit 24bb7b818a
While sandboxed, we should use a portal to open files with another app.
But the portal is not getting used for archive file types or any of
their subtypes. Instead, nautilus itself tries to handle them. Such is
the case for Open Document file types, which are subtypes of ZIP.
This happens because GAppInfo uses the portal only as a fallback for
when it doesn't find any handler in the sandbox. But it finds nautilus
itself inside of the sandbox, which claims to handle archives, so it
picks it.
Instead of using GAppInfo, use the new GtkFileInfo API which uses the
portal directly. Also, remove the now unused hack, because GtkFileInfo
does everything we need while running as a flatpak.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2841
Now that we are using tab-behavior, we'll be able to tab to the star
to star items in an accessible way. The current star is a GtkImage
which doesn't deal well with what are are trying to do (it doesn't
even show the focus ring). Switch to a GtkButton which automatically
will handle click and activate.
Now that we are using tab-behavior, tab will focus on the expander,
but we don't want that because we are overriding the behavior by
keeping the row focused
When we are in the view, we don't want to tab through all of the
items, we use arrow keys for that. Tabbing through the list, allows
easier accessibility to reach other controls. Use GTK_LIST_TAB_ITEM
so that we can tab between items in a column view. For examples, the
quote text in a search, or the star (in a future commit).
When files are moved into and out of a parentless directory such
as trash, it causes NautilusDirectory to emit a file_changed on
the Directory itself (because it's self-owned).
Within list-base we don't care about changes to the directory itself
so silently ignore.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2063
We assume that the item associated with the given file in file_changed
always exists. That assumption might fail, for example if renaming
"a" to ".a" and then attempting an undo operation. If the item
doesn't exist in the current model, simply fallback to add the item.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1513
NautilusFile/NautilusDirectory is not threadsafe. Nautilus crashes
when rapid fire copying files due to a regression in [1] which calls
nautilus_file_get() in a thread. When nautilus_file_get() is called
before the file exists in a NautilusDirectory, it attempts to create
the file, but that same file may already be in the process of being
created in another thread. Since the use of the NautilusFile was
simply to check if the file is a directory, use the existing is_dir()
function (which in turn calls g_file_query_file_type()) instead.
The performance differential is negligible (if any), and is not even
called from the main thread.
[1] 2b2031d4c8
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2469
We have a nice utility function for checking if a GFile is a
directory, but we don't pass the CommonJob's cancellabe. Use
the cancellable, and use the function consistently.
As described in #2968, directories are currently sorted before files in search results
if this option is enabled in preferences, leading to less relevant results being shown
first if they are directories. Intended behaviour is for this preference to be ignored
when searching. This bug was originally fixed in 9ec56a2d48,
it is caused by the directories_first check being made at init, which is before the
location has been set.
This commit moves the directories_first check to real_begin_loading in the grid view
and list view classes. This causes the directories_first preference to be ignored when
presenting search results, as expected.
Closes#2968
Currently, the `nautilus_window_slot_force_reload` function doesn't
preserve selection or position. However, there is a code that should do
it. The code is executed only when `new_content_view != NULL`, but it
is based on the `content_view` property. This seems to be a regression
caused by the commit 9806d70e. Let's fix that condition in order to
ensure that the selection and position are restored.
The `nautilus_find_existing_uri_in_hierarchy` function calls the
`g_object_unref` with a `NULL` pointer when `g_file_query_info` fails.
This leads to a crash e.g. when parent directory of the currently
opened location is removed. Let's port the code to use `g_autoptr` to
avoid that.
The pathbar automatically clear all the buttons when the current location
is marked as gone. This was needed earlier, when child folders where shown
in some cases, but this is no more needed nowadays. Let's drop that code.
When the currently opened location disappears, nautilus tries to
reopen it thanks to the commit b0e28bc1. However, the
`nautilus_window_slot_open_location_full` function doesn't begin the
location change when the old location is the same as the new one. This
is a problem because the old `NautilusFile` object is marked as gone
and thus monitoring and perhaps some other stuff won't work. Let's use
the `nautilus_window_slot_force_reload` function instead, in this case,
to ensure that the underlying `NautilusFile` is updated.
Nautilus does not display anything if the user selects "Star" as caption for
for the grid view.
This is because the star caption quark is not handled by
nautilus_file_get_string_attribute_q, which causes us to set NULL for
the caption label.
As a more definitive solution, implement the display of star emblems
for the grid view instead of relying on captions.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2842
AdwFlap has the same issues as all of our other adaptive widgetry.
In order to get rid of the issues caused by it, we need new widgetry
that can be manually used with AdwBreakpoint.
This commit ports the main window to the new AdwOverlaySplitView
widget. This widget is a simplified alternative to AdwFlap, and
for our use case it's a drop-in replacement.
AdwBreakpoint is a new utility that is part of
AdwWindow and AdwApplicationWindow. It allows for arbitrary
changes at specific breakpoints, meaning that we can move,
show, and hide widgets normally without any undefined behavior
or flickering.
AdwBreakpoint allows us to remove the GtkRevealers that we
used previously, as there's only a simple crossfade transition
between states now.
Currently, when the window is resized to its minimum width before
opening "Other Locations", the window is made larger to fit the
"Connect to Server" bar.
This behavior is generally undesirable and it's unusable on mobile.
In order to resolve this issue, implement some changes from the
mockups of the future Network location which uses a simplified bar
without the "Connect to Server" label:
https://gitlab.gnome.org/GNOME/nautilus/-/issues/2785
A few more changes were necessary:
* GtkActionBar wouldn't allocate the whole width to start-packed
children, so it's replaced with a toolbox-styled GtkBox plus a
GtkSeparator.
* GtkEntry is given a smaller minimum with. It's also given a
maximum width as per mockups-
* GtkButton is allowed to shrink, because some translations of
"Connect" might be too long to fit.
Part of https://gitlab.gnome.org/GNOME/nautilus/-/issues/2448
We trigger search after a short time interval after the user stops
typing, as a performance saving measure.
To implement that behaviour, we need to ignore text changes that
are done programatically and not by the user typing. In that case,
we don't setup the timer that triggers the search.
But in that case we also don't clear a previously set timer. Although
the previous commit has already fixed the visible effects of this bug,
the timed callback is still called, which may cause other unknown bugs.
So, let's always clear the timer when the search text changes, even
if programatically, such as when clearing the text when closing search.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2875
We've been proxying NautilusView:searching in NautilusWindowSlot,
initially as a way to avoid having NautilusToolbar call directly
into NautilusView (1c03da2b89).
However, since that very commit, we've mixed up two different things:
1. Whether the search bar should be visible.
2. Whether the view is displaying a list of search results.
While 2 implies 1, the reverse is not necessarily true, because the
user may have just clicked the search button to open search bar but
not entered any query yet, so the view hasn't changed into search.
The NautilusWindowSlot:searching property conflates both and is
faithful to none.
This confusion has resulted in a few bugs[0] involving inconsistent
UI states. Subsequent patches[1] tried to alleviate this but didn't
resolve the core of the issue.
Luckily for us, all external usage of NautilusWindowSlot:searching is
looking for only one thing: whether the search bar should be visible.
So, instead of the unreliable :searching property, we can instead use
the state of the slot.search-visible action.
[0] E.g. https://gitlab.gnome.org/GNOME/nautilus/-/issues/570 and partly https://gitlab.gnome.org/GNOME/nautilus/-/issues/2875
[1] Such as 6a9c7f3fd4
Fixes the visible part of https://gitlab.gnome.org/GNOME/nautilus/-/issues/2875
It seems weird that we are sorting when populating the model, given
we have a GtkSortModel on top of it. But there it's here to work
around a focus bug.