aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/calendar.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1999-01-28 04:26:10 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-01-28 04:26:10 +0800
commitc970e7ace5de19acdb9cf664435cbec8264ee89e (patch)
tree9aa8a570c2ce45f48b2ee7dfafbf90970820fec3 /calendar/calendar.c
parent6d97fa0fe88d5511cbefe38c0251bcce8d5d1575 (diff)
downloadgsoc2013-evolution-c970e7ace5de19acdb9cf664435cbec8264ee89e.tar.gz
gsoc2013-evolution-c970e7ace5de19acdb9cf664435cbec8264ee89e.tar.zst
gsoc2013-evolution-c970e7ace5de19acdb9cf664435cbec8264ee89e.zip
Warn if the calendar file has changed.
1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx> * main.c (save_calendar_cmd): Warn if the calendar file has changed. * calendar.c (calendar_load, calendar_save): Keep track of the modification time for the calendar file. svn path=/trunk/; revision=632
Diffstat (limited to 'calendar/calendar.c')
-rw-r--r--calendar/calendar.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/calendar/calendar.c b/calendar/calendar.c
index 5fa7035f3a..e5b050620e 100644
--- a/calendar/calendar.c
+++ b/calendar/calendar.c
@@ -14,6 +14,7 @@
#include <config.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "calendar.h"
#include "alarm.h"
#include "timeutil.h"
@@ -280,6 +281,7 @@ calendar_load (Calendar *cal, char *fname)
{
VObject *vcal;
time_t calendar_today;
+ struct stat s;
if (cal->filename){
g_warning ("Calendar load called again\n");
@@ -291,6 +293,8 @@ calendar_load (Calendar *cal, char *fname)
if (!vcal)
return "Could not load the calendar";
+ stat (fname, &s);
+ cal->file_time = s.st_mtime;
calendar_today = time (NULL);
calendar_day_begin = time_day_begin (calendar_today);
calendar_day_end = time_day_end (calendar_today);
@@ -307,6 +311,7 @@ calendar_save (Calendar *cal, char *fname)
VObject *vcal;
GList *l;
time_t now = time (NULL);
+ struct stat s;
if (fname == NULL)
fname = cal->filename;
@@ -348,6 +353,9 @@ calendar_save (Calendar *cal, char *fname)
g_free (backup_name);
}
writeVObjectToFile (fname, vcal);
+
+ stat (fname, &s);
+ cal->file_time = s.st_mtime;
cleanVObject (vcal);
cleanStrTbl ();