diff options
author | GMT 2000 Tony Gale <gale@gtk.org> | 2000-02-26 11:39:07 +0000 |
---|---|---|
committer | Tony Gale <gale@src.gnome.org> | 2000-02-26 11:39:07 +0000 |
commit | e8fa46be456329d453d8f200edd088f0e4fca037 (patch) | |
tree | 46c3bdb996678037372fb06baed7161af00861fb /gtk/gtkcalendar.c | |
parent | f9d3bbdaaf5a827f6552a359debb5ef91965a70f (diff) | |
download | gtk+-e8fa46be456329d453d8f200edd088f0e4fca037.tar.gz |
Implement num_marked_dates, and don't emit mutiple day_selected signals on
Sat Feb 26 11:46:25 GMT 2000 Tony Gale <gale@gtk.org>
* gtk/gtkcalendar.c: Implement num_marked_dates,
and don't emit mutiple day_selected signals on
month_prev.
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r-- | gtk/gtkcalendar.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index e6f0330d49..435b434370 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -457,6 +457,7 @@ gtk_calendar_init (GtkCalendar *calendar) for (i=0;i<31;i++) calendar->marked_date[i] = FALSE; + calendar->num_marked_dates = 0; calendar->selected_day = 1; calendar->display_flags = ( GTK_CALENDAR_SHOW_HEADING | @@ -665,11 +666,9 @@ gtk_calendar_set_month_prev (GtkCalendar *calendar) { if (calendar->selected_day < 0) calendar->selected_day = calendar->selected_day + 1 + month_length[leap (calendar->year)][calendar->month + 1]; - else - gtk_calendar_select_day (calendar, calendar->selected_day); + gtk_calendar_select_day (calendar, calendar->selected_day); } - gtk_calendar_select_day (calendar, calendar->selected_day); gtk_calendar_paint (GTK_WIDGET (calendar), NULL); gtk_calendar_thaw (calendar); } @@ -2220,7 +2219,9 @@ gtk_calendar_clear_marks (GtkCalendar *calendar) { calendar->marked_date[day] = FALSE; } - + + calendar->num_marked_dates = 0; + if (GTK_WIDGET_DRAWABLE (calendar)) { gtk_calendar_paint_main (GTK_WIDGET (calendar)); @@ -2234,9 +2235,11 @@ gtk_calendar_mark_day (GtkCalendar *calendar, g_return_val_if_fail (calendar != NULL, FALSE); g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE); - if (day >= 1 && day <= 31) - calendar->marked_date[day - 1] = TRUE; - + if (day >= 1 && day <= 31 && calendar->marked_date[day-1] == FALSE) + { + calendar->marked_date[day - 1] = TRUE; + calendar->num_marked_dates++; + } if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) { gtk_calendar_paint_main (GTK_WIDGET (calendar)); @@ -2252,8 +2255,11 @@ gtk_calendar_unmark_day (GtkCalendar *calendar, g_return_val_if_fail (calendar != NULL, FALSE); g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE); - if (day >= 1 && day <= 31) - calendar->marked_date[day - 1] = FALSE; + if (day >= 1 && day <= 31 && calendar->marked_date[day-1] == TRUE) + { + calendar->marked_date[day - 1] = FALSE; + calendar->num_marked_dates--; + } if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) { |