Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8a86088
Partial progress
Jan 25, 2023
ff4e93d
Partial fix 2
Jan 26, 2023
4e6e23a
Merge branch 'master' into refactor-saving
Jan 27, 2023
b381709
Partial fix 3
Jan 27, 2023
9fef13b
Cancel closing project folder if cannot close a document
Jan 27, 2023
bed16ba
Merge branch 'fix-closeproject-dataloss' into refactor-saving
Jan 27, 2023
abb5d05
First compilable version
Jan 27, 2023
9c12dec
Provide branch build from as Constant.BRANCH; show in header
Jan 28, 2023
e7fc113
Only insert branch label if will be shown; tooltip
Jan 28, 2023
3f5b533
Merge branch 'show-running-branch' into refactor-saving
Jan 28, 2023
b55cdd5
Use SaveReason
Jan 28, 2023
87373d2
Fix autosave delay; disable focus_out temporarily
Jan 29, 2023
90acad9
Rely on contents changed; inline single use function
Jan 29, 2023
d72e80f
Fix reverting
Jan 29, 2023
6827851
Fix parse symbols after save
Jan 29, 2023
d137467
Fix regression in autosave
Jan 29, 2023
7ae2e82
Reduce time uneditable, show working while saving
Jan 29, 2023
532f4fd
Fix handling external changes
Jan 29, 2023
6177b59
Revert "Cancel closing project folder if cannot close a document"
Jan 29, 2023
30bd7ad
Revert "Provide branch build from as Constant.BRANCH; show in header"
Jan 29, 2023
3740e7f
Partial fix focus out
Jan 30, 2023
728666c
Ignore focus_in_event after on hide_info_bar ()
Jan 30, 2023
3f08adc
Small cleanups, comments, avoid possible duplicate signal connection
Jan 30, 2023
df39f2c
DRY check_file_status, inline create_backup
Jan 30, 2023
aeaa9df
Move delete_backup to document manager
Jan 30, 2023
d6f9aad
Silence startup warnings
Jan 30, 2023
fcf943b
Do not call after_undoable_changes if closing; fix terminal errors
Jan 30, 2023
c8d0220
Fix cancel save as
Jan 30, 2023
81d8a98
Dont check file status while saving in progress, check after if fails
Jan 30, 2023
3d15e9a
Do not set new file before confirming writable
Jan 30, 2023
a7202ab
Propagate async saving up to MainWindow
Jan 30, 2023
d8e4976
Remove debug code
Jan 30, 2023
6badb4a
Cleanup, delint
Jan 30, 2023
1f3a009
Cleanup, reduce some scopes
Jan 31, 2023
d5bb6b3
Fix updating save content after save
Jan 31, 2023
5d9d107
Restore update saved state on quit; delint
Jan 31, 2023
c9e744d
Ensure file status checked after loading (avoid race with focus in ev…
Jan 31, 2023
ac79f66
Dont call check_file_status while working
Jan 31, 2023
e34db60
Warn when save fails
Jan 31, 2023
13cb07d
Document: Cleanup unused
Jan 31, 2023
606f783
Partial fix backups
Jan 31, 2023
cca16ee
Fix temp and backup file creation/deletion
Jan 31, 2023
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
39 changes: 19 additions & 20 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ namespace Scratch {

protected override bool delete_event (Gdk.EventAny event) {
handle_quit ();
return !check_unsaved_changes ();
return Gdk.EVENT_STOP;
}

// Set sensitive property for 'delicate' Widgets/GtkActions while
Expand Down Expand Up @@ -643,19 +643,6 @@ namespace Scratch {
document_view.close_document (doc);
}

// Check if there no unsaved changes
private bool check_unsaved_changes () {
document_view.is_closing = true;
foreach (var doc in document_view.docs) {
if (!doc.do_close (true)) {
document_view.current_document = doc;
return false;
}
}

return true;
}

// Save session information different from window state
private void restore_saved_state_extra () {
// Plugin panes size
Expand Down Expand Up @@ -708,8 +695,23 @@ namespace Scratch {

// For exit cleanup
private void handle_quit () {
document_view.save_opened_files ();
update_saved_state ();
save_all_documents.begin ((obj, res) => {
if (save_all_documents.end (res)) {
update_saved_state ();
destroy ();
}
});
}

private async bool save_all_documents () {
unowned var docs = document_view.docs;
var success = true;
var docs_copy = docs.copy ();
foreach (var doc in docs_copy) {
success = success && yield doc.do_close (true);
}

return success;
}

public void set_default_zoom () {
Expand Down Expand Up @@ -798,9 +800,6 @@ namespace Scratch {

private void action_quit () {
handle_quit ();
if (check_unsaved_changes ()) {
destroy ();
}
}

private void action_open () {
Expand Down Expand Up @@ -872,7 +871,7 @@ namespace Scratch {
if (doc.is_file_temporary == true) {
action_save_as ();
} else {
doc.save.begin (true);
doc.save.begin ();
}
}
}
Expand Down
Loading