cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=193ae1c14ceb0b61d172a89d2dec8fe3d28d7733

commit 193ae1c14ceb0b61d172a89d2dec8fe3d28d7733
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Fri Dec 20 16:13:58 2019 +0100

    efl_ui_layout: add API to check out the theme_version
    
    this new API returns the theme version specified in the loaded theme.
    
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D10944
---
 src/lib/elementary/efl_ui_layout.c        |  6 ++++++
 src/lib/elementary/efl_ui_layout_base.eo  | 16 ++++++++++++++++
 src/tests/elementary/efl_ui_test_layout.c | 11 +++++++++++
 3 files changed, 33 insertions(+)

diff --git a/src/lib/elementary/efl_ui_layout.c 
b/src/lib/elementary/efl_ui_layout.c
index a05a8ebb6a..9ab1ab3a4a 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -645,6 +645,12 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, 
Efl_Ui_Layout_Data *sd)
    return EFL_UI_THEME_APPLY_ERROR_NONE;
 }
 
+EOLIAN static int
+_efl_ui_layout_base_theme_version_get(const Eo *obj EINA_UNUSED, 
Efl_Ui_Layout_Data *pd)
+{
+   return pd->version;
+}
+
 EOLIAN static Eina_Bool
 _efl_ui_layout_base_efl_ui_focus_object_on_focus_update(Eo *obj, 
Efl_Ui_Layout_Data *_pd EINA_UNUSED)
 {
diff --git a/src/lib/elementary/efl_ui_layout_base.eo 
b/src/lib/elementary/efl_ui_layout_base.eo
index aa616c777a..8cd206c310 100644
--- a/src/lib/elementary/efl_ui_layout_base.eo
+++ b/src/lib/elementary/efl_ui_layout_base.eo
@@ -87,6 +87,22 @@ abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements 
Efl.Container,
           orientation : int; [[The new rotation angle, in degrees.]]
         }
       }
+      @property theme_version {
+        [[The version a theme does offer
+
+          A theme might offer older theme versions, with this property you can 
detect which version is running. The theme version is bound to the efl-version, 
the oldest version you will get here is 123. The newest of released EFL.
+
+          This property is only valid after @Efl.Ui.Widget.theme_apply has 
been called.
+
+          In case there is no version specified, 0 is returned.
+        ]]
+        get {
+
+        }
+        values {
+          version : int; [[Theme version of this objec, for a EFL version 
called 1.23, this property will return 123.]]
+        }
+      }
    }
    implements {
       class.constructor;
diff --git a/src/tests/elementary/efl_ui_test_layout.c 
b/src/tests/elementary/efl_ui_test_layout.c
index 387bf9aa68..86f4b1efe8 100644
--- a/src/tests/elementary/efl_ui_test_layout.c
+++ b/src/tests/elementary/efl_ui_test_layout.c
@@ -208,6 +208,16 @@ EFL_START_TEST(efl_ui_layout_test_api_ordering)
 }
 EFL_END_TEST
 
+EFL_START_TEST(efl_ui_layout_test_versioning)
+{
+   Evas_Object *win;
+
+   win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
+   Eo *layout = efl_add(EFL_UI_BUTTON_CLASS, win);
+   ck_assert_int_eq(efl_ui_layout_theme_version_get(layout), 123);
+}
+EFL_END_TEST
+
 void efl_ui_test_layout(TCase *tc)
 {
    tcase_add_test(tc, efl_ui_layout_test_property_bind);
@@ -218,4 +228,5 @@ void efl_ui_test_layout(TCase *tc)
    tcase_add_test(tc, efl_ui_layout_test_api_ordering);
    tcase_add_test(tc, efl_ui_layout_test_callback);
    tcase_add_test(tc, efl_ui_layout_test_property_bind_provider);
+   tcase_add_test(tc, efl_ui_layout_test_versioning);
 }

-- 


Reply via email to