Commit graph

24476 commits

Author SHA1 Message Date
Peter Eisenmann ba8a8fd373 general: remove eel-debug
Oversight from https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/1319
where this was forgotten.
2023-11-16 01:25:18 +00:00
Peter Eisenmann f542b7fc84 file: simplify get_volume_name and fix leak
`g_mount_get_name` returns a freeable string, so there is no need to
duplicate it. Also use g_autoptr to simplify the function.
2023-11-13 20:17:36 +00:00
Peter Eisenmann f17fd617fb file: remove unused description
According to António's research, `standard::description` is only set by
evolution for sending attachments, which is not relevant for actual file
browsing. Thus, remove the description of `NautilusFile`.

For context, this was introduced in f78a979958
2023-11-13 20:17:36 +00:00
Peter Eisenmann 9848225a26 file: no additional referencing for self-owned files
`nautilus_file_get_location` is called in many code pieces. This saves
one reference/dereference operation for all self-owned files.
2023-11-13 20:17:36 +00:00
Peter Eisenmann eada641e09 file: make get_metadata return const string
To avoid needless string copies, make nautilus_file_get_metadata return
a const char* rather then a string copy that has to be freed. Adjust
usages accordingly.
2023-11-13 20:17:36 +00:00
Peter Eisenmann aa2f68efbe file: remove unused filesystem_type
This has been introduced by bfd9ccf6 back when we used it to match
a hardcoded list of remote types, to know whether the file was remote.
It's been unused since f0759d6fe9.
2023-11-13 20:17:36 +00:00
Peter Eisenmann 76a3b86749 file: make get_filesystem_id return const string
To avoid needless string copies, make nautilus_file_get_filesystem_id
return a const char* rather then a string copy that has to be freed.
Adjust usages accordingly.
2023-11-13 20:17:36 +00:00
Peter Eisenmann 822013ea3a file: make get_thumbnail_path return const string
To avoid needless string copies, make nautilus_file_get_thumbnail_path
return a const char* rather then a string copy that has to be freed.
Adjust usage accordingly.
2023-11-13 20:17:36 +00:00
Peter Eisenmann 79ab5c8808 file: make get_edit_name return const string
To avoid needless string copies, make nautilus_file_get_edit_name return
a const char* rather then a string copy that has to be freed. Adjust
usage accordingly.
2023-11-13 20:17:36 +00:00
Peter Eisenmann eb75ddad9a file: make get_name return const string
To avoid needless string copies, make nautilus_file_get_name return a
const char* rather then a string copy that has to be freed. Adjust usage
accordingly.
2023-11-13 20:17:36 +00:00
Peter Eisenmann 0891a1e534 file: make get_mime_type return const string
To avoid needless string copies, make nautilus_file_get_mime_type return
a const char* rather then a string copy that has to be freed. Adjust
usage accordingly, especially keep copy for extensions interface.
2023-11-13 20:17:36 +00:00
Peter Eisenmann 72940753c9 file: Simplify some methods 2023-11-13 20:17:36 +00:00
Peter Eisenmann d58ec647b2 file: Simplify interface methods 2023-11-13 20:17:36 +00:00
António Fernandes 9d3785fa2b file: Call instance methods in interface methods
Instead of using the NautilusFileInfo interface  methods in normal
NautilusFile methods, swap the usage, making the interface methods use
NautilusFile methods. This saves doing unnecessary round trips for all
calls that are not made by extensions, so essentially all of them.

Amended by António Fernandes <antoniof@gnome.org> to make diff simpler.
2023-11-13 20:17:36 +00:00
Peter Eisenmann fdbef81b5f ci: fix leak suppression path
The leak suppression path needs to be absolute, so prefix it with
$CI_PROJECT_DIR. Also, fix the suppression file's file name.
2023-11-13 00:54:09 +01:00
Peter Eisenmann 81a375e668 general: always initalize g_autofree
In two occurences g_autofree values were not initialized directly. This
makes sure they are initialized, so no usage before initalization can
happen.
2023-11-12 23:54:03 +01:00
Peter Eisenmann e7031cde54 general: fix uncrustify stylecheck errors
The latest version of uncrustify complains about these indentions, so
adjust them to match our code style.
2023-11-12 23:50:22 +01:00
Peter Eisenmann ec0291d371 Revert "flatpak manifest: Pin tracker-miners"
The concerns of an unstable tracker-sparql version not being
available in the SDK no longer apply. Thus, revert commit
8d1b02c125.
2023-11-12 23:43:41 +01:00
Khalid Abu Shawarib b2efafc124 ci: Add experimental Address Sanitizer analysis
Run the tests after compiling with the address sanitizer.
2023-11-12 21:57:38 +00:00
Khalid Abu Shawarib 1b6ceace2b gitlab/Dockerfile: Skip building tests and examples 2023-11-12 21:57:38 +00:00
Sabri Ünal 2c25c0ba63 Update Turkish translation 2023-11-12 06:45:39 +00:00
Khalid Abu Shawarib e253a639d9 extensions/image-properties: Remove unnecessary code 2023-11-08 00:59:11 +03:00
Khalid Abu Shawarib 33667b8994 extensions/image-properties: Cleanup cancellation properly
Free the resources left over in the case of a cancellation which
was handeled in the previous commit.
2023-11-08 00:56:31 +03:00
Khalid Abu Shawarib 7b13e541fd extensions/image-properties: Handle cancellation properly
Calling refresh_extension_model_pages() might cancel a pending
IO operation and free the ImagesPropertiesModel. Bailout after
being cancelled instead of using a freed data.
2023-11-08 00:56:21 +03:00
António Fernandes 8d1b02c125 flatpak manifest: Pin tracker-miners
It has recently started to depend on unstable version of tracker-sparql
e02ecb3171

In due time, that should be available in the SDK, but we are moving to fast to wait for that, so let's unblock our CI pipeline.
2023-11-06 13:24:30 +00:00
Khalid Abu Shawarib 789fbeac5b files-view: Port select by pattern dialog to AdwWindow
Port the deprecated GtkDialog to AdwWindow.
2023-11-05 10:32:19 +00:00
Khalid Abu Shawarib 07031db490 properties-window: Port permissions dialog to AdwWindow
Port the deprected GtkDialog to AdwWindow. Also connect the
shortcust to the cleanup function.
2023-11-05 10:32:19 +00:00
Khalid Abu Shawarib 3e65bb444b batch-rename-dialog: Port to AdwWindow
Port the deprected GtkDialog to AdwWindow.
2023-11-05 10:32:19 +00:00
Ngọc Quân Trần 0b87de6d27 Update Vietnamese translation
(cherry picked from commit 87e7362484)
2023-11-05 01:46:05 +00:00
António Fernandes cbb809d9ef gtksidebarrow: Disconnect from ::changed when unref'ing file
Also set self as call_when_ready data not to have rows stepping on
each other's callbacks.
2023-11-05 00:18:00 +00:00
António Fernandes 1132868b7b gtksidebarrow: Don't keep ref to gone file
The row holds a NautilusFile instance to cache information needed for
Properties dialog and DND. [0]

But not listening for changes means we never release the reference when
the file is marked as gone. This naturally leads to bugs.

Listen "changed", clear when gone, and reconnect on-demand, but even
then protect against ref'ing a gone file (which shouldn't happen but
still does for self-owned files).

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2922

[0] dc2711bd74
2023-11-04 15:08:03 +00:00
António Fernandes 340507b25a Revert "properties: Use cache nautilus file when opening from sidebar"
This reverts commit 5d371babaf.

The result is the same, because `nautilus_file_get_by_uri()` would just
return a new reference to the already existing file.

Reverting because, with the next commit, we should not be relying on
the file to be set on the row.
2023-11-04 12:38:04 +00:00
António Fernandes 8ec1244c3e file: Drop deep ref/unref wrappers
Their names are misleading: the list itself is not refcounted.

This misconception is likely how some memory leaks have been
introduced in nautilus_restore_files_from_trash() and in
properties_cb(). Both leaks are therefore fixed as part of
this commit by employing autocleanup in the first case and
stack allocation in the second case.
2023-11-01 13:13:04 +00:00
António Fernandes 167f1b2c92 file-utilities: Drop uri parser
GLib has got equivalent function since 2.66.
2023-11-01 13:13:04 +00:00
António Fernandes 8095f3d114 filename-utilities: Mark passed string arrays as const
The functions are going to read but not modify them.
2023-11-01 13:13:04 +00:00
Peter Eisenmann fcdf56173b filename-utilities: Improve get_common_prefix()
Restructure function by inlining pairwise string comparisons and using
strings directly from array, removing the need to do any string
duplications. Also reduce the amount of string length calculations.
2023-11-01 13:13:02 +00:00
António Fernandes b806b4edbb file-utilities: Use string arrays, not linked lists
We don't sort or insert in the middle, linked lists gain us nothing.

Arrays offer better cache locality and even shorter code.
2023-11-01 13:05:40 +00:00
António Fernandes 9046d0bee0 file-utilities: Avoid manual freeing on early returns
It's too easy to forget to add them if adding more early returns in
the future.

Autocleanup was made for this. It also removes the need to store the
return value in a variable.
2023-11-01 13:00:15 +00:00
Khalid Abu Shawarib 8abe97c031 general: Use prettier cleanup functions 2023-11-01 00:13:42 +00:00
Khalid Abu Shawarib ee00f7c2f3 general: Fix Leaks 2023-11-01 00:13:42 +00:00
Peter Eisenmann 816161e338 application: cleanup modules on finalizing
Explicitly clear modules from NautilusApplication, so they don't need
cleanup through the eel shutdown mechanism.
2023-11-01 00:56:27 +01:00
Peter Eisenmann f7de177a11 application: clear trash monitor on finalizing
Explicitly clear the trash monitor from NautilusApplication, so it does
not need cleanup through the eel shutdown mechanism.

Also inline the static trash monitor into the get function, as that is
now its only usage.
2023-11-01 00:56:27 +01:00
Peter Eisenmann adf0e888ef main: remove custom stop-on-warning debug option
GLib offers this functionality by setting `G_DEBUG=fatal-warnings`, so
there is no need for a custom solution.
2023-11-01 00:56:27 +01:00
Peter Eisenmann 41bdc977d2 general: remove nautilus-debug
With the preceeding commits, nautilus-debug is now longer needed.
2023-11-01 00:56:27 +01:00
Peter Eisenmann 3c8abd0d8f general: use file_list_debug() over DEBUG_FILES()
Add nautilus_file_list_debug() to debug print a list of file uris.
Use this as a replacement for DEBUG_FILES(), so that these messages too
can be seen by setting G_MESSAGES_DEBUG accordingly.
2023-11-01 00:56:27 +01:00
Peter Eisenmann 587729af2f general: use G_LOG_DOMAIN and g_debug() over DEBUG()
Define respective GLib log domains per file for debug logging and remove
the custom DEBUG solution. Remove the unused nautilus-debug functions.

Fixes #1220
2023-11-01 00:56:27 +01:00
Peter Eisenmann 2aeb0dd80d file-private: expose new_from_filename()
To not need to include a .c file in test-file-utilities, expose
nautilus_file_new_from_filename in nautilus-file-private.h and adjust
the includes accordingly.
2023-11-01 00:56:27 +01:00
Peter Eisenmann 8c21a037fc general: remove self-checking functionality
All self-checking tests were converted into unittests. Remove the
"--check" parameter along with all code related to self-checking.
2023-10-31 22:19:46 +00:00
Peter Eisenmann d96d968ee2 build: sort tests alphabetically 2023-10-31 22:19:46 +00:00
Peter Eisenmann 095664a420 filename-util: integrate common prefix detection
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.
2023-10-31 22:19:46 +00:00