[geany/geany] 9a0252: Don't set document text as changed when file on disk is newer

Nick Treleaven git-noreply at xxxxx
Wed Sep 24 11:08:24 UTC 2014


Branch:      refs/heads/master
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Wed, 24 Sep 2014 11:08:24 UTC
Commit:      9a02525d1c27bd3a5256162940916ccebb5e619a
             https://github.com/geany/geany/commit/9a02525d1c27bd3a5256162940916ccebb5e619a

Log Message:
-----------
Don't set document text as changed when file on disk is newer

Setting the document text as changed makes it too easy to accidentally
overwrite the file - e.g. when closing you're reminded to save it.
It also makes it slower to close documents you no longer want open.
Setting text as changed is still done if the user cancels the warning.


Modified Paths:
--------------
    src/document.c

Modified: src/document.c
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -3269,7 +3269,9 @@ static void on_monitor_reload_file_response(GtkWidget *bar, gint response_id, Ge
 	if (response_id == RESPONSE_DOCUMENT_RELOAD)
 		document_reload_file(doc, doc->encoding);
 	else if (response_id == RESPONSE_DOCUMENT_SAVE)
-		document_save_file(doc, FALSE);
+		document_save_file(doc, TRUE);
+	else if (response_id == GTK_RESPONSE_CANCEL)
+		document_set_text_changed(doc, TRUE);
 }
 
 
@@ -3327,7 +3329,6 @@ static void monitor_reload_file(GeanyDocument *doc)
 				_("The file '%s' on the disk is more recent than the current buffer."),
 				base_name);
 
-		document_set_text_changed(doc, TRUE);
 		protect_document(doc);
 		doc->priv->info_bars[MSG_TYPE_RELOAD] = bar;
 		enable_key_intercept(doc, bar);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list