[gedit/wip/loader-saver] GeditDocument: add an 'mtime_set' attribute
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/loader-saver] GeditDocument: add an 'mtime_set' attribute
- Date: Sat, 28 Jun 2014 15:47:30 +0000 (UTC)
commit e3730d380728248980635286959484d419d47600
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 8856269..1e4ada7 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -84,6 +84,8 @@ struct _GeditDocumentPrivate
*/
/* Create file if location points to a non existing file. */
guint create : 1;
+
+ guint mtime_set : 1;
};
enum
@@ -1080,6 +1082,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;
@@ -1157,6 +1160,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;
@@ -1257,7 +1261,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]