hermet pushed a commit to branch elementary-1.13.

http://git.enlightenment.org/core/elementary.git/commit/?id=218e09052ce9d4e979918f07983e448917f28433

commit 218e09052ce9d4e979918f07983e448917f28433
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Mon Apr 20 14:17:20 2015 +0900

    elm_clock: fix theme apply
    
    Summary:
    theme change was delayed untill some other change (i.e. mode change, clock 
update)
    @fix
    
    Test Plan:
    1. create new style "test" for elm_clock
    2. add this style to theme
    3. compare results of following modifications of 
src/examples/clock_example.c:
    
    ```
       /* am/pm */
       ck = elm_clock_add(win);
       elm_object_style_set(ck, "test"); //style is applied before ap_pm set
       elm_clock_show_am_pm_set(ck, EINA_TRUE);
    ```
    and
    ```
       /* am/pm */
       ck = elm_clock_add(win);
       elm_clock_show_am_pm_set(ck, EINA_TRUE);
       elm_object_style_set(ck, "test"); //style is applied after ap_pm set
    ```
    ExR: style is applied in both cases
    Result without this patch: style is applied only in first case
    
    Reviewers: cedric, seoz, raster, reutskiy.v.v, Hermet
    
    Reviewed By: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D2349
---
 src/lib/elm_clock.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/lib/elm_clock.c b/src/lib/elm_clock.c
index 72191a9..6092d65 100644
--- a/src/lib/elm_clock.c
+++ b/src/lib/elm_clock.c
@@ -14,7 +14,7 @@
 #define MY_CLASS_NAME_LEGACY "elm_clock"
 
 #define DEFAULT_FIRST_INTERVAL 0.85
-static void _time_update(Evas_Object *obj);
+static void _time_update(Evas_Object *obj, Eina_Bool theme_update);
 
 static const char SIG_CHANGED[] = "changed";
 
@@ -72,7 +72,7 @@ _on_clock_val_up(void *data)
 
    sd->interval = sd->interval / 1.05;
    ecore_timer_interval_set(sd->spin, sd->interval);
-   _time_update(data);
+   _time_update(data, EINA_FALSE);
    evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
    return ECORE_CALLBACK_RENEW;
 
@@ -127,7 +127,7 @@ _on_clock_val_down(void *data)
      }
    sd->interval = sd->interval / 1.05;
    ecore_timer_interval_set(sd->spin, sd->interval);
-   _time_update(data);
+   _time_update(data, EINA_FALSE);
    evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
    return ECORE_CALLBACK_RENEW;
 
@@ -339,7 +339,7 @@ _access_time_register(Evas_Object *obj, Eina_Bool is_access)
 }
 
 static void
-_time_update(Evas_Object *obj)
+_time_update(Evas_Object *obj, Eina_Bool theme_update)
 {
    ELM_CLOCK_DATA_GET(obj, sd);
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@@ -348,7 +348,7 @@ _time_update(Evas_Object *obj)
    const char *style = elm_widget_style_get(obj);
 
    if ((sd->cur.seconds != sd->seconds) || (sd->cur.am_pm != sd->am_pm) ||
-       (sd->cur.edit != sd->edit) || (sd->cur.digedit != sd->digedit))
+       (sd->cur.edit != sd->edit) || (sd->cur.digedit != sd->digedit) || 
theme_update)
      {
         int i;
         Evas_Coord mw, mh;
@@ -570,7 +570,7 @@ _elm_clock_elm_widget_theme_apply(Eo *obj, Elm_Clock_Data 
*sd EINA_UNUSED)
    eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
    if (!int_ret) return EINA_FALSE;
 
-   _time_update(obj);
+   _time_update(obj, EINA_TRUE);
 
    return EINA_TRUE;
 }
@@ -599,7 +599,7 @@ _ticker(void *data)
              sd->hrs = tm->tm_hour;
              sd->min = tm->tm_min;
              sd->sec = tm->tm_sec;
-             _time_update(data);
+             _time_update(data, EINA_FALSE);
           }
      }
 
@@ -668,7 +668,7 @@ _elm_clock_evas_object_smart_add(Eo *obj, Elm_Clock_Data 
*priv)
 
    elm_widget_can_focus_set(obj, EINA_TRUE);
 
-   _time_update(obj);
+   _time_update(obj, EINA_FALSE);
    _ticker(obj);
 
    /* access */
@@ -829,7 +829,7 @@ _elm_clock_time_set(Eo *obj, Elm_Clock_Data *sd, int hrs, 
int min, int sec)
    sd->sec = sec;
 
    _timediff_set(sd);
-   _time_update(obj);
+   _time_update(obj, EINA_FALSE);
 }
 
 EOLIAN static void
@@ -849,7 +849,7 @@ _elm_clock_edit_set(Eo *obj, Elm_Clock_Data *sd, Eina_Bool 
edit)
    if ((edit) && (sd->digedit == ELM_CLOCK_EDIT_DEFAULT))
      elm_clock_edit_mode_set(obj, ELM_CLOCK_EDIT_ALL);
    else
-     _time_update(obj);
+     _time_update(obj, EINA_FALSE);
 }
 
 EOLIAN static Eina_Bool
@@ -865,7 +865,7 @@ _elm_clock_edit_mode_set(Eo *obj, Elm_Clock_Data *sd, 
Elm_Clock_Edit_Mode digedi
    if (digedit == ELM_CLOCK_EDIT_DEFAULT)
      elm_clock_edit_set(obj, EINA_FALSE);
    else
-     _time_update(obj);
+     _time_update(obj, EINA_FALSE);
 }
 
 EOLIAN static Elm_Clock_Edit_Mode
@@ -878,7 +878,7 @@ EOLIAN static void
 _elm_clock_show_am_pm_set(Eo *obj, Elm_Clock_Data *sd, Eina_Bool am_pm)
 {
    sd->am_pm = !!am_pm;
-   _time_update(obj);
+   _time_update(obj, EINA_FALSE);
 }
 
 EOLIAN static Eina_Bool
@@ -891,7 +891,7 @@ EOLIAN static void
 _elm_clock_show_seconds_set(Eo *obj, Elm_Clock_Data *sd, Eina_Bool seconds)
 {
    sd->seconds = !!seconds;
-   _time_update(obj);
+   _time_update(obj, EINA_FALSE);
 }
 
 EOLIAN static Eina_Bool

-- 


Reply via email to