Skip to content

Commit

Permalink
Merge branch 'master' into no-disambiguate-new-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
colinkiama committed Dec 17, 2023
2 parents 791efc2 + 50f50a9 commit ffb027a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/FolderManager/FolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace Scratch.FolderManager {
has_dummy = false;
}

private void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
protected virtual void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
if (source.get_basename ().has_prefix (".goutputstream")) {
return; // Ignore changes due to temp files and streams
}
Expand Down
8 changes: 8 additions & 0 deletions src/FolderManager/ProjectFolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ namespace Scratch.FolderManager {
}
}

protected override void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
if (source.equal (file.file) && event == DELETED) {
closed ();
} else {
base.on_changed (source, dest, event);
}
}

public void child_folder_changed (FolderItem folder) {
if (monitored_repo != null) {
monitored_repo.update_status_map ();
Expand Down
4 changes: 3 additions & 1 deletion src/Services/Document.vala
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ namespace Scratch.Services {
private ulong onchange_handler_id = 0; // It is used to not mark files as changed on load
private bool loaded = false;
private bool mounted = true; // Mount state of the file
private bool closing = false;
private Mount mount;
private Icon locked_icon;

Expand Down Expand Up @@ -468,6 +469,7 @@ namespace Scratch.Services {

if (ret_value) {
// Delete backup copy file
closing = true; // Stops recreating backup when trailing space stripped
delete_backup ();
doc_closed ();
}
Expand Down Expand Up @@ -1044,7 +1046,7 @@ namespace Scratch.Services {

// Backup functions
private void create_backup () {
if (!can_write ()) {
if (!can_write () || closing) {
return;
}

Expand Down

0 comments on commit ffb027a

Please sign in to comment.