Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression adding folder to view (shows children until refreshed) #2239

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix regression adding folder to view
  • Loading branch information
Jeremy Wootten committed Jul 9, 2023
commit 8e413ab3a64a5932290ae8ddb9c57999246cd1a8
15 changes: 8 additions & 7 deletions libcore/Directory.vala
Original file line number Diff line number Diff line change
@@ -1074,19 +1074,20 @@ public class Files.Directory : Object {
bool already_present = false;
bool files_added = false;
Directory? first_dir = cache_lookup_parent (changes.data.from);
GLib.File? prev_loc = null;
if (first_dir != null) {
foreach (unowned var change in changes) {
unowned var loc = change.from;
// Each set or changes should refer to the same folder but check anyway
if (prev_loc == null || !loc.equal (prev_loc)) {
Files.File gof = first_dir.file_cache_find_or_insert (loc, out already_present, true);
// `change.from`` holds the location of the newly created file, not where it came from
var dir = cache_lookup_parent (change.from);
// Children of newly created folder must have null parent Files.Directory
// We expect each set of changes to refer to the same Directory
if (dir != null && dir == first_dir) {
Files.File gof = first_dir.file_cache_find_or_insert (change.from, out already_present, true);
if (!already_present) {
files_added = true;
first_dir.notify_file_added (gof, change.is_internal);
} // Else ignore files already added from duplicate event or internally

prev_loc = loc;
} else {
critical ("Unexpected parent of newly created file");
}
}