Commit graph

23671 commits

Author SHA1 Message Date
Peter Eisenmann 16e3e6ddd3 eel: remove eel-glib-extensions.h
Replace the eel_boolean_bit typedef with a plain guint and remove all
includes.
2022-12-23 17:42:34 +00:00
Peter Eisenmann 10198a8174 eel: remove more unused functionality 2022-12-23 17:42:34 +00:00
Corey Berla 5d1fcf1e77 eel: Remove unused files
Usage was generally removed in 2d1deaac2d
2022-12-23 17:42:34 +00:00
António Fernandes 77cd0f94b7 list-base: Allow to tab directly out of view
Now that the views contain real widgets, Tab and Shift+Tab cycle
through every item and only allow leaving the view when at the
end or start of the list, respectively.

This is frustrating for directories with more than a handful of files.
Also, users expect to use arrow keys to cycle though items already.

So, allow to tab into and out of the view, but not inside.
2022-12-23 17:35:11 +00:00
António Fernandes fcbfb284e3 list-base: Move "cursor" when item removed
When an item is deleted, focus moves to the next item.

But if the previous item was not only focused by also selected, the
expected behavior is for the newly focused item to also become the
new selected item.

I believe this should be fixed in GtkListBase itself, but let's add
a workaround for now.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2489
... and provides a partial workaround for https://gitlab.gnome.org/GNOME/nautilus/-/issues/2489
2022-12-23 17:35:09 +00:00
Corey Berla 8f989fa39f dbus-manager: Fix another crash from invalid dbus innvocation
Passing an invalid uri to create-folder also crashes nautilus.
If the parent_file is NULL, return an error instead of crashes.
2022-12-23 16:04:21 +00:00
Corey Berla e2969a9c29 file-operation: Return early when basename is NULL
Calling g_utf8_validate() on a NULL string crashes Nautilus.  This
can occur if performing an operation on an invalid file. If
basename is NULL, there's nothing we would do anyways, so just
return early and prevent the crash.

There's a similar issue with get_unique_target_file(), but
if a bad uri was passed to this function it should fail much
earlier, so lets just add an assertion.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2376
2022-12-23 16:04:21 +00:00
António Fernandes b34ea39892 Revert "Fix crash when copying an invalid file"
This reverts commit cd081619d1
2022-12-23 16:03:57 +00:00
Aleksandar Dezelin cd081619d1 Fix crash when copying an invalid file 2022-12-23 15:58:26 +00:00
Yuri Chornoivan 2d469910a2 Update Ukrainian translation 2022-12-23 13:51:21 +00:00
António Fernandes a9337f69bc ui-utilities: Show correct media icon in unmount notification
We have been unconditionally using "media-removable-symbolic" icon,
which is currently representing a USB thumb drive.

This is obviously wrong for any other removable devices, such as
external SSD or HDDs, as well as SD cards.

Therefore, use the mount icon, which is what's shown in the sidebar.

Resolves https://gitlab.gnome.org/GNOME/nautilus/-/issues/2625
2022-12-22 20:16:50 +00:00
António Fernandes 21a6a7ed12 file: Format size in bytes with thousand separators
The separator used, if any, depends on locale.

As per user suggestion in https://discourse.gnome.org/t/size-of-file-in-bytes-in-nautilus/12757/14
2022-12-22 20:16:50 +00:00
António Fernandes 7bb42575a9 properties-window: Show FAT instead of msdos
We shouldn't be using filesystem::type, which isn't meant for UI, as
discussed in https://gitlab.gnome.org/GNOME/nautilus/-/issues/98

But a proper fix is going to take some time and possibly introduce a
new dependency (udisks2).

So, until we fix that issue, let's workaround the common outrageous
case of a FAT filesystem being captioned as "Msdos filesystem".

https://gitlab.gnome.org/GNOME/nautilus/-/issues/98
2022-12-22 20:16:50 +00:00
Corey Berla 35022a2aca list-base: Remove rubberband hack
Revert commit b4d45b3876

It's no longer necessary now that it's fixed in GTK.

See: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4831
2022-12-22 20:04:12 +00:00
António Fernandes 52ae389530 flatpak: Remove YAML manifest
It's been added expecting Builder would support it, such that we could
drop the JSON manifest. 3b8f238624

But it didn't happen so far https://gitlab.gnome.org/GNOME/gnome-builder/-/issues/520

Since then we have been maintaining both files in sync, which is a waste
of effort at best, and a risk of the product of each manifest becoming 
different, at worst.

Now that the CI uses the JSON manifest, we can just drop the YAML one.
2022-12-21 12:38:24 +00:00
António Fernandes d799c66311 ci: Prefer the json manifest
This is what Builder uses.
2022-12-21 12:33:22 +00:00
Corey Berla 9adf6760c6 list-base: Use activation uri for DnD drag
This is a regression in 43, up until the port to gtk4
we were using the activation URI.

See: 1d1488cbc9
2022-12-21 12:02:54 +00:00
Corey Berla 0c1562c906 mime-action: Don't free const string
A regression as part of d0ec3265e3 causes
a crash when g_autofree attempts to free a const string.  Call
g_strdup() on the string.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2644
2022-12-21 11:54:05 +00:00
Corey Berla 34099e94f0 file-operations: Select files after a overwriting on move/copy
After pasting and selecting "Replace" in the file conflict dialog,
the new files are not selected (or focused).  This happens because
in nautilus-files-view, we are waiting for the "add-files" signal,
which never emits because the files aren't added, they are changed.
Set the overwritten files as FALSE in the debuting_files so that
we don't incorrectly wait for "add-files".

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2669
2022-12-20 14:44:29 -08:00
Corey Berla ee5a358636 clipboard: Make Nautilus Clipboard more resilient
We are making the assumption that the clipboard data is always
correctly formatted.  Given that the "x-special/gnome-copied-files"
doesn't necessarily have a defined specification and that some
other software programs seem to be passing bad data, we need to be
more careful about the assumptions we make.

Let's add a few more checks:

1) The first line must begin with "copy" or "cut"
2) All subsequent lines must either be a valid URI or an empty string
(after stripping out '\n')
3) If there are any errors in the clipboard, return an error rather
than an empty clipboard

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2539
2022-12-20 20:44:09 +00:00
António Fernandes 962b3bfab9 window-slot: Handle archive URI as regular file if not the default handler
When nautilus is asked to handle a regular file (e.g. its URI being passed as command line argument),
we open its parent folder and select the file. But for archives, we want to extract them immediately 
instead (this is convenient when e.g. handling opening a downloaded file from the web browser).

However, we don't actually extract the archive unless we support are the default handler for that MIME type,
in which case we don't select it as a regular fiel either, which is inconsistent.

So, make sure we only handle archives specially if we actually meant to extract them.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2274
2022-12-20 17:14:07 +00:00
Aleksandr Melman 66b3a0c9a8 Update Russian translation 2022-12-20 09:34:10 +00:00
Corey Berla 34579b6059 list-base: Don't change location in a dnd when hovering over itself
It doesn't make sense to change locations onto the same folder you
are dragging from.  The easiest way to tell if we are dragging
onto the source drag is when the drag_item_action is set to 0.
This has the added benefit that drag_item_action is also set to
0 when hover over a file.  We have been calling
`nautilus_files_view_handle_hover()` unnecessarily on file destination
(which ultimately had no effect).

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2670
2022-12-20 09:00:15 +00:00
Corey Berla 3d17ed2529 dnd: Don't allow dropping an archive on itself
In `nautilus_dnd_get_preferred_action()` we check if the dropped file
and target file are equal, but only after the check if we are dropping
onto an archive.  The `g_file_equal()` check if wrapped in a
`dropped != NULL` check which turns out to be unnecessary because
we return in the very beginning when `dropped == NULL`

Move around the drop target action checks to simplify and
prevent dropping anything on itself.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2737
2022-12-20 09:00:15 +00:00
Corey Berla 1034ab5bbd list-base: Don't modify selection model's internal bitset
In real_set_selection, we call gtk_selection_model_get_selection()
to be able to efficiently update the selection (we don't care about
unselected items that we aren't going to select).  That bitset,
per the documentation, shouldn't be modified.  This bug (which made
this function effective useless) went  unnoticed because we were
setting the selection elsewhere by poking the internals of the
listbase in set_focus_item.  We don't want to do that anymore, and
this bug became apparent.

Make a copy of the bitset, and rename the existing bitsets to clarify
what we are doing.  Also, set the selection after setting the
focus just in case that ever conflicts in the future.
2022-12-20 07:27:09 +00:00
Corey Berla 26c2ab292a files-view: Remove unused variable 2022-12-20 07:27:09 +00:00
António Fernandes f9da22b630 autorun-software: Initiate libadwaita
When moving away from GtkMessageDialog, we forgot this small
program is not part of the main application. [0]

Therefore, we need to initiate libadwaita here, before using any of its widgets.

[0] a80aacdf2c
2022-12-19 22:59:44 +00:00
António Fernandes 5ef64850fa autorun-software: Keep running until response
When moving away from gtk_dialog_run() [0], we forgot this small
program is not part of the main application. So, without anything
blocking the `main()` function, it's going to quit right away, without ever drawing the dialog.

Credit goes to Will Thompson for diagnosing the issue, and GTK 
test suit for the while loop solution I've taken from there.

Closes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2209

[0] d87f5be77b
2022-12-19 22:56:08 +00:00
Will Thompson 2ae52ceb4d autorun: Do not require autorun.sh to be +x
Since 8978c6375b, `autorun.sh` (but not
`.autorun` or `autorun`) has been run via `/bin/sh`, not executed
directly. The justification in that commit was as follows

> nautilus-autorun-software: Use /bin/sh for autorun.sh execution
>
> If the autorun file is called autorun.sh it is clearly meant for
> execution through a sh processor. The benefit of using /bin/sh as the
> executable is that autorun will also work on FAT formatted media (which
> does not allow autorun.sh to have +x permission set)

However that patch was incomplete. The third argument to _check_file()
is 'must_be_executable'; if set, _check_file() will return FALSE when
the file does not have the executable bit set. It is possible to mount
FAT media in such a way that regular files get the execute bit, but this
is not the default.

As a result, if you place `autorun.sh` in the root directry of a FAT
device, Nautilus offers to run it, but w hen you take it up on that
offer it fails, claiming:

> Unable to locate the program

Complete the special handling of the autorun.sh name by not requiring it
to be executable.

See https://gitlab.gnome.org/GNOME/nautilus/-/issues/2675
2022-12-19 22:56:08 +00:00
Corey Berla a5ca1f830a general: Replace GtkStyleContext with GtkWidget functions
GtkStyleContext is deprecated in 4.10, use the corresponding
GtkWidget functions.

Also bump GTK version to use the new gtk_widget_get_color().
2022-12-19 17:53:30 +00:00
Corey Berla 53a9b828e1 doap: Update mailing-list
mailman has been moved to discourse.
2022-12-18 18:50:09 +00:00
Corey Berla 317147658b README: Add link to proper commit message format 2022-12-18 18:50:09 +00:00
Corey Berla 8870c9ed08 preferences: Remove unused start-with-location-bar
This was removed over 11 years ago in 7363013201
2022-12-16 01:57:57 +00:00
Sabri Ünal 74bab592a4 help-overlay: Remove redundant "visible" property
Widgets are visible by default on GTK4. Remove visible property
when setting to TRUE.

Source: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkwidget.c#L1275
2022-12-15 18:51:52 +00:00
Corey Berla a2ef3022b9 list-base: Fix non-local DnD in x11
We are using a workaround to get the preferred action in x11
where we check the preferred action of the drag.  This works for local
drags, but obviously not non-local drags.  The workaround is necessary
because of a bug in gtk.  Let's just default back to COPY for non-local
drags.
2022-12-15 17:45:00 +00:00
Corey Berla fede594335 window: Disconnect NautilusBookmarkList "changed" signal on window destruction
Use g_signal_connect_object to automatically disconnect the signal

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2548
2022-12-15 17:33:49 +00:00
sunflowerskater b27a8cdd35 query-editor: Add placeholder text
The search bar from the main window doesn't have a placeholder,
which the HIG generally requires.

Add the necessary placeholder.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2698
2022-12-15 17:12:29 +00:00
Corey Berla 337a1b80e7 list-base: Clear hover timeout on drop
In a wayland session, leave is emitted on a drop or cancelled drop.
In x11 that's not the case.  Explicitly clear the hover timeout
on drop.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2585
2022-12-15 11:57:21 +00:00
Yosef Or Boczko 80f065f253 Update Hebrew translation 2022-12-15 11:24:42 +00:00
Emin Tufan Çetin 5a10d65407 Update Turkish translation 2022-12-14 18:01:36 +00:00
Benjamin Otte 6d14a24b94 file-utilities: Remove unused function
In gtk3 Nautilus used to construct the uri-list.
nautilus_uri_to_native_uri() was used to ensure that apps that didn't
have gvfs access could access the dropped file.  Now gtk4 constructs
the uri-list, so a similar process is handled on the gtk side.

Related: #2632
2022-12-13 19:35:26 -10:00
Benjamin Otte 7877152917 file: Remove unused got_custom_activation_uri
The last user was NautilusLink, and that's been gone for a while.
2022-12-13 19:35:11 -10:00
Vasil Pupkin 232de5cee3 Update Belarusian translation 2022-12-13 22:34:17 +00:00
Olga Smirnova 48f3be93a3 Update Interlingue translation
(cherry picked from commit 61530d7cc2)
2022-12-13 01:29:37 +00:00
Corey Berla 01a82ab1f4 error-reporting: Pass parent window to show_dialog()
For a very long time, we've been passing NULL as the
parent window to show_dialog() for failed rename
operations.  This is in a deeply nested callback, so
rather than trying to pass the window all the way back
just get the current active window, which very likely is
the correct window given how quickly this operation will
fail.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1199
2022-12-10 16:07:04 +00:00
Bastien Nocera 5dcda946b7 flatpak: Fix build after options changes in libportal
See https://github.com/flatpak/libportal/pull/104
2022-12-10 17:04:56 +01:00
Olga Smirnova 8ff4a88178 Add Interlingue translation
(cherry picked from commit 365411e043)
2022-12-09 18:46:36 +00:00
Aleksandar Dezelin 9ae1148d54 properties-window: Capitalize multi-byte characters correctly
Pango library doesn't support specifying text-transform in utf8
codepoints. It instead uses positions in the raw string. This is why we
have problems with, for example, the Cyrillic label in the UI file
text_transform positions are specified as 0 for the start and 1 for
the end and the first Cyrillic letter consist of two bytes.

Remove attributes from the UI file and implement label text capitalization
using the function eel_str_capitalize() which does the same but in
a proper way for type_value_label and type_file_system_label.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2494
2022-12-04 18:57:49 +00:00
António Fernandes d6c1121b30 Revert "Incorrect � letter shown for file type name in Japanese and Cyrillic languages"
This reverts commit 91f7fb675e.

The commit message was broken, missing context.
2022-12-04 18:56:52 +00:00
Aleksandar Dezelin 91f7fb675e Incorrect � letter shown for file type name in Japanese and Cyrillic languages 2022-12-04 18:39:06 +00:00