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

Avoid appearance of short-lived temporary files in view #2221

Merged
merged 1 commit into from
Jun 28, 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
40 changes: 17 additions & 23 deletions libcore/Directory.vala
Original file line number Diff line number Diff line change
Expand Up @@ -912,28 +912,28 @@ public class Files.Directory : Object {
}
}

private void add_and_refresh (Files.File gof, bool is_internal) {
// Check whether we have FileInfo
if (!gof.ensure_query_info ()) {
critical ("FILE INFO unavailable");
// Fallback to determining hidden status from file name
gof.is_hidden = gof.basename.has_prefix (".") || gof.basename.has_prefix ("~");
} else {
// Update properties from FileInfo
gof.update ();
}

private void notify_file_added (Files.File gof, bool is_internal) {
// Do not delay adding file to model - use fallback is_hidden
gof.is_hidden = gof.basename.has_prefix (".") || gof.basename.has_prefix ("~");
if ((!gof.is_hidden || Preferences.get_default ().show_hidden_files)) {
file_added (gof, is_internal);
}

if (!gof.is_hidden && gof.is_folder ()) {
/* add to sorted_dirs */
if (sorted_dirs.find (gof) == null) {
sorted_dirs.insert_sorted (gof,
Files.File.compare_by_display_name);
query_info_async.begin (gof, null, (obj, res) => {
if (gof.info == null) {
critical ("%s FILE INFO unavailable", gof.basename);
} else {
// Update properties from FileInfo
gof.update ();
if (!gof.is_hidden && gof.is_folder ()) {
/* add to sorted_dirs */
if (sorted_dirs.find (gof) == null) {
sorted_dirs.insert_sorted (gof,
Files.File.compare_by_display_name);
}
}
}
}
});
}

private void notify_file_changed (Files.File gof) {
Expand All @@ -942,12 +942,6 @@ public class Files.Directory : Object {
});
}

private void notify_file_added (Files.File gof, bool is_internal) {
query_info_async.begin (gof, null, () => {
add_and_refresh (gof, is_internal);
});
}

private void notify_file_removed (Files.File gof) {
this.file_hash.remove (gof.location);

Expand Down