Commit graph

24060 commits

Author SHA1 Message Date
Corey Berla 3970705d15 previewer: Enable use of NautilusPreviewerDevel
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
2023-07-01 21:40:51 +00:00
Corey Berla ad104f7490 previewer: Don't block application initialization
And add a cancellable just in case.

While we are at it, stop using the name "v2" since NautilusPreviewer2
is assumed to be used.
2023-07-01 21:40:51 +00:00
António Fernandes 862e25e449 files-view: Remove externally unused prototypes from header
Some of them are not even defined anymore.

nautilus_files_view_get_loading() is kept just in case, because it's a
property getter.
2023-07-01 16:54:41 +01:00
António Fernandes 5794939e28 files-view: Remove more dead desktop view code
It didn't support zoom either. That one is not news to me.

Unused ever since nautilus-desktop/nautilus-desktop-canvas-view.c was
removed by 74dd9c9f72
2023-07-01 16:54:41 +01:00
António Fernandes 4fb66da764 files-view: Remove dead desktop window code
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
2023-07-01 16:54:41 +01:00
António Fernandes 54352220cc view-model: Implement GtkSectionModel
Pass through from the sort model.

This is not used yet but it's best to be prepared for future uses.
2023-07-01 16:54:41 +01:00
António Fernandes 4f429492ac list-view, grid-view: Turn small function into macro
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.
2023-07-01 16:54:40 +01:00
Sergej A 9f875d6815 Update Russian translation 2023-06-30 12:21:08 +00:00
Corey Berla 57955047dd files-view: Update NautilusPreviewer on slot changed
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)
2023-06-27 20:05:42 -07:00
Ondrej Holy 57ca4a7a5e placessidebar: Always show action to stop drive when available
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
2023-06-27 19:31:00 +00:00
Ondrej Holy dde4ec1883 sidebar: Hide format for unmounted MTP/GPhoto2 volumes
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.
2023-06-27 19:02:51 +00:00
Corey Berla 5331a63250 flatpak: Build without vala bindings
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
2023-06-27 09:17:36 -07:00
Ondrej Holy ed6c79ecfa sidebar: Make cloudproviders dependency optional again
This partially reverts commit 673e6b157a.
It turns out that the cloudproviders dependency is not desired for RHEL.
2023-06-22 16:04:20 +00:00
António Fernandes 9154c3f53d mime-actions: Don't crash on sandboxed launch
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
2023-06-22 15:53:36 +01:00
Khalid Abu Shawarib 7c760d4bf9 placessidebar: Don't refresh when there's selection 2023-06-19 09:59:04 +00:00
abu_shawarib a9e3ee88dd query-editor: Select All text when using search shortcut
Change the `focus-search` action behavior to select all text when
a search refocusing action occurs so it's easier to type a new query.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2819
2023-06-19 09:34:36 +00:00
Khalid Al Waleed Abu Shawarib eedb347e1b window-slot: Change search shortcut to not close search slot
Change search shortcut to a new `focus-search` action to always
refocus on search bar instead of closing it if it's already open.

Partially fixes for https://gitlab.gnome.org/GNOME/nautilus/-/issues/2819
2023-06-19 09:34:36 +00:00
António Fernandes 4c8d18f752 mime-actions: Cleanup includes
Header has no use for i18n functions, but place-view.c was incorrectly
relying on this indirect inclusion.
2023-06-18 16:39:20 +00:00
António Fernandes aee8edbc42 files-view: Use portal to "Open With" while sandboxed
The regular app chooser is useless when we run as flatpak, because we
don't see any app from outside the sandbox.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/282
2023-06-18 16:39:20 +00:00
António Fernandes 16966c4ef4 mime-actions: Don't even try to guess handler app if flatpaked
Usually we find nothing anyway, worst case we find the wrong app.
2023-06-18 16:39:20 +00:00
António Fernandes a5112a17c8 mime-actions: Refactor and document flatpak activation
It makes more sense to take the file off the queue launching it.
2023-06-18 16:39:20 +00:00
António Fernandes 24bb7b818a mime-action: Use GtkFileLauncher
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
2023-06-18 16:39:20 +00:00
António Fernandes ab1d323f1d mime-actions: Drop redundact struct
It contains a queue and the parent structure it steals the queue from.

So, it's simpler to use the parent structure directly instead.
2023-06-18 16:39:20 +00:00
Sveinn í Felli ed6f1397b6 Update Icelandic translation
(cherry picked from commit f898c18932)
2023-06-18 09:30:15 +00:00
Corey Berla 0403537441 star-cell: Make star focusable in list view
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.
2023-06-17 23:32:10 +01:00
Corey Berla 7b0fdbacb4 name-cell: Make the tree expander not focusable
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
2023-06-17 21:46:51 +01:00
Corey Berla 99f49cbedc view: Use tab-behavior API
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).
2023-06-17 21:46:51 +01:00
Corey Berla 61f96c8a2e Revert "list-base: Allow to tab directly out of view"
This workaround isn't necessary anymore with the new
tab-behavior api

This reverts commit 77cd0f94b7.
2023-06-17 21:46:51 +01:00
Corey Berla 793eb904f4 build: Bump gtk 2023-06-17 21:46:44 +01:00
Corey Berla b51a9ceb8e list-base: Ignore changes to directory itself in file_changed
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
2023-06-17 21:23:16 +01:00
Corey Berla 90a9ac049e list-base: Fallback to add_files in file_changed
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
2023-06-17 21:15:10 +01:00
Corey Berla 396c1e8c97 file-operations: Limit use of NautilusFile's in threads
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
2023-06-16 16:58:16 +00:00
Corey Berla 06620f634e file-operations: Use cancellable in is_dir()
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.
2023-06-16 16:58:16 +00:00
Eric Daigle de4e23ce43 grid-view, list-view: don't sort directories before files in search results
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
2023-06-14 20:41:38 -07:00
Ondrej Holy a2e596c129 window-slot: Fix conditions to restore selection when reloading
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.
2023-06-14 11:53:17 +00:00
Ondrej Holy e03d731e3d file-utilities: Prevent passing NULL to g_object_unref
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.
2023-06-14 11:53:17 +00:00
Ondrej Holy 506907b164 pathbar: Do nothing when current location disappears
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.
2023-06-14 11:53:17 +00:00
Ondrej Holy f68481d2d8 window-slot: Force reload current location when it reappears
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.
2023-06-14 11:53:17 +00:00
abu_shawarib 4db576ddca column-chooser: Fix name leak
Fix name leak caused by g_strv_builder_add not consuming
char pointer.
2023-06-12 18:48:22 +00:00
abu_shawarib 13dc63b61f general: Fixes miscellaneous leaks
Fixes miscellaneous leaks in different files
2023-06-12 18:48:22 +00:00
Gary Li ae03538770 preferences-window: remove star caption option
As part of the changes to implement star emblems, remove the option to
select star captions from the combo row.
2023-06-09 17:19:12 -04:00
Gary Li 0c4a01b5e0 grid-cell: implement star emblems
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
2023-06-09 17:19:08 -04:00
Christopher Davis f73a54daf8 window: Use AdwOverlaySplitView instead of AdwFlap
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.
2023-06-09 19:33:09 +00:00
Christopher Davis 40e86b53d2 ui: Use AdwBreakpoint to manage adaptive UI
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.
2023-06-09 19:33:09 +00:00
António Fernandes 24e274a8df gtkplacesview: Allow smaller width
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
2023-06-09 20:15:12 +01:00
António Fernandes 5afc468e48 query-editor: Don't trigger search once cleared
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
2023-06-09 00:19:20 +01:00
António Fernandes e365765055 window-slot: Use search-visible state as a property
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
2023-06-09 00:19:20 +01:00
António Fernandes d72d35abaf toolbar: Use expression to sync toggle button
Instead of adding a lot of boilerplate.

This effectively almost completely reverts commit 6a9c7f3fd4.
2023-06-09 00:19:20 +01:00
António Fernandes 0ff4bd4d9c view-model: Rename lookup methods
The "get_x_from_y" partern keeps fooling me into thinking it returns
a full reference. I think "find" conveys better that's not the case.
2023-06-08 18:42:36 +00:00
António Fernandes cb54a126b8 view-model: Add comment to justify sorting
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.
2023-06-08 18:42:36 +00:00