summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* file: Re-use local time zone when generating date stringSebastian Keller2023-04-201-10/+17
| | | | | | | | | | Whenever g_time_zone_new_local() is called it has to check the file system for changes, because the system's time zone might have changed since the last call. This function was called multiple times for each file when generating the date string, which was causing some unnecessary overhead. This changes the code to re-use the local time zone from the first call.
* window-slot: Make ownership transfer of pending location explicitAntónio Fernandes2023-04-201-3/+1
|
* nautilusgtkplacessidebar: simplify setter logic with g_set_objectGary Li2023-04-201-5/+1
| | | | | Use g_set_object to simplify setter logic and avoid issues if current_location == location.
* application: Take reference of GFile location when cloning windowGary Li2023-04-201-0/+1
| | | | | | | | | | | | | | | | Nautilus crashes under d45b820d when we open a second window and in both windows navigate to a common new location. This is caused by incorrect reference management in action_clone_window, where neither nautilus_window_slot_get_location nor nautilus_window_slot_get_pending_location increases the ref count of the GFile location. g_autoptr would cause location to be prematurely freed. Take the reference of location to allow g_autoptr to work correctly for all branches of action_clone_window. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2858
* properties-window: use property row style for security contextPeter Eisenmann2023-04-201-6/+27
| | | | Fixes #2767
* style: Add HC outlines for list viewSam Hewitt2023-04-151-0/+11
| | | | | | | | | Grid view selections feature a border for increased visibility. Our list view lacks that because it adds custom padding, so we need to add it as a custom style. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2909
* style: Drop view item color overridesAntónio Fernandes2023-04-151-25/+0
| | | | | | | | | | | | | | We've added them because the colors assigned by the default stylesheet were not adequate as per design review: d7b03656210d5feb300d5df74db9cd4601306991 Libadwaita 1.3 updated the stylesheet to use the design-choosen colors by default in views. [0] So, we should drop our overrides which are now unnecessary and even harmful (they may be out of sync). Also, require the stable release of the dependency, because 1.3.alpha didn't include [0]. [0] https://gitlab.gnome.org/GNOME/libadwaita/-/commit/fd83834f837baeb2650c75630de10ea5cdf032f2
* search-engine-tracker: Don't try to parse NULL time stringsAntónio Fernandes2023-04-151-22/+23
| | | | | | | | | | | | TrackerCursor returns NULL if it doesn't have information on the date. https://gnome.pages.gitlab.gnome.org/tracker/docs/developer/method.SparqlCursor.get_string.html We try to parse NULL as a date string. This is obviously wrong and gets us a precondition failure warning, as it should. So, if a string is NULL, just skip it. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2160
* Revert "nautils-search-engine-tracker: Only parse non-null dates"António Fernandes2023-04-151-16/+7
| | | | | | | This reverts commit 5f1680f9df8d6a62681a878975a1cec75a328a3d. It avoids a warning from g_date_time_new_from_iso8601() by pushing the code flow into another warning. A different solution is to follow.
* files-view: Handle canceled clipboard updatePeter Eisenmann2023-04-142-7/+23
| | | | | | | | Correctly handle the cancellation of a clipboard update by checking the return value of gdk_clipboard_read_value_finish() and returning early on cancellation. Fixes: #2868
* list-view: Drop selection click workaroundCorey Berla2023-04-131-56/+0
| | | | | | | There was an issue selecting using ctrl+select which was fixed in GTK. Our workaround is now making it break. Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/5669
* files-view: Don't add non-existent filesCorey Berla2023-04-121-0/+5
| | | | | | | | | | | Under certain circumstances (i.e. moving a file), we end up adding a non-existent file. This causes selection problems because the non-existent file is selected and then removed (causing another file to be selected). I'm not sure where the root cause is (between directory-async, directory notify, etc), but lets simply not add a file that we know shouldn't be added. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2828
* list-view: Get proper backing-uri for tree expandersCorey Berla2023-04-121-0/+55
| | | | | | | | | | | | | | | When using tree expanders, we have special cases for the backing uri. In GridView or ColumnView (without expanders), the backing uri is always the current view directory. With tree expanders, the backing uri is either the parent of the currently selected item, or the currently selected item (if it is an expanded directory). The same rules apply for multiple selection if there is a common parent. This was the case in 42, and the code was dropped in 6708861ed174e2b2423df0500df9987cdaf2adc0, and as an oversight wasn't added back in when tree expanders were reintroduced. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2888
* batch-rename-dialog: fix tag intersection for zero-length deletionsGary Li2023-04-091-2/+4
| | | | | | | | | | | | | | | | | | | | Dead keys insert a provisional visual indication, which looks like a text insertion, but is actually signaled as `::delete-text`. Unlike regular emissions of `::delete-text`, here the start and end positions are exactly the same (so you know nothing is actually deleted). Nautilus deletes the neighbouring tag When a dead key is entered into the batch rename entry, it deletes the neighbouring tag. This occurs for just before, inside and just after the tag. This happens because our logic for knowing when to delete special text tags is assuming end_position > start_position, which is not the case with dead keys. Add conditions to ensure intersecting selections cannot be zero-length. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2821
* grid-cell, name-cell: Allow displaying unthemed emblemsAntónio Fernandes2023-04-082-2/+14
| | | | | | | | | | | | | | | nautilus-dropbox and probably other such extensions use emblems to indicate sync status. If these icons are installed as unthemed icons, then we don't display them at all. This is because the way we are checking that an icon exists ignores the unthemed icons completely, which is arguably a GTK bug (https://gitlab.gnome.org/GNOME/gtk/-/issues/5709) While the GTK inconsistency is not addressed, let's use a workaround to check more effectively whether an icon exits. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2789
* files-view: Disable properties shortcut for unwanted directoriesKhalid Abu Shawarib2023-04-071-1/+4
| | | | | | | | Open properties on the search directory crashes Nautilus. Exclude search, recent, and starred from opening current directory properties when no file is selected. Fixes #2903
* sidebar: Prevent auto folder opening on hover when re-ordering bookmarksSayan Bhattacharjee2023-04-071-2/+3
| | | | | | | | | | | | | | | | | In the sidebar, when dragging to re-order bookmarks, other bookmarked folders are automatically opening while hovering over them as it happens during a drag-and-drop operation. This action should not be permitted because it is inconceivable to drag-and-drop a bookmark into another bookmark. Implement a check to prevent automatically navigating into the bookmarked folders if they are hovered on while dragging a bookmark with the intent to just re-order them. It achieves this behavior by not adding a navigation hover timeout if we are dragging a row (bookmark) in the sidebar. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2820
* pathbar: do not use finalized pathbar to bind menu model to popoverGary Li2023-04-071-1/+8
| | | | | | | | | | | | | | | Nautilus fails critical assertions if the user opens then closes a new window in rapid succession in a large folder. This is because the GSource created by nautilus_path_bar_set_templates_menu to bind menu model to popover is not removed even if the pathbar has already been finalized by the user closing the window. Keep track of the source id and remove source if the pathbar is being disposed of. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2867
* grid-cell, name-cell: Have thumbnail cover allocationAntónio Fernandes2023-04-052-0/+2
| | | | | | | Otherwise, due to some modular arithmetic artifacts, there is an unsightly 1px transparent line between the picture and its css border. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2779
* window-slot: Try current location even if it is marked as goneOndrej Holy2023-04-051-7/+7
| | | | | | | | | | | | | | When the current location is marked as gone, Nautilus jumps to the first existing parent currently (except for non-native locations and mount roots). This is fine in most cases, but not for autofs locations as Nautilus jumps to parent everytime autofs mount timeouted. It would be better to stay in the same folder in this case. Let's try the current location first even if it is marked as gone to ensure that. It would be perhaps even better to prevent autofs locations somehow from timeouting at all, or avoid immediate remounting at least, but those solutions don't look easy to implement. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1514
* places-view: remove GTK translation domainsPeter Eisenmann2023-03-313-3/+3
| | | | | | | | When copying these classes from GTK the translation domain was kept. This causes issues with translations in libadwaita widgets, so remove them. Fixes #2890
* properties-window: fix execution switch behaviorPeter Eisenmann2023-03-291-2/+2
| | | | | | | | Changes in GTK (https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5442) require to use `gtk_switch_set_active` to flip a switch, otherwise it ends up in an inconsistent state. Fixes #2883
* files-view: handle no focus state gracefullyPeter Eisenmann2023-03-291-1/+2
| | | | | gtk_window_get_focus can return NULL. Passing that directly into gtk_widget_is_ancestor throws a GLib warning, so handle it explicitly.
* Add fast-content-type fallback to all placesOndrej Holy2023-03-292-2/+22
| | | | | | | | | The `G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE` attribute doesn't have to be always set. The commit 0e597803 added the `G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE` fallback inside the `NautilusFile` class, but not for other places. Let's fix this oversight. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2862
* search-hit: Remove redundant codeOndrej Holy2023-03-291-3/+0
| | | | | | | | | The `Deprecated pre-processor symbol: replace with "G_ADD_PRIVATE"` warning is shown during build currently. This is caused by the usage of the `G_TYPE_INSTANCE_GET_PRIVATE` macro. However, the statement with this macro doesn't have any effect. This looks to be an oversight in the commit 335eabec. Let's drop the whole statement to get rid of this warning.
* window: Initialize drag action for tab barOndrej Holy2023-03-291-16/+10
| | | | | | | The `‘action’ may be used uninitialized` warning is shown during build currently. It can really happen that uninitialized value is used when dropping something else then the `GDK_TYPE_FILE_LIST` and `G_TYPE_STRING` on the tab bar. Let's initialize the action to prevent this.
* pathbar: Initialize drag actionOndrej Holy2023-03-291-7/+2
| | | | | | | The `‘action’ may be used uninitialized` warning is shown during build currently. It can really happen that uninitialized value is used when dropping something else then `GDK_TYPE_FILE_LIST` on the pathbar. Let's initialize the action to prevent this.
* properties-window: Use return value from g_string_freeOndrej Holy2023-03-291-5/+1
| | | | | | | | Currently, the `ignoring return value of ‘g_string_free_and_steal’ declared with attribute ‘warn_unused_result’` warning is shown during build. This is because the `str` struct member is used instead of a return value from the `g_string_free` function. Let's update the code to use the return value in order to avoid this warning.
* Revert "list-base: Remove rubberband hack"Ondrej Holy2023-03-161-0/+29
| | | | | | | | | | | This reverts commit c1c7ccb0e23772d8cfb509eb133d7e522706c697 as it turned out that the workaround is still needed. I've only updated the obsolete comment a bit. The issue was initially fixed by the https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4831 merge request, but it has been broken later. Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/5670 Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2844
* search-engine-simple: Handle case when mime type is NULLOndrej Holy2023-03-091-1/+1
| | | | | | | | The `G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE` attribute doesn't have to be always set. This case is not handled by the `NautilusSearchEngineSimple` class and the `NULL` pointer can be passed in the `g_content_type_is_a` function currently. This is an error. Let's check the returned pointer to prevent this situation.
* Use generic helpers for obtaining file attributesOndrej Holy2023-03-094-15/+39
| | | | | | | | | | | | | | | | | | | | It is not guaranteed that all `GFileInfo` attributes are always set when requested. They used to be silently set to `NULL`, `FALSE`, or `0` earlier when they were not provided by their implementations. However, some of the helper functions now print critical errors when the attributes are not set by their implementations even though they were requested. See the https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3261 merge request for more details. So Nautilus now prints tons of critical errors when started. The unset attributes can be detected over the `g_file_info_has_attribute` function. But Nautilus doesn't care in most cases about the reason why the attribute is `NULL`, `FALSE`, or `0`. There are also more generic helper functions that don't print these critical errors. Let's use them for the attributes that may not always be set to get rid of those critical errors. I suppose that the `name`, `display_name`, `size`, `icon`, and `file_type` attributes don't need this special handling, although it is not clearly stated anywhere... Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2861
* file: Cache clock format settingCorey Berla2023-03-051-9/+20
| | | | | | | | We are already caching the preferences for thumbnailing. Since the clock format is queried for every single file when loading a list view, we should also cache the clock format setting. Rename the flag from use_24 to use_24_hour for more clarity.
* file: Don't emit files_changed in file_class_initCorey Berla2023-03-051-4/+16
| | | | | | | | | | | | | In nautilus_file_class_init, we are calling thumbnail_limit_changed_callback() and show_thumbnails_changed_callback() in order to cache the initial values for the static variables cached_thumbnail_limit and show_file_thumbs. This has the unintended side effect of also calling emit_change_signals_for_all_files_in_all_directories () which doesn't make sense at a point in time when there are no NautilusFile's and NautilusDirectory may not even be ready. Split out the updating of the setting from the emission of all files changed.
* directory: Prevent usage of uninitialized hash tableOndrej Holy2023-03-051-0/+5
| | | | | | | | | I see regularly the following debug print on Nautilus startup: `GLib-CRITICAL **: 10:52:52.992: g_hash_table_foreach: assertion 'hash_table != NULL' failed`. This is because the `emit_change_signals_for_all_files_in_all_directories` function is called before the `directories` hash table is initialzed. Let's return early to prevent usage of the uninitialized hash table.
* freedesktop-dbus: Try to own the name until after exporting skeletonOndrej Holy2023-03-041-16/+15
| | | | | | | | | | Currently, the `g_bus_own_name_on_connection` function is called for the `org.freedesktop.FileManager1` name before exporting the `/org/freedesktop/FileManager1` skeleton. This seemingly works fine in most cases, but occasionally the name is acquired too early and D-Bus clients can get `No such interface` error. This is regression caused by the commit 2293e813d3cd1cc47b2b8750f7140647aa066fc8. Let's try to own the nam until after exporting the skeleton to avoid this error.
* Revert "window-slot: Unref new location"Corey Berla2023-03-041-2/+0
| | | | | | This reverts commit d45b820d4a082287ef52f538fc001009ad5204e1. This commit causes a crash.
* Revert "window-slot: Make ownership transfer of pending location explicit"Corey Berla2023-03-041-1/+4
| | | | | | | This reverts commit 16c0a9b102e99ec7aa3c880e034d8aa7b9c5b4f7. This commit builds on commit d45b820d4a082287ef52f538fc001009ad5204e1 which causes a crash.
* file-operations: Exchange error messages used when deletingOndrej Holy2023-03-041-6/+6
| | | | | | | | There are two error messages that may be shown when the delete operation fails. One message is generic and the another one mentions insuffient permissions. However, the generic one is now shown in the case of the `G_IO_ERROR_PERMISSION_DENIED` error. Let's exchange the messages to use the second one in this case.
* list-base: Don't free calls to nautilus_view_model_get_item_from_fileCorey Berla2023-03-011-1/+1
| | | | | | | | Now that we are properly freeing all view items, it became obvious that we were incorrectly freeing a call to get_item_from_file which is just a hash table lookup. See: https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/1101
* list-base: Sort after file-changesCorey Berla2023-03-011-0/+4
| | | | | | | | | | | | | | | | | | | When renaming a file in list-view or grid-view, the renamed file keeps its position (i.e. it isn't re-positioned into the new proper position) until a refresh). There is actually a more generalized problem where file changes on all attributes fail to cause the sort positions to be updated. For example, sorting by date modified and touching a file doesn't cause a re-sort. The file-changes signal from nautilus-directory, simply gives us the changed files for a given directory, without telling us what was changed so there's not an efficient way of detecting this. We do have a ::end-file-changes signal, that is only emitted once every batch of changes, so let's call nautilus_view_model_sort() then. If no sort changes are required, this will finish quite fast, so it seems like the best alternative. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2568
* general: Change libadwaita include pathBarnabás Pőcze2023-02-1918-18/+18
| | | | | | | | | | | | | | | | | | | | | | | 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=1 https://codesearch.debian.net/search?q=%23include+%3Clibadwaita-1%2Fadwaita.h%3E&literal=1
* nautils-search-engine-tracker: Only parse non-null datesPablo Correa Gomez2023-02-191-7/+16
| | | | | | | | | | | Fix critical when parsing null date string: GLib-CRITICAL **: 12:05:52.144: g_time_val_from_iso8601: assertion 'iso_date != NULL' failed This is possible since tracker can return NULL[1] "if the column is not in the [0,#ncolumns] range" [1] https://gnome.pages.gitlab.gnome.org/tracker/docs/developer/tracker-sparql-cursor.html?gi-language=c#tracker_sparql_cursor_get_string
* file-operations: Fix inverted g_assert conditionOndrej Holy2023-02-061-1/+1
| | | | | | | | | | | The commit e2969a9c29d0d171038fcb35d8baa5a7df372191 introduced an assertion statement to ensure that the `g_file_get_basename` returned non-NULL string. Unfortunately, the assertion has an inverted condition. This leads to crashes in the `get_unique_target_file` function for files that don't have the `edit-name` attribute set (i.e just a few GVfs backends). Let's fix the inverted condition. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2825
* dnd: Fix dnd_get_preferred_action for non-local dropsCorey Berla2023-01-231-1/+7
| | | | | | | With non-local drops, when the value is initially NULL, we get warnings because of some of the checks done on a NULL value. This was a regression from 3d17ed252960cbc9848aea0b398a4a74ef05623c. Return action copy before any check dependent on a dropped value.
* dnd: Don't handle drops without urisPeter Eisenmann2023-01-234-11/+16
| | | | | | | | | | Add a check to assert nautilus_files_view_drop_proxy_received_uris is not called with an empty source uri list. Make nautilus_dnd_perform_drop return whether the drop event was actually handled. Adjust callers accordingly. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2787
* style.css: Make rubberband to have rounded cornerssunflowerskater2023-01-201-0/+4
| | | | | | This change makes the rubberband to have rounded corners, making it consistent with other elements such as buttons and text entries, which also have rounded corners.
* general: Stop leaking NautilusViewItemCorey Berla2023-01-163-6/+8
| | | | | | | | | We are still leaking NautilusViewItem in several places. Essentially every NautilusViewItem (and thus every NautilusFile) ever created is leaked. In list-base, the queue in real_add_files is freed, but not the items themselves. Make sure to also free the results of g_list_model_get_item() and our macro listitem_get_view_item which now calls gtk_tree_list_row_get_item.
* view-item: Make item_ui a weak pointerCorey Berla2023-01-161-19/+2
| | | | | | | view-item holds a reference for the cell and the cell holds a ref to the item. In order to break this cycle, let's make item_ui a weak pointer in view-item. The cell will get freed by the list factory.
* star-cell: Remove unused variableCorey Berla2023-01-161-1/+0
|
* name-cell: Don't open on hover expander icon.António Fernandes2023-01-166-10/+40
| | | | | | | | | | | | GtkTreeExpander includes a built-in "expand on drag hover" feature. But our own "open on drag hover" feature competes (and often wins) over it, making it hard to reliably expand rows on hover without opening the folder. So, separate the content and the expander. Trigger "expand on drag hover" only if over the expander, and "open on drag hover" only if over the rest.