[gedit/wip/loader-saver: 44/54] GeditDocument: add an 'mtime_set' attribute



commit 0ae27463b0954a68cb0362f03b6a67a4f16e9104
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jun 28 17:46:14 2014 +0200

    GeditDocument: add an 'mtime_set' attribute
    
    If the mtime is not already set, don't set the document as externally
    modified.

 gedit/gedit-document.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 64de0d4..d8ac041 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -82,6 +82,8 @@ struct _GeditDocumentPrivate
         * actions.
         */
        guint empty_search : 1;
+
+       guint mtime_set : 1;
 };
 
 enum
@@ -1078,6 +1080,7 @@ loaded_query_info_cb (GFile         *location,
        set_readonly (doc, read_only);
 
        doc->priv->mtime = mtime;
+       doc->priv->mtime_set = TRUE;
        g_get_current_time (&doc->priv->time_of_last_save_or_load);
 
        doc->priv->externally_modified = FALSE;
@@ -1155,6 +1158,7 @@ saved_query_info_cb (GFile         *location,
        gedit_document_set_content_type (doc, content_type);
 
        doc->priv->mtime = mtime;
+       doc->priv->mtime_set = TRUE;
        g_get_current_time (&doc->priv->time_of_last_save_or_load);
 
        doc->priv->externally_modified = FALSE;
@@ -1255,7 +1259,8 @@ check_file_on_disk (GeditDocument *doc)
                        set_readonly (doc, read_only);
                }
 
-               if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED))
+               if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED) &&
+                   doc->priv->mtime_set)
                {
                        GTimeVal timeval;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]