diff options
author | Russell Steinthal <steintr@src.gnome.org> | 1999-10-22 09:48:15 +0800 |
---|---|---|
committer | Russell Steinthal <steintr@src.gnome.org> | 1999-10-22 09:48:15 +0800 |
commit | 6df51e3ed291f4f5142c56c580b090e83ac48510 (patch) | |
tree | 95e3efbc7386189d53958ae2b78e10a6da9caa9f | |
parent | 47f01927e15b6eb279d2cbf046b2707467096666 (diff) | |
download | gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.gz gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.bz2 gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.lz gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.xz gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.tar.zst gsoc2013-evolution-6df51e3ed291f4f5142c56c580b090e83ac48510.zip |
Commit debugging support to HEAD as well; there's no good reason to have debugging in the stable but not devel version, is there?
svn path=/trunk/; revision=1340
-rw-r--r-- | calendar/ChangeLog | 2 | ||||
-rw-r--r-- | calendar/alarm.c | 38 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm.c | 38 | ||||
-rw-r--r-- | calendar/gui/alarm.c | 38 | ||||
-rw-r--r-- | calendar/gui/main.c | 12 | ||||
-rw-r--r-- | calendar/main.c | 12 |
6 files changed, 135 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index d86a3a2958..de2f6fab65 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,7 @@ 1999-10-21 Russell Steinthal <rms39@columbia.edu> + * alarm.c, main.c: Added alarm debugging code + * main.c (open_ok): Show an error box if the user tries to open a non-existent file; fixes bug #1818 diff --git a/calendar/alarm.c b/calendar/alarm.c index 7e56ce790a..25c30a9e20 100644 --- a/calendar/alarm.c +++ b/calendar/alarm.c @@ -29,6 +29,10 @@ typedef struct { CalendarAlarm *alarm; } AlarmRecord; +void debug_alarm (AlarmRecord* ar, int add); +void calendar_notify (time_t time, CalendarAlarm *which, void *data); +extern int debug_alarms; + /* * SIGALRM handler. Notifies the callback about the alarm */ @@ -56,6 +60,8 @@ alarm_ready (void *closure, int fd, GdkInputCondition cond) } while (head_alarm){ + if (debug_alarms) + debug_alarm (ar, 0); (*ar->fn)(ar->activation_time, ar->alarm, ar->closure); alarms = g_list_remove (alarms, head_alarm); @@ -135,7 +141,8 @@ alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure) v = setitimer (ITIMER_REAL, &itimer, NULL); head_alarm = alarms->data; } - + if (debug_alarms) + debug_alarm (ar, 1); return TRUE; } @@ -179,3 +186,32 @@ alarm_init (void) sigaction (SIGALRM, &sa, NULL); } +void debug_alarm (AlarmRecord* ar, int add) +{ + time_t now = time (NULL); + iCalObject *ico = ar->closure; + printf ("%s", ctime(&now)); + if (add) + printf ("Added alarm for %s", ctime(&ar->activation_time)); + else + printf ("Activated alarm\n"); + + if (ar->fn!=&calendar_notify) return; + printf ("--- Summary: %s\n", ico->summary); + switch (ar->alarm->type) { + case ALARM_MAIL: + printf ("--- Type: Mail\n"); + break; + case ALARM_PROGRAM: + printf ("--- Type: Program\n"); + break; + case ALARM_DISPLAY: + printf ("--- Type: Display\n"); + break; + case ALARM_AUDIO: + printf ("--- Type: Audio\n"); + break; + } +} + + diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index 7e56ce790a..25c30a9e20 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -29,6 +29,10 @@ typedef struct { CalendarAlarm *alarm; } AlarmRecord; +void debug_alarm (AlarmRecord* ar, int add); +void calendar_notify (time_t time, CalendarAlarm *which, void *data); +extern int debug_alarms; + /* * SIGALRM handler. Notifies the callback about the alarm */ @@ -56,6 +60,8 @@ alarm_ready (void *closure, int fd, GdkInputCondition cond) } while (head_alarm){ + if (debug_alarms) + debug_alarm (ar, 0); (*ar->fn)(ar->activation_time, ar->alarm, ar->closure); alarms = g_list_remove (alarms, head_alarm); @@ -135,7 +141,8 @@ alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure) v = setitimer (ITIMER_REAL, &itimer, NULL); head_alarm = alarms->data; } - + if (debug_alarms) + debug_alarm (ar, 1); return TRUE; } @@ -179,3 +186,32 @@ alarm_init (void) sigaction (SIGALRM, &sa, NULL); } +void debug_alarm (AlarmRecord* ar, int add) +{ + time_t now = time (NULL); + iCalObject *ico = ar->closure; + printf ("%s", ctime(&now)); + if (add) + printf ("Added alarm for %s", ctime(&ar->activation_time)); + else + printf ("Activated alarm\n"); + + if (ar->fn!=&calendar_notify) return; + printf ("--- Summary: %s\n", ico->summary); + switch (ar->alarm->type) { + case ALARM_MAIL: + printf ("--- Type: Mail\n"); + break; + case ALARM_PROGRAM: + printf ("--- Type: Program\n"); + break; + case ALARM_DISPLAY: + printf ("--- Type: Display\n"); + break; + case ALARM_AUDIO: + printf ("--- Type: Audio\n"); + break; + } +} + + diff --git a/calendar/gui/alarm.c b/calendar/gui/alarm.c index 7e56ce790a..25c30a9e20 100644 --- a/calendar/gui/alarm.c +++ b/calendar/gui/alarm.c @@ -29,6 +29,10 @@ typedef struct { CalendarAlarm *alarm; } AlarmRecord; +void debug_alarm (AlarmRecord* ar, int add); +void calendar_notify (time_t time, CalendarAlarm *which, void *data); +extern int debug_alarms; + /* * SIGALRM handler. Notifies the callback about the alarm */ @@ -56,6 +60,8 @@ alarm_ready (void *closure, int fd, GdkInputCondition cond) } while (head_alarm){ + if (debug_alarms) + debug_alarm (ar, 0); (*ar->fn)(ar->activation_time, ar->alarm, ar->closure); alarms = g_list_remove (alarms, head_alarm); @@ -135,7 +141,8 @@ alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure) v = setitimer (ITIMER_REAL, &itimer, NULL); head_alarm = alarms->data; } - + if (debug_alarms) + debug_alarm (ar, 1); return TRUE; } @@ -179,3 +186,32 @@ alarm_init (void) sigaction (SIGALRM, &sa, NULL); } +void debug_alarm (AlarmRecord* ar, int add) +{ + time_t now = time (NULL); + iCalObject *ico = ar->closure; + printf ("%s", ctime(&now)); + if (add) + printf ("Added alarm for %s", ctime(&ar->activation_time)); + else + printf ("Activated alarm\n"); + + if (ar->fn!=&calendar_notify) return; + printf ("--- Summary: %s\n", ico->summary); + switch (ar->alarm->type) { + case ALARM_MAIL: + printf ("--- Type: Mail\n"); + break; + case ALARM_PROGRAM: + printf ("--- Type: Program\n"); + break; + case ALARM_DISPLAY: + printf ("--- Type: Display\n"); + break; + case ALARM_AUDIO: + printf ("--- Type: Audio\n"); + break; + } +} + + diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 50f8941489..0f0cc91477 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -48,6 +48,9 @@ int week_starts_on_monday; /* If true, do not show our top level window */ int startup_hidden = 0; +/* If true, enable debug output for alarms */ +int debug_alarms = 0; + /* The array of color properties -- keep in sync with the enumeration defined in main.h. The color * values specified here are the defaults for the program. */ @@ -662,7 +665,8 @@ enum { USERFILE_KEY = -2, VIEW_KEY = -3, HIDDEN_KEY = -4, - TODO_KEY = -5 + TODO_KEY = -5, + DEBUG_KEY = -6 }; /* Lists used to startup various GnomeCalendars */ @@ -802,6 +806,11 @@ parse_an_arg (poptContext ctx, case HIDDEN_KEY: startup_hidden = 1; break; + + case DEBUG_KEY: + if (!g_strcasecmp (arg, "alarms")) + debug_alarms = 1; + break; default: } @@ -820,6 +829,7 @@ static const struct poptOption options [] = { { "view", '\0', POPT_ARG_STRING, NULL, VIEW_KEY, N_("The startup view mode (dayview, weekview, monthview, yearview)"), N_("VIEW") }, { "to", 't', POPT_ARG_STRING, NULL, 't', N_("Specifies ending date [for --events]"), N_("DATE") }, { "hidden", 0, POPT_ARG_NONE, NULL, HIDDEN_KEY, N_("If used, starts in iconic mode"), NULL }, + { "debug", 'd', POPT_ARG_STRING, NULL, DEBUG_KEY, N_("Enable debugging output of TYPE (alarms)"), N_("TYPE") }, { NULL, '\0', 0, NULL, 0} }; diff --git a/calendar/main.c b/calendar/main.c index 50f8941489..0f0cc91477 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -48,6 +48,9 @@ int week_starts_on_monday; /* If true, do not show our top level window */ int startup_hidden = 0; +/* If true, enable debug output for alarms */ +int debug_alarms = 0; + /* The array of color properties -- keep in sync with the enumeration defined in main.h. The color * values specified here are the defaults for the program. */ @@ -662,7 +665,8 @@ enum { USERFILE_KEY = -2, VIEW_KEY = -3, HIDDEN_KEY = -4, - TODO_KEY = -5 + TODO_KEY = -5, + DEBUG_KEY = -6 }; /* Lists used to startup various GnomeCalendars */ @@ -802,6 +806,11 @@ parse_an_arg (poptContext ctx, case HIDDEN_KEY: startup_hidden = 1; break; + + case DEBUG_KEY: + if (!g_strcasecmp (arg, "alarms")) + debug_alarms = 1; + break; default: } @@ -820,6 +829,7 @@ static const struct poptOption options [] = { { "view", '\0', POPT_ARG_STRING, NULL, VIEW_KEY, N_("The startup view mode (dayview, weekview, monthview, yearview)"), N_("VIEW") }, { "to", 't', POPT_ARG_STRING, NULL, 't', N_("Specifies ending date [for --events]"), N_("DATE") }, { "hidden", 0, POPT_ARG_NONE, NULL, HIDDEN_KEY, N_("If used, starts in iconic mode"), NULL }, + { "debug", 'd', POPT_ARG_STRING, NULL, DEBUG_KEY, N_("Enable debugging output of TYPE (alarms)"), N_("TYPE") }, { NULL, '\0', 0, NULL, 0} }; |