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
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.
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.
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.
In [1], global search was excluded from skipping the reloading of
the view like normal search in order for the current content of the
view to not appear in the global search for a short time until the
results were loaded. This causes global search results to flicker
for every key stroke.
Instead, make the condition more specific so that it will not
affect loading between search queries.
[1] ce47e61372
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3403
We want to use a warning icon to warn about broken bookmarks,
i.e., bookmarks whose pointed path is gone.
But for non-local files, this may just mean they are not currently
mounted or temporarily innaccessible, not necessarily broken.
So, apply the broken bookmark icon logic to native icons only.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/1430#note_2069827
The usage of goto's makes get_native_icon() unnecessarily complex and
error-prone.
Indeed, the goto's may be the reason why the commit[0] which introduced
the `nautilus_bookmark_get_xdg_type()` function as a replacement for
`nautilus_file_is_user_special_directory()` didn't remove the obsolete
checks `bookmark->file == NULL` and `xdg_type < G_USER_N_DIRECTORIES`.
Simplify and modernize `nautilus_bookmark_get_xdg_type()` as well, to
make it clear it the passed `GUserDirectory` value is always lower than
G_USER_N_DIRECTORIES, because it's the for loop condition.
[0] commit 1dcd2d816a
In the following commits we will be dropping gtkbookmarkmanager and
using nautilus-bookmark/list instead. In order to allow renaming
bookmarks we need access to set_name.
There is no need to use g_list_free_1() when we can achieve the same
result using g_list_delete_link() instead of g_list_remove_link().
There is also no need to free 1 link when it can be reinserted in
another position.
Also other style rearrangements, mixing declarations with code, etc.
This partially reverts commit [1] and [2].
We didn't need these when the sidebar lived in
GTK, but now the sidebar has come back and we should prefer
our code over the gtkbookmarkmanager.
[1] 380124b5cf.
[2] e13b3e2fcd
If "Image/Audio/Video Properties" rows aren't present, a blank space
will unnecessarily be shown at the bottom of the properties window.
To fix this, hide the AdwPreferencesGroup that contains these rows.
Some rows have title-lines=1, but it's unlikely that their
titles will get ellipsized, as they are fixed and predictable,
unlike their subtitles. So remove this property as it's
unnecessary in this case.
Since NautilusFileChangesQueue is called from multiple threads,
a simple NULL check can't prevent init from happening twice.
Use GOnce to make sure we only init once and gain some (tiny)
performance benefit over the NULL check.
Set the used hash table functions via parameters. This gives the caller
full control over enqueued item life times.
We still take a NautilsFile, which is a GObject, but that's about to
change.
Nautilus crashes if the user with a cut selection rapidly opens then closes a tab.
This is because update_cut_status_callback is called after the files view has already been finalized. GIO guarantees that our callback will always be called even if we cancel the clipboard cancellable in dispose.
Check cancellation status in update_cut_status_callback and proceed no further if cancelled.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/3434
When the user enter keystrokes to search, the first item sometimes gets deselected before being reselected.
This is due to the gtk_bitset_is_empty check in display_pending_files, which occurs before the delayed clear signals are emitted. On the first display_pending_files call after the keystroke, there may still be a non-empty selection. Since the check happens before clear is emitted, we errorneously believe there was a selection so we do not select first until display_pending_files is called again.
Move the no_selection bitset check to after we have emitted the delayed clear signal. Ensure there is at least 1 item in the model before we select the 0th index.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3420
Change the style of the floating bar so it's not tucked directly in the
corner but is a small margin from the edge so it looks less out of place
in the mobile/narrow-width view.
Use "—" as a placeholder for the "Original Folder" row/attribute
(attribute_trash_orig_path_q). Doing so, the "Original Folder" row
title won't appear centralized, which looks odd. This placeholder
is already used by the "Created On" row/attribute.
AdwStatusPage isn't meant to be used with another widgets,
as it's a page. Placing the status page inside a GtkBox
causes the page contents to not be vertically centralized.
Also, the scrolling can break, because AdwStatusPage has a
built-in GtkScrolledWindow.