forked from enlightenment/efl
Elementary calendar: Fix format month / year function
When the format function is set, it should apply it immediately on displayed month / year. SVN revision: 61384
This commit is contained in:
parent
930d594771
commit
5ce6c8cd9d
|
@ -207,6 +207,22 @@ _text_day_color_set(Widget_Data *wd, Day_Color col, int pos)
|
||||||
_text_day_color_update(wd, pos);
|
_text_day_color_update(wd, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_set_month_year(Widget_Data *wd)
|
||||||
|
{
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
/* Set selected month */
|
||||||
|
buf = wd->format_func(&wd->selected_time);
|
||||||
|
if (buf)
|
||||||
|
{
|
||||||
|
edje_object_part_text_set(wd->calendar, "month_text", buf);
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
edje_object_part_text_set(wd->calendar, "month_text", "");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_populate(Evas_Object *obj)
|
_populate(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +231,6 @@ _populate(Evas_Object *obj)
|
||||||
char part[12], day_s[3];
|
char part[12], day_s[3];
|
||||||
struct tm first_day;
|
struct tm first_day;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *buf;
|
|
||||||
Eina_Bool last_row = EINA_TRUE;
|
Eina_Bool last_row = EINA_TRUE;
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
|
||||||
|
@ -227,15 +242,7 @@ _populate(Evas_Object *obj)
|
||||||
mon = wd->selected_time.tm_mon;
|
mon = wd->selected_time.tm_mon;
|
||||||
year = wd->selected_time.tm_year;
|
year = wd->selected_time.tm_year;
|
||||||
|
|
||||||
/* Set selected month */
|
_set_month_year(wd);
|
||||||
buf = wd->format_func(&wd->selected_time);
|
|
||||||
if (buf)
|
|
||||||
{
|
|
||||||
edje_object_part_text_set(wd->calendar, "month_text", buf);
|
|
||||||
free(buf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
edje_object_part_text_set(wd->calendar, "month_text", "");
|
|
||||||
|
|
||||||
/* Set days */
|
/* Set days */
|
||||||
day = 0;
|
day = 0;
|
||||||
|
@ -911,6 +918,7 @@ elm_calendar_format_function_set(Evas_Object *obj, char * (*format_function) (st
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
if (!wd) return;
|
if (!wd) return;
|
||||||
wd->format_func = format_function;
|
wd->format_func = format_function;
|
||||||
|
_set_month_year(wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Elm_Calendar_Mark *
|
EAPI Elm_Calendar_Mark *
|
||||||
|
|
Loading…
Reference in New Issue