From ee208ba079ed4d8e7073d1728cc24e2d5b7babcf Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 19 Oct 2001 17:59:20 +0000 Subject: Do not assert if we fail to load the URI list. This would of course have 2001-10-19 Federico Mena Quintero * gui/alarm-notify/alarm-notify.c (add_uri_to_load): Do not assert if we fail to load the URI list. This would of course have been a bonobo-conf activation problem. (remove_uri_to_load): Likewise. * gui/alarm-notify/notify-main.c (load_calendars): Likewise. * gui/alarm-notify/alarm-queue.c (load_missed_alarms): Make the time range half-open so that we do not display the last alarm twice. svn path=/trunk/; revision=13797 --- calendar/ChangeLog | 13 +++++++++++++ calendar/gui/alarm-notify/alarm-notify.c | 14 ++++++++++++-- calendar/gui/alarm-notify/alarm-queue.c | 7 ++++++- calendar/gui/alarm-notify/notify-main.c | 5 ++++- calendar/gui/alarm-notify/save.c | 15 +++++++-------- 5 files changed, 42 insertions(+), 12 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 77bd34e8e7..87c29c2e19 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,16 @@ +2001-10-19 Federico Mena Quintero + + * gui/alarm-notify/alarm-notify.c (add_uri_to_load): Do not assert + if we fail to load the URI list. This would of course have been a + bonobo-conf activation problem. + (remove_uri_to_load): Likewise. + + * gui/alarm-notify/notify-main.c (load_calendars): Likewise. + + * gui/alarm-notify/alarm-queue.c (load_missed_alarms): Make the + time range half-open so that we do not display the last alarm + twice. + 2001-10-19 Rodrigo Moya * gui/calendar-model.c (calendar_model_set_status_message): make diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 61b8e8ecc5..f4e493f31e 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -197,7 +197,12 @@ add_uri_to_load (GnomeVFSURI *uri) g_assert (str_uri != NULL); loaded_uris = get_calendars_to_load (); - g_assert (loaded_uris != NULL); + if (!loaded_uris) { + g_message ("add_uri_to_load(): Could not get the list of calendars to load; " + "will not add `%s'", str_uri); + g_free (str_uri); + return; + } /* Look for the URI in the list of calendars to load */ @@ -232,7 +237,12 @@ remove_uri_to_load (GnomeVFSURI *uri) g_assert (str_uri != NULL); loaded_uris = get_calendars_to_load (); - g_assert (loaded_uris != NULL); + if (!loaded_uris) { + g_message ("remove_uri_to_load(): Could not get the list of calendars to load; " + "will not add `%s'", str_uri); + g_free (str_uri); + return; + } /* Look for the URI in the list of calendars to load */ diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index b0a6aa8dda..0a57e78ad7 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -383,7 +383,12 @@ load_missed_alarms (ClientAlarms *ca) now = time (NULL); g_assert (saved_notification_time != -1); - load_alarms (ca, saved_notification_time, now); + + /* We add 1 to the saved_notification_time to make the time ranges + * half-open; we do not want to display the "last" displayed alarm + * twice, once when it occurs and once when the alarm daemon restarts. + */ + load_alarms (ca, saved_notification_time + 1, now); } /* Called when a calendar client finished loading; we load its alarms */ diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index f2e2444201..573bf0a372 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -117,7 +117,10 @@ load_calendars (void) int i; uris = get_calendars_to_load (); - g_assert (uris != NULL); + if (!uris) { + g_message ("load_calendars(): Could not get the list of calendars to load"); + return; + } for (i = 0; i < uris->len; i++) { char *uri; diff --git a/calendar/gui/alarm-notify/save.c b/calendar/gui/alarm-notify/save.c index b4a788e71e..2a24a7d17a 100644 --- a/calendar/gui/alarm-notify/save.c +++ b/calendar/gui/alarm-notify/save.c @@ -177,11 +177,8 @@ save_calendars_to_load (GPtrArray *uris) /* Save it */ any = bonobo_arg_new (TC_GNOME_Evolution_Calendar_StringSeq); -#if 0 - *((GNOME_Evolution_Calendar_StringSeq **) any->_value) = seq; -#else any->_value = seq; -#endif + CORBA_exception_init (&ev); bonobo_config_set_value (db, KEY_CALENDARS_TO_LOAD, any, &ev); @@ -248,11 +245,8 @@ get_calendars_to_load (void) CORBA_exception_free (&ev); /* Decode the value */ -#if 0 - seq = *((GNOME_Evolution_Calendar_StringSeq **) any->_value); -#else + seq = any->_value; -#endif len = seq->_length; uris = g_ptr_array_new (); @@ -261,7 +255,12 @@ get_calendars_to_load (void) for (i = 0; i < len; i++) uris->pdata[i] = g_strdup (seq->_buffer[i]); +#if 0 + /* FIXME: The any and sequence are leaked. If we release them this way, + * we crash inside the ORB freeing routines :( + */ bonobo_arg_release (any); +#endif return uris; } -- cgit v1.2.3