Branch: refs/heads/master Author: Nick Treleaven nick.treleaven@btinternet.com Committer: Nick Treleaven nick.treleaven@btinternet.com Date: Wed, 24 Sep 2014 11:20:03 UTC Commit: 09411956ada70783dac30de1f29d36613d8caf65 https://github.com/geany/geany/commit/09411956ada70783dac30de1f29d36613d8caf...
Log Message: ----------- Merge pull request #326 from ntrel/reload-modified
Don't set document text as changed when file on disk is newer
Modified Paths: -------------- src/document.c
Modified: src/document.c 18 lines changed, 11 insertions(+), 7 deletions(-) =================================================================== @@ -1586,6 +1586,8 @@ static void protect_document(GeanyDocument *doc) /* do not call queue_colourise because to we want to keep the text-changed indication! */ if (!doc->priv->protected++) sci_set_readonly(doc->editor->sci, TRUE); + + ui_update_tab_status(doc); }
@@ -1595,6 +1597,8 @@ static void unprotect_document(GeanyDocument *doc)
if (!--doc->priv->protected && doc->readonly == FALSE) sci_set_readonly(doc->editor->sci, FALSE); + + ui_update_tab_status(doc); }
@@ -2931,11 +2935,10 @@ static void document_redo_add(GeanyDocument *doc, guint type, gpointer data) enum { STATUS_CHANGED, -#ifdef USE_GIO_FILEMON STATUS_DISK_CHANGED, -#endif STATUS_READONLY }; + static struct { const gchar *name; @@ -2943,9 +2946,7 @@ static struct gboolean loaded; } document_status_styles[] = { { "geany-document-status-changed", {0}, FALSE }, -#ifdef USE_GIO_FILEMON { "geany-document-status-disk-changed", {0}, FALSE }, -#endif { "geany-document-status-readonly", {0}, FALSE } };
@@ -2956,8 +2957,10 @@ static gint document_get_status_id(GeanyDocument *doc) return STATUS_CHANGED; #ifdef USE_GIO_FILEMON else if (doc->priv->file_disk_status == FILE_CHANGED) - return STATUS_DISK_CHANGED; +#else + else if (doc->priv->protected) #endif + return STATUS_DISK_CHANGED; else if (doc->readonly) return STATUS_READONLY;
@@ -3269,7 +3272,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 +3332,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).