Elementary calendar: fix min_max_year_set function

Properly support negative value for max year.
In this case, it shouldn't try to set the selected time
to year -1.


SVN revision: 59390
This commit is contained in:
Bruno Dilly 2011-05-14 19:47:54 +00:00
parent 14a634d0a3
commit 4b5bf38db6
2 changed files with 3 additions and 1 deletions

View File

@ -145,6 +145,8 @@ test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
elm_entry_editable_set(en, EINA_FALSE);
evas_object_show(win);
elm_calendar_min_max_year_set(cal3, -1, -1);
elm_calendar_weekdays_names_set(cal, weekdays);
elm_calendar_interval_set(cal, 0.4);
elm_calendar_format_function_set(cal, _format_month_year);

View File

@ -940,7 +940,7 @@ elm_calendar_min_max_year_set(Evas_Object *obj, int min, int max)
if ((wd->year_min == min) && (wd->year_max == max)) return;
wd->year_min = min > 2 ? min : 2;
wd->year_max = max;
if (wd->selected_time.tm_year > wd->year_max)
if ((max >= wd->year_min) && (wd->selected_time.tm_year > wd->year_max))
wd->selected_time.tm_year = wd->year_max;
if (wd->selected_time.tm_year < wd->year_min)
wd->selected_time.tm_year = wd->year_min;