Add `nautilus_filename_get_extension_offset` to calculate the offset in
characters to the extension of a file name. Use it to replace and remove
`eel_filename_get_rename_region`.
Integrate `eel_str_get_common_prefix` as `nautilus_filename_get_common_prefix`
into filename utilities. Rename the unittest to reflect this.
eel-string.h is no longer needed with this change, so it is removed.
The new `nautilus_filename_get_extension` function is similar to the
previous `eel_filename_get_extension_offset` function, but differs
in some ways:
* It does not accept NULL
* It returns a pointer to \0 rather than NULL when no extension
can be found.
* It detects .tar.* extensions without needing a maintained list.
In the one place it was used, replace `nautilus_file_get_extension`
by instead calling `nautilus_filename_get_extension` on the file name.
Migrate usages of the previous eel function to use the new function
and remove the eel function from the header file (It is still used
in the .c file).
Also unittests.
The added iterating of 678836bbfc does not
work for UTF-8 strings, which file names generally are. This fixes this
by using appropriate UTF-8 functionality of GLib.
Whitespaces in file extensions are not (commonly) used, it's more
likely in cases where a whitespaces occurs after a dot, that the
dot does not indicatie an extension at all.
This change prevents such incorrect extension detections by
checking for whitespaces, and adjusts a self-check test that tested
for the previous behavior.
This makes it easy to grep for every situation we special case the trash.
Also add nautilus_is_root_for_scheme() which is going to be used more in
next commits.
Use g_string_replace over eel_str_replace_substring and
eel_str_double_underscores.
Remove the now unused eel* functions.
Bump glib version to 2.76 for g_string_free_and_steal().
The libadwaita pkg-config adds `-I/usr/include/libadwaita-1`
(or similar) to the compiler flags, which means that
#include <adwaita.h>
is sufficient, and the currently used
#include <libadwaita-1/adwaita.h>
is not necessary.
Not only is it not necessary, but it prevents nautilus from being
built with an uninstalled libadwaita build (either meson subproject
or otherwise). To fix that, remove the `libadwaita-1/` prefix.
The libadwaita test programs also only `#include <adwaita.h>`, and
according to Debian Code Search, that is the more popular version.
https://codesearch.debian.net/search?q=%23include+%3Cadwaita.h%3E&literal=1https://codesearch.debian.net/search?q=%23include+%3Clibadwaita-1%2Fadwaita.h%3E&literal=1
Now that we have AdwMessageDialog to provide a GNOME-compliant
message dialog API, we don't need the functions from eel.
This commit removes all of the functions for creating
dialogs from eel-stock-dialogs.
Meson builds out-of-tree, these ignored files will never get created in
these directories. If they do, it indicates a build configuration error
and should not be hidden.
After the GTK 4 port, some dialogs are no more modal. This is regression,
which is probably caused by the fact, that this needs to be explicitly
specified now. Let's make all the `GtkMessageDialog` dialogs modal again.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2117
The new major version of the toolkit is a requirement to fix old issues and enable future enhancements.
Update symbols and adapt logic to API changes.
Update and simplify UI definitions.
Update local copy of places sidebar and places view.
Replace dependencies with their GTK4-compatible successors.
Make a minimum changes required to build and run, with known
regressions to be fixed in future commits.
For a detailed breakup of the changes, see the 36 commits-deep
log leading to d5763facb1e5045251171ed1273dca0859f3542f.
This is the main part of https://gitlab.gnome.org/GNOME/nautilus/-/issues/276
It relies on X11-only information, such as the window position on the
screen, which is not known to the application under Wayland.
So, this was already broken.
Also, its implementation relies on GtkWindow API which is gone in GTK 4.
The new grid view has reached feature parity with the canvas, if we
ignore drag-and-drop and clipboard support (which would need to be
reimplemented in GTK 4 anyway) and performance scalability (which is
a problem of GtkFlowBox and solvable by using GtkGridView in GTK 4).
The canvas view relies on extensive custom implementation for layout,
drawing, input handling, accessibility, etc., which would be too
hard to port to in GT1K4.
Furthermore, most of its features, such as support for manual sorting,
haven't been used since the "icons on desktop" feature has been taken
out from this app. We are actually using a swiss army knife for a job
where we only need a single blade -- a simple pocketknife would do!
Therefore, we say goodbye to this seasoned veteran widget, who has
served us for 2 whole decades.
Extracts the creation of simple dialogs to a new function
that does not depend on gtk_dialog_run. It is the caller's
responsibility to obtain a response from the dialog.
Part of #1992
There are a few non-braced single-statement in the final cases, which
have gone unnoticed until detected by a recent uncrustify update.
Let's add the missing braces around single-statements even if it's the
last case.
Uncrustify changes "(*pixsrc++ * *pixdest)" to "(*pixsrc++ **pixdest)"
which is unwanted. Let's add redundant parentheses around "*pixdest" to
prevent these unwanted changes.
Empty trash widget is displaying for empty folder inside trash
instead of Empty folder widget.
`eel_uri_is_trash` only checks whether the URI starts with "trash:",
that's why it also returns true for empty folders inside trash.
Create `eel_uri_is_trash_root` to distinguish trash root (trash:///)
from empty folder inside trash (trash:///emptyfolder)
Closes https://gitlab.gnome.org/GNOME/nautilus/issues/1367
The eel_str_double_underscores and eel_str_capitalize
functions didn't have documentation.
Added importance of eel_str_double_underscores as well.
It's good practice to have documentation for functions
in the long term.
Even though more convoluted than the previous solution, this one
should last longer. Canvas item icons are now colorized by first drawing
the background to a Cairo surface and then multiplying the color values
of the original icon pixbuf and the ones from the newly created one.