elementary: calendar still need glue

SVN revision: 70484
This commit is contained in:
Michael BOUCHAUD 2012-04-25 22:51:46 +00:00
parent 23ac588afe
commit f23c33203e
2 changed files with 15 additions and 2 deletions

View File

@ -312,11 +312,11 @@ void
test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *cal, *bxx;
api_data *api = calloc(1, sizeof(api_data));
struct tm selected_time;
time_t current_time;
win = elm_win_util_standard_add("calendar", "Calendar");
elm_win_autodel_set(win, EINA_TRUE);
evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
bxx = elm_box_add(win);
elm_win_resize_object_add(win, bxx);
@ -326,6 +326,9 @@ test_calendar3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
cal = elm_calendar_add(win);
elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY);
elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND);
current_time = time(NULL) + 34 * 84600;
localtime_r(&current_time, &selected_time);
elm_calendar_selected_time_set(cal, &selected_time);
evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bxx, cal);

View File

@ -928,6 +928,13 @@ elm_calendar_selected_time_set(Evas_Object *obj, struct tm *selected_time)
EINA_SAFETY_ON_NULL_RETURN(selected_time);
wd->selected_time = *selected_time;
if (!wd->selected)
wd->selected = EINA_TRUE;
if (wd->selected_time.tm_year != wd->showed_time.tm_year)
wd->showed_time.tm_year = wd->selected_time.tm_year;
if (wd->selected_time.tm_mon != wd->showed_time.tm_mon)
wd->showed_time.tm_mon = wd->selected_time.tm_mon;
_fix_selected_time(wd);
_populate(obj);
return;
@ -940,6 +947,9 @@ elm_calendar_selected_time_get(const Evas_Object *obj, struct tm *selected_time)
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
EINA_SAFETY_ON_NULL_RETURN_VAL(selected_time, EINA_FALSE);
if ((wd->select_mode == ELM_CALENDAR_SELECT_MODE_ONDEMAND)
&& (!wd->selected))
return EINA_FALSE;
*selected_time = wd->selected_time;
return EINA_TRUE;
}