diff --git a/ChangeLog b/ChangeLog index d0239e37..e0130d28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-12-09 Nick Treleaven + + * src/build.c: + Fix building on win32; also fix some warnings. + * src/document.c: + Read the file's modification timestamp after saving because on + Windows it can be later than expected (closes #1611530). + + 2006-12-08 Nick Treleaven * src/build.c, src/interface.c, src/ui_utils.h, src/build.h, @@ -14,8 +23,6 @@ removes empty menus. * src/dialogs.c, src/ui_utils.c: Use ui_button_new_with_image() in dialogs_show_unsaved_file(). - Improved auto completion of multi line comments and support - /+ +/ for D files. 2006-12-08 Enrico Troeger @@ -30,6 +37,9 @@ * src/msgwindow.c: Removed compiler warning. * src/sci_cb.c, src/sci_cb.h: Made sci_cb_get_indent and sci_Cb_auto_multiline static. + * src/sci_cb.c, src/sci_cb.h: + Improved auto completion of multi line comments and support + /+ +/ for D files. * src/msgwindow.c: Fixed wrong check button state in view menu if message window was shown automatically. diff --git a/src/document.c b/src/document.c index 7c37a756..e67af571 100644 --- a/src/document.c +++ b/src/document.c @@ -782,6 +782,29 @@ gint document_reload_file(gint idx, const gchar *forced_enc) } +static gboolean document_update_timestamp(gint idx) +{ + struct stat st; + gchar *locale_filename; + + g_return_val_if_fail(DOC_IDX_VALID(idx), FALSE); + + locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name); + + if (stat(locale_filename, &st) != 0) + { + msgwin_status_add(_("Could not open file %s (%s)"), doc_list[idx].file_name, + g_strerror(errno)); + g_free(locale_filename); + return FALSE; + } + + doc_list[idx].mtime = st.st_mtime; // get the modification time from file and keep it + g_free(locale_filename); + return TRUE; +} + + /* This saves the file. * When force is set then it is always saved, even if it is unchanged(useful when using Save As) * It returns whether the file could be saved or not. */ @@ -896,7 +919,11 @@ gboolean document_save_file(gint idx, gboolean force) // there are more lines than before sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0); sci_set_savepoint(doc_list[idx].sci); - doc_list[idx].mtime = time(NULL); + + /* stat the file to get the timestamp, otherwise on Windows the actual + * timestamp can be ahead of time(NULL) */ + document_update_timestamp(idx); + if (doc_list[idx].file_type == NULL || doc_list[idx].file_type->id == GEANY_FILETYPES_ALL) { doc_list[idx].file_type = filetypes_get_from_filename(idx);