From bf64278f45cb952f9254a364beee6757f65bea3d Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Thu, 25 Jan 2001 03:51:43 +0000 Subject: don't tag the calendar if no dates are shown. 2001-01-25 Damon Chaplin * gui/tag-calendar.c: don't tag the calendar if no dates are shown. (e_calendar_item_get_date_range() now returns FALSE in this case.) svn path=/trunk/; revision=7800 --- calendar/gui/tag-calendar.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'calendar/gui/tag-calendar.c') diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index 1a45d7fa85..12cc264f1c 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -37,8 +37,9 @@ struct calendar_tag_closure { /* Clears all the tags in a calendar and fills a closure structure with the * necessary information for iterating over occurrences. + * Returns FALSE if the calendar has no dates shown. */ -static void +static gboolean prepare_tag (ECalendar *ecal, struct calendar_tag_closure *c) { gint start_year, start_month, start_day; @@ -47,9 +48,11 @@ prepare_tag (ECalendar *ecal, struct calendar_tag_closure *c) e_calendar_item_clear_marks (ecal->calitem); - e_calendar_item_get_date_range (ecal->calitem, - &start_year, &start_month, &start_day, - &end_year, &end_month, &end_day); + if (!e_calendar_item_get_date_range (ecal->calitem, + &start_year, &start_month, + &start_day, + &end_year, &end_month, &end_day)) + return FALSE; start_tm.tm_year = start_year - 1900; start_tm.tm_mon = start_month; @@ -70,6 +73,8 @@ prepare_tag (ECalendar *ecal, struct calendar_tag_closure *c) c->calitem = ecal->calitem; c->start_time = mktime (&start_tm); c->end_time = mktime (&end_tm); + + return TRUE; } /* Marks the specified range in an ECalendar; called from cal_client_generate_instances() */ @@ -124,7 +129,8 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client) if (cal_client_get_load_state (client) != CAL_CLIENT_LOAD_LOADED) return; - prepare_tag (ecal, &c); + if (!prepare_tag (ecal, &c)) + return; #if 0 g_print ("DateNavigator generating instances\n"); @@ -156,7 +162,9 @@ tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp) if (!GTK_WIDGET_VISIBLE (ecal)) return; - prepare_tag (ecal, &c); + if (!prepare_tag (ecal, &c)) + return; + #if 0 g_print ("DateNavigator generating instances\n"); #endif -- cgit v1.2.3