cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=0e69a49c84412b0053ff190ef45d71bc04f049c8

commit 0e69a49c84412b0053ff190ef45d71bc04f049c8
Author: woochan lee <wc0917....@samsung.com>
Date:   Wed Sep 23 15:24:50 2015 -0700

    calendar: weekday update when first day of week changed.
    
    Summary:
    When user call elm_calendar_first_day_of_week_set() to change first day of 
week.
    the marked day has to update.
    But, it's not updated, because of internal logic error.
    I fixed internal logic for update specific day mark.
    
    @fix
    
    Test Plan:
    Called elm_calendar_mark_add()
    Then called  elm_calendar_first_day_of_week_set(
    Check the mark in not updated.
    
    Reviewers: Hermet, cedric
    
    Reviewed By: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3100
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/elm_calendar.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c
index 1749152..038307b 100644
--- a/src/lib/elm_calendar.c
+++ b/src/lib/elm_calendar.c
@@ -414,7 +414,7 @@ _access_calendar_register(Evas_Object *obj)
 static void
 _populate(Evas_Object *obj)
 {
-   int maxdays, prev_month_maxdays, day, mon, yr, i;
+   int maxdays, adjusted_wday, prev_month_maxdays, day, mon, yr, i;
    Elm_Calendar_Mark *mark;
    char part[12], day_s[3];
    struct tm first_day;
@@ -580,8 +580,13 @@ _populate(Evas_Object *obj)
                day = mtime->tm_mday;
              else
                break;
+
+             adjusted_wday = (mtime->tm_wday - sd->first_week_day);
+             if (adjusted_wday < 0)
+               adjusted_wday = ELM_DAY_LAST + adjusted_wday;
+
              for (; day <= maxdays; day++)
-               if (mtime->tm_wday == _weekday_get(sd->first_day_it, day))
+               if (adjusted_wday == _weekday_get(sd->first_day_it, day))
                  _cit_mark(obj, day + sd->first_day_it - 1,
                            mark->mark_type);
              break;

-- 


Reply via email to