diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-25 10:23:26 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-25 10:23:26 +0800 |
commit | 07f873d107539a4357c69e1f3ce8cef17cc6277f (patch) | |
tree | d45a8c78f766cbf861b8bf7b34d80dc76b75da7c /calendar/gui | |
parent | ce6e9cd00e965c92debe331b7c762b18674bbc85 (diff) | |
download | gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.gz gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.bz2 gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.lz gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.xz gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.zst gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.zip |
Fixed alarm saving code. Fixed alarm loading code. New -partial-
Fixed alarm saving code.
Fixed alarm loading code.
New -partial- implementation of the mail alarm.
It is not working, I do not know what is closing stdin to sendmail
svn path=/trunk/; revision=194
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar.c | 2 | ||||
-rw-r--r-- | calendar/gui/eventedit.c | 4 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 35 | ||||
-rw-r--r-- | calendar/gui/main.c | 45 |
4 files changed, 73 insertions, 13 deletions
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index dc480e3dfd..2a5b532a04 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -97,6 +97,8 @@ calendar_add_object (Calendar *cal, iCalObject *obj) case ICAL_EVENT: cal->events = g_list_prepend (cal->events, obj); ical_object_try_alarms (obj); + obj->malarm.trigger = 0; + calendar_notify (0, obj); break; case ICAL_TODO: diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index 0158d29673..e6e2ea6b55 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -326,8 +326,6 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t GTK_SIGNAL_FUNC (alarm_toggle), alarm); gtk_table_attach (table, alarm->w_enabled, 0, 1, y, y+1, FS, FS, 0, 0); - gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled), alarm->enabled); - alarm->w_count = make_spin_button (alarm->count, 0, 10000); gtk_table_attach (table, alarm->w_count, 1, 2, y, y+1, FS, FS, 0, 0); @@ -358,7 +356,7 @@ ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType t default: break; } - + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled), alarm->enabled); ee_alarm_setting (alarm, alarm->enabled); } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 755785836a..534db8bb4c 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -9,6 +9,7 @@ #include <unistd.h> #include <signal.h> #include <sys/wait.h> +#include <fcntl.h> #include "calendar.h" #include "gnome-cal.h" #include "gncal-day-panel.h" @@ -257,9 +258,9 @@ execute (char *command, int close_standard) */ execl ("/bin/sh", "/bin/sh", "-c", command, (char *) 0); - exit (127); + _exit (127); } else { - exit (127); + _exit (127); } } wait (&status); @@ -285,13 +286,31 @@ 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]; - command = g_copy_strings ("mail -s '", - _("Reminder of your appointment at "), - ctime (&app), "' '", - ico->malarm.data, "' ", - NULL); - execute (command, 1); + pipe (p); + pid = fork (); + if (pid == 0){ + const int top = max_open_files (); + int dev_null, i; + + for (i = 0; i < top; i++) + if (i != p [1]) + close (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); return; diff --git a/calendar/gui/main.c b/calendar/gui/main.c index f7d7838fe4..1d19da236c 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -51,6 +51,9 @@ static char *load_file; /* If set, show events for the specified date and quit */ static int show_events; +/* Session management */ +static GnomeClient *sm_client; + static void init_username (void) { @@ -121,7 +124,7 @@ about_calendar_cmd (GtkWidget *widget, void *data) }; about = gnome_about_new (_("Gnome Calendar"), VERSION, - "(C) 1998 the Free Software Fundation", + "(C) 1998 the Free Software Foundation", authors, _("The GNOME personal calendar and schedule manager."), NULL); @@ -171,7 +174,7 @@ day_range_changed (void) } static void -quit_cmd (GtkWidget *widget, GnomeCalendar *gcal) +quit_cmd (void) { while (all_calendars){ GnomeCalendar *cal = GNOME_CALENDAR (all_calendars->data); @@ -500,6 +503,42 @@ static struct argp parser = argp_options, parse_an_arg, NULL, NULL, NULL, NULL, NULL }; +static void +session_die (void) +{ + quit_cmd (); +} + +static int +session_save_state (GnomeClient *client, gint phase, GnomeRestartStyle save_style, gint shutdown, + GnomeInteractStyle interact_style, gint fast, gpointer client_data) +{ + printf ("Got a message to save the state\n"); +} + +/* Setup the Session Manager shutdown routine */ +static GnomeClient * +new_client (void) +{ + GnomeClient *client; + char buf [4096]; + + client = gnome_client_new_default (); + if (client) + return NULL; + + getcwd ((void *)&buf, sizeof (buf)); + + gtk_object_ref(GTK_OBJECT(client)); + gtk_object_sink(GTK_OBJECT(client)); + + gtk_signal_connect (GTK_OBJECT (client), "save_yourself", + GTK_SIGNAL_FUNC (session_save_state), NULL); + gtk_signal_connect (GTK_OBJECT (client), "die", + GTK_SIGNAL_FUNC (session_die), NULL); + return client; +} + int main(int argc, char *argv[]) { @@ -510,6 +549,8 @@ main(int argc, char *argv[]) gnome_init ("calendar", &parser, argc, argv, 0, NULL); + sm_client = new_client (); + process_dates (); alarm_init (); init_calendar (); |