e_calendar_item_get_date_range() now returns a boolean, which is FALSE if

2001-01-25  Damon Chaplin  <damon@ximian.com>

	* e-calendar-item.[hc]: e_calendar_item_get_date_range() now returns
	a boolean, which is FALSE if no dates are currently shown.
	Plus a couple of minor sanity checks.

svn path=/trunk/; revision=7799
This commit is contained in:
Damon Chaplin
2001-01-25 03:48:56 +00:00
committed by Damon Chaplin
parent 00044b17d7
commit 9e60ca1bb2
3 changed files with 34 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2001-01-25 Damon Chaplin <damon@ximian.com>
* e-calendar-item.[hc]: e_calendar_item_get_date_range() now returns
a boolean, which is FALSE if no dates are currently shown.
Plus a couple of minor sanity checks.
2001-01-19 Federico Mena Quintero <federico@ximian.com>
* e-calendar.c (e_calendar_init): Unset the GTK_CAN_FOCUS flag on

View File

@ -792,11 +792,18 @@ e_calendar_item_update (GnomeCanvasItem *item,
width -= xthickness * 2;
height -= ythickness * 2;
rows = height / calitem->min_month_height;
if (calitem->min_month_height == 0)
rows = 1;
else
rows = height / calitem->min_month_height;
rows = MAX (rows, calitem->min_rows);
if (calitem->max_rows > 0)
rows = MIN (rows, calitem->max_rows);
cols = width / calitem->min_month_width;
if (calitem->min_month_width == 0)
cols = 1;
else
cols = width / calitem->min_month_width;
cols = MAX (cols, calitem->min_cols);
if (calitem->max_cols > 0)
cols = MIN (cols, calitem->max_cols);
@ -1504,17 +1511,21 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
canvas_item = GNOME_CANVAS_ITEM (calitem);
style = GTK_WIDGET (canvas_item->canvas)->style;
if (!style)
return;
font = calitem->font;
if (!font)
font = style->font;
wkfont = calitem->week_number_font;
if (!wkfont)
wkfont = font;
char_height = font->ascent + font->descent;
g_return_if_fail (font != NULL);
g_return_if_fail (wkfont != NULL);
char_height = font->ascent + font->descent;
/* If both fonts are the same, just return. */
if (font != calitem->old_font
|| wkfont != calitem->old_week_number_font) {
@ -2261,8 +2272,11 @@ e_calendar_item_add_days_to_selection (ECalendarItem *calitem,
}
/* Returns the range of dates actually shown. Months are 0 to 11. */
void
/* Gets the range of dates actually shown. Months are 0 to 11.
This also includes the last days of the previous month and the first days
of the following month, which are normally shown in gray.
It returns FALSE if no dates are currently shown. */
gboolean
e_calendar_item_get_date_range (ECalendarItem *calitem,
gint *start_year,
gint *start_month,
@ -2273,6 +2287,9 @@ e_calendar_item_get_date_range (ECalendarItem *calitem,
{
gint first_day_offset, days_in_month, days_in_prev_month;
if (calitem->rows == 0 || calitem->cols == 0)
return FALSE;
/* Calculate the first day shown. This will be one of the greyed-out
days before the first full month begins. */
e_calendar_item_get_month_info (calitem, 0, 0, &first_day_offset,
@ -2296,6 +2313,8 @@ e_calendar_item_get_date_range (ECalendarItem *calitem,
*end_month %= 12;
*end_day = E_CALENDAR_ROWS_PER_MONTH * E_CALENDAR_COLS_PER_MONTH
- first_day_offset - days_in_month;
return TRUE;
}

View File

@ -261,10 +261,11 @@ gint e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem);
void e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
gint days);
/* Returns the range of dates actually shown. Months are 0 to 11.
/* Gets the range of dates actually shown. Months are 0 to 11.
This also includes the last days of the previous month and the first days
of the following month, which are normally shown in gray. */
void e_calendar_item_get_date_range (ECalendarItem *calitem,
of the following month, which are normally shown in gray.
It returns FALSE if no dates are currently shown. */
gboolean e_calendar_item_get_date_range (ECalendarItem *calitem,
gint *start_year,
gint *start_month,
gint *start_day,