aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gnome-cal.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-29 10:38:48 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-29 10:38:48 +0800
commit282114a676e69a0b4c0656b3a6266d27165b2039 (patch)
treed34c5be00109f8f6af69412bbe67a6265f112098 /calendar/gnome-cal.c
parent55ae95fe78692dfa59a17520b40b6ac89fcad706 (diff)
downloadgsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.tar
gsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.tar.gz
gsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.tar.bz2
gsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.tar.lz
gsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.tar.xz
gsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.tar.zst
gsoc2013-evolution-282114a676e69a0b4c0656b3a6266d27165b2039.zip
Lots of fixes:
Lots of fixes: 1. Alarms are rescheduled when an event has been changed. 2. Avoid emitting spurious event changes. 3. Applied black magic to get the mail-notification working. Miguel. svn path=/trunk/; revision=199
Diffstat (limited to 'calendar/gnome-cal.c')
-rw-r--r--calendar/gnome-cal.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index d44c5e89f3..d37d4156a8 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -196,14 +196,10 @@ gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags)
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
g_return_if_fail (obj != NULL);
- /* FIXME: for now we only update the views. Most likely we
- * need to do something else like set the last_mod field on
- * the iCalObject and such - Federico
- */
-
gcal->cal->modified = TRUE;
gnome_calendar_update_all (gcal, obj, flags);
+ calendar_object_changed (gcal->cal, obj, flags);
}
static int
@@ -269,6 +265,35 @@ execute (char *command, int close_standard)
}
void
+mail_notify (char *mail_address, char *text, time_t app_time)
+{
+ pid_t pid;
+ int p [2];
+ char *command;
+
+ pipe (p);
+ pid = fork ();
+ if (pid == 0){
+ const int top = max_open_files ();
+ int dev_null, i;
+
+ dev_null = open ("/dev/null", O_RDWR);
+ dup2 (p [0], 0);
+ dup2 (dev_null, 1);
+ dup2 (dev_null, 2);
+ execl ("/usr/lib/sendmail", "/usr/lib/sendmail",
+ mail_address, NULL);
+ _exit (127);
+ }
+ command = g_copy_strings ("To: ", mail_address, "\n",
+ "Subject: ", _("Reminder of your appointment at "),
+ ctime (&app_time), "\n\n", text, "\n", NULL);
+ write (p [1], command, strlen (command));
+
+ g_free (command);
+}
+
+void
calendar_notify (time_t time, void *data)
{
iCalObject *ico = data;
@@ -284,31 +309,9 @@ calendar_notify (time_t time, void *data)
}
if (ico->malarm.enabled && ico->malarm.trigger == time){
- char *command;
time_t app = ico->malarm.trigger + ico->malarm.offset;
- pid_t pid;
- int p [2];
-
- pipe (p);
- pid = fork ();
- if (pid == 0){
- const int top = max_open_files ();
- int dev_null, i;
- dev_null = open ("/dev/null", O_RDWR);
- dup2 (p [1], 0);
- dup2 (dev_null, 1);
- dup2 (dev_null, 2);
- execl ("/usr/lib/sendmail", "/usr/lib/sendmail",
- ico->malarm.data, NULL);
- _exit (127);
- }
- close (p [1]);
- command = g_copy_strings ("To: ", ico->malarm.data, "\n",
- "Subject: ", _("Reminder of your appointment at "),
- ctime (&app), "\n\n", NULL);
- write (p [0], command, strlen (command));
- g_free (command);
+ mail_notify (ico->malarm.data, ico->summary, app);
return;
}
@@ -325,3 +328,4 @@ calendar_notify (time_t time, void *data)
return;
}
}
+