diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-09-25 15:33:31 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-09-26 17:58:07 +0900 |
commit | e9dfcb44ffe370f6507d563f45676609bd93a41a (patch) | |
tree | 2f16541b4afde5d4a623bcdbe54a75fa4345b240 | |
parent | 839c4ed395f4aa20c3d8089bad828f2ebdc95a4b (diff) |
widget: Implement translation API in layout
This moves the API entry points from Widget to Layout parts. I don't
think the other widgets support translation, but that is easy to fix.
The actual code implementation remains in elm_widget.c.
Legacy-only widgets are covered by Part_Legacy, while all EO widgets
that have text inherit from Layout (except Win but I don't think the
window title was translatable in legacy).
This removes 2/3 remaining part APIs from Widget.
Ref T5363
-rw-r--r-- | src/lib/elementary/efl_ui_clock.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_layout.c | 29 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_layout_part_legacy.eo | 4 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_layout_part_text.eo | 4 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_win.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elc_combobox.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elc_ctxpopup.c | 2 | ||||
-rw-r--r-- | src/lib/elementary/elc_hoversel.c | 3 | ||||
-rw-r--r-- | src/lib/elementary/elc_multibuttonentry.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elc_naviframe.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elc_popup.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elm_dayselector.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elm_diskselector.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elm_list.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elm_main.c | 10 | ||||
-rw-r--r-- | src/lib/elementary/elm_menu.c | 3 | ||||
-rw-r--r-- | src/lib/elementary/elm_segment_control.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elm_toolbar.c | 1 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget.c | 54 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget.eo | 17 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget.h | 5 |
21 files changed, 81 insertions, 61 deletions
diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c index 5de015f2e5..6ab8fd99e0 100644 --- a/src/lib/elementary/efl_ui_clock.c +++ b/src/lib/elementary/efl_ui_clock.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
6 | 7 | ||
7 | #include <Elementary.h> | 8 | #include <Elementary.h> |
8 | #include "elm_priv.h" | 9 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index d31c39db64..6ba041d75d 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c | |||
@@ -2565,6 +2565,20 @@ ELM_PART_OVERRIDE_CONTENT_UNSET_FULL(efl_ui_layout_part_content, efl_ui_layout, | |||
2565 | ELM_PART_OVERRIDE_TEXT_GET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) | 2565 | ELM_PART_OVERRIDE_TEXT_GET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) |
2566 | ELM_PART_OVERRIDE_TEXT_SET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) | 2566 | ELM_PART_OVERRIDE_TEXT_SET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) |
2567 | 2567 | ||
2568 | EOLIAN static const char * | ||
2569 | _efl_ui_layout_part_text_efl_ui_translatable_translatable_text_get(Eo *obj, void *_pd EINA_UNUSED, const char **domain) | ||
2570 | { | ||
2571 | Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); | ||
2572 | return elm_widget_part_translatable_text_get(pd->obj, pd->part, domain); | ||
2573 | } | ||
2574 | |||
2575 | EOLIAN static void | ||
2576 | _efl_ui_layout_part_text_efl_ui_translatable_translatable_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, const char *domain) | ||
2577 | { | ||
2578 | Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); | ||
2579 | elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain); | ||
2580 | } | ||
2581 | |||
2568 | /* Efl.Ui.Layout.Part_Legacy */ | 2582 | /* Efl.Ui.Layout.Part_Legacy */ |
2569 | ELM_PART_OVERRIDE_CONTENT_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) | 2583 | ELM_PART_OVERRIDE_CONTENT_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) |
2570 | ELM_PART_OVERRIDE_CONTENT_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) | 2584 | ELM_PART_OVERRIDE_CONTENT_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) |
@@ -2572,6 +2586,21 @@ ELM_PART_OVERRIDE_CONTENT_UNSET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, E | |||
2572 | ELM_PART_OVERRIDE_TEXT_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) | 2586 | ELM_PART_OVERRIDE_TEXT_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) |
2573 | ELM_PART_OVERRIDE_TEXT_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) | 2587 | ELM_PART_OVERRIDE_TEXT_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data) |
2574 | 2588 | ||
2589 | EOLIAN static const char * | ||
2590 | _efl_ui_layout_part_legacy_efl_ui_translatable_translatable_text_get(Eo *obj, void *_pd EINA_UNUSED, const char **domain) | ||
2591 | { | ||
2592 | Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); | ||
2593 | return elm_widget_part_translatable_text_get(pd->obj, pd->part, domain); | ||
2594 | } | ||
2595 | |||
2596 | EOLIAN static void | ||
2597 | _efl_ui_layout_part_legacy_efl_ui_translatable_translatable_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, const char *domain) | ||
2598 | { | ||
2599 | Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); | ||
2600 | elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain); | ||
2601 | } | ||
2602 | |||
2603 | /* Efl.Ui.Layout.Part_Xxx includes */ | ||
2575 | #include "efl_ui_layout_part.eo.c" | 2604 | #include "efl_ui_layout_part.eo.c" |
2576 | #include "efl_ui_layout_part_content.eo.c" | 2605 | #include "efl_ui_layout_part_content.eo.c" |
2577 | #include "efl_ui_layout_part_text.eo.c" | 2606 | #include "efl_ui_layout_part_text.eo.c" |
diff --git a/src/lib/elementary/efl_ui_layout_part_legacy.eo b/src/lib/elementary/efl_ui_layout_part_legacy.eo index 8904b90222..3d4d335521 100644 --- a/src/lib/elementary/efl_ui_layout_part_legacy.eo +++ b/src/lib/elementary/efl_ui_layout_part_legacy.eo | |||
@@ -1,4 +1,5 @@ | |||
1 | class Efl.Ui.Layout.Part_Legacy (Efl.Ui.Layout.Part, Efl.Container, Efl.Text) | 1 | class Efl.Ui.Layout.Part_Legacy (Efl.Ui.Layout.Part, Efl.Container, Efl.Text, |
2 | Efl.Ui.Translatable) | ||
2 | { | 3 | { |
3 | [[Elementary layout internal part class]] | 4 | [[Elementary layout internal part class]] |
4 | data: null; | 5 | data: null; |
@@ -6,5 +7,6 @@ class Efl.Ui.Layout.Part_Legacy (Efl.Ui.Layout.Part, Efl.Container, Efl.Text) | |||
6 | Efl.Container.content { get; set; } | 7 | Efl.Container.content { get; set; } |
7 | Efl.Container.content_unset; | 8 | Efl.Container.content_unset; |
8 | Efl.Text.text { set; get; } | 9 | Efl.Text.text { set; get; } |
10 | Efl.Ui.Translatable.translatable_text { get; set; } | ||
9 | } | 11 | } |
10 | } | 12 | } |
diff --git a/src/lib/elementary/efl_ui_layout_part_text.eo b/src/lib/elementary/efl_ui_layout_part_text.eo index ce53d49f00..b117a5fbae 100644 --- a/src/lib/elementary/efl_ui_layout_part_text.eo +++ b/src/lib/elementary/efl_ui_layout_part_text.eo | |||
@@ -1,8 +1,10 @@ | |||
1 | class Efl.Ui.Layout.Part_Text (Efl.Ui.Layout.Part, Efl.Text) | 1 | class Efl.Ui.Layout.Part_Text (Efl.Ui.Layout.Part, Efl.Text, |
2 | Efl.Ui.Translatable) | ||
2 | { | 3 | { |
3 | [[Elementary layout internal part class]] | 4 | [[Elementary layout internal part class]] |
4 | data: null; | 5 | data: null; |
5 | implements { | 6 | implements { |
6 | Efl.Text.text { set; get; } | 7 | Efl.Text.text { set; get; } |
8 | Efl.Ui.Translatable.translatable_text { get; set; } | ||
7 | } | 9 | } |
8 | } | 10 | } |
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 1a94b70c2e..06607a6ed6 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #define EFL_GFX_SIZE_HINT_PROTECTED | 9 | #define EFL_GFX_SIZE_HINT_PROTECTED |
10 | #define EFL_CANVAS_OBJECT_BETA | 10 | #define EFL_CANVAS_OBJECT_BETA |
11 | #define EFL_CANVAS_OBJECT_PROTECTED | 11 | #define EFL_CANVAS_OBJECT_PROTECTED |
12 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
12 | #define EFL_UI_WIN_INLINED_PROTECTED | 13 | #define EFL_UI_WIN_INLINED_PROTECTED |
13 | #define EFL_UI_WIN_BETA | 14 | #define EFL_UI_WIN_BETA |
14 | 15 | ||
diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index b172153e7c..e11feb208d 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | #define ELM_WIDGET_PROTECTED | 7 | #define ELM_WIDGET_PROTECTED |
8 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
8 | 9 | ||
9 | #include <Elementary.h> | 10 | #include <Elementary.h> |
10 | #include "elm_priv.h" | 11 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c index d53cb203e8..166ef966c4 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c | |||
@@ -4,9 +4,9 @@ | |||
4 | 4 | ||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | |||
8 | #define ELM_WIDGET_PROTECTED | 7 | #define ELM_WIDGET_PROTECTED |
9 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
10 | 10 | ||
11 | #include <Elementary.h> | 11 | #include <Elementary.h> |
12 | 12 | ||
diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c index d4973b103c..3f0f12611f 100644 --- a/src/lib/elementary/elc_hoversel.c +++ b/src/lib/elementary/elc_hoversel.c | |||
@@ -4,9 +4,10 @@ | |||
4 | 4 | ||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | |||
8 | #define ELM_WIDGET_PROTECTED | 7 | #define ELM_WIDGET_PROTECTED |
9 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
10 | |||
10 | #include <Elementary.h> | 11 | #include <Elementary.h> |
11 | #include "elm_priv.h" | 12 | #include "elm_priv.h" |
12 | #include "elm_hoversel.eo.h" | 13 | #include "elm_hoversel.eo.h" |
diff --git a/src/lib/elementary/elc_multibuttonentry.c b/src/lib/elementary/elc_multibuttonentry.c index 90538e4bcb..3740e09061 100644 --- a/src/lib/elementary/elc_multibuttonentry.c +++ b/src/lib/elementary/elc_multibuttonentry.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define ELM_WIDGET_ITEM_PROTECTED | 6 | #define ELM_WIDGET_ITEM_PROTECTED |
7 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 7 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
8 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
8 | 9 | ||
9 | #include <Elementary.h> | 10 | #include <Elementary.h> |
10 | #include "elm_priv.h" | 11 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index 6975a701b4..c6a3e56c13 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | #define ELM_WIDGET_ITEM_PROTECTED | 7 | #define ELM_WIDGET_ITEM_PROTECTED |
8 | #define ELM_WIDGET_PROTECTED | 8 | #define ELM_WIDGET_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
9 | 10 | ||
10 | #include <Elementary.h> | 11 | #include <Elementary.h> |
11 | #include "elm_priv.h" | 12 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c index 7f0e45ef82..63130ca7ad 100644 --- a/src/lib/elementary/elc_popup.c +++ b/src/lib/elementary/elc_popup.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | #define ELM_WIDGET_PROTECTED | 7 | #define ELM_WIDGET_PROTECTED |
8 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
9 | 10 | ||
10 | #include <Elementary.h> | 11 | #include <Elementary.h> |
11 | #include "elm_priv.h" | 12 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elm_dayselector.c b/src/lib/elementary/elm_dayselector.c index 7274b84985..88de718a65 100644 --- a/src/lib/elementary/elm_dayselector.c +++ b/src/lib/elementary/elm_dayselector.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
6 | 7 | ||
7 | #include <Elementary.h> | 8 | #include <Elementary.h> |
8 | #include "elm_priv.h" | 9 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elm_diskselector.c b/src/lib/elementary/elm_diskselector.c index eea10e492b..cc72466fab 100644 --- a/src/lib/elementary/elm_diskselector.c +++ b/src/lib/elementary/elm_diskselector.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | #define ELM_WIDGET_ITEM_PROTECTED | 7 | #define ELM_WIDGET_ITEM_PROTECTED |
8 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
8 | 9 | ||
9 | #include <Elementary.h> | 10 | #include <Elementary.h> |
10 | #include "elm_priv.h" | 11 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index e0f2f92f34..26d88065dc 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
7 | #define EFL_ACCESS_SELECTION_PROTECTED | 7 | #define EFL_ACCESS_SELECTION_PROTECTED |
8 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
9 | 10 | ||
10 | #include <Elementary.h> | 11 | #include <Elementary.h> |
11 | 12 | ||
diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 4d65e56052..f433d57030 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c | |||
@@ -1484,14 +1484,20 @@ EAPI void | |||
1484 | elm_object_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text) | 1484 | elm_object_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text) |
1485 | { | 1485 | { |
1486 | EINA_SAFETY_ON_NULL_RETURN(obj); | 1486 | EINA_SAFETY_ON_NULL_RETURN(obj); |
1487 | elm_widget_domain_translatable_part_text_set(obj, part, domain, text); | 1487 | if (!part) |
1488 | efl_ui_translatable_text_set(obj, text, domain); | ||
1489 | else | ||
1490 | efl_ui_translatable_text_set(efl_part(obj, part), text, domain); | ||
1488 | } | 1491 | } |
1489 | 1492 | ||
1490 | EAPI const char * | 1493 | EAPI const char * |
1491 | elm_object_translatable_part_text_get(const Evas_Object *obj, const char *part) | 1494 | elm_object_translatable_part_text_get(const Evas_Object *obj, const char *part) |
1492 | { | 1495 | { |
1493 | EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); | 1496 | EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); |
1494 | return elm_widget_translatable_part_text_get(obj, part); | 1497 | if (!part) |
1498 | return efl_ui_translatable_text_get(obj, NULL); | ||
1499 | else | ||
1500 | return efl_ui_translatable_text_get(efl_part(obj, part), NULL); | ||
1495 | } | 1501 | } |
1496 | 1502 | ||
1497 | EAPI void | 1503 | EAPI void |
diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c index 29d8caaa13..5348ea707f 100644 --- a/src/lib/elementary/elm_menu.c +++ b/src/lib/elementary/elm_menu.c | |||
@@ -5,8 +5,9 @@ | |||
5 | #define ELM_WIDGET_PROTECTED | 5 | #define ELM_WIDGET_PROTECTED |
6 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 6 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
7 | #define EFL_ACCESS_SELECTION_PROTECTED | 7 | #define EFL_ACCESS_SELECTION_PROTECTED |
8 | |||
9 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
10 | |||
10 | #include <Elementary.h> | 11 | #include <Elementary.h> |
11 | 12 | ||
12 | #include "elm_priv.h" | 13 | #include "elm_priv.h" |
diff --git a/src/lib/elementary/elm_segment_control.c b/src/lib/elementary/elm_segment_control.c index 8ea9689ee7..11a1753b8c 100644 --- a/src/lib/elementary/elm_segment_control.c +++ b/src/lib/elementary/elm_segment_control.c | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED | 5 | #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED |
6 | #define ELM_WIDGET_ITEM_PROTECTED | 6 | #define ELM_WIDGET_ITEM_PROTECTED |
7 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
7 | 8 | ||
8 | #include <Elementary.h> | 9 | #include <Elementary.h> |
9 | 10 | ||
diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 37955b7738..4e96ac6a07 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #define EFL_ACCESS_SELECTION_PROTECTED | 6 | #define EFL_ACCESS_SELECTION_PROTECTED |
7 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED | 7 | #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED |
8 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
9 | 10 | ||
10 | #include <Elementary.h> | 11 | #include <Elementary.h> |
11 | 12 | ||
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index fca0787b42..3efab18acf 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #define ELM_WIDGET_ITEM_PROTECTED | 8 | #define ELM_WIDGET_ITEM_PROTECTED |
9 | #define EFL_CANVAS_OBJECT_BETA | 9 | #define EFL_CANVAS_OBJECT_BETA |
10 | #define EFL_INPUT_EVENT_PROTECTED | 10 | #define EFL_INPUT_EVENT_PROTECTED |
11 | #define EFL_UI_TRANSLATABLE_PROTECTED | ||
11 | 12 | ||
12 | #include <Elementary.h> | 13 | #include <Elementary.h> |
13 | 14 | ||
@@ -3787,11 +3788,15 @@ _part_text_translatable_set(Eina_Inlist **translate_strings, const char *part, E | |||
3787 | return ts; | 3788 | return ts; |
3788 | } | 3789 | } |
3789 | 3790 | ||
3790 | EOLIAN static void | 3791 | /* internal */ |
3791 | _elm_widget_domain_translatable_part_text_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *part, const char *domain, const char *label) | 3792 | void |
3793 | elm_widget_part_translatable_text_set(Eo *obj, const char *part, const char *label, const char *domain) | ||
3792 | { | 3794 | { |
3793 | |||
3794 | Elm_Translate_String_Data *ts; | 3795 | Elm_Translate_String_Data *ts; |
3796 | Elm_Widget_Smart_Data *sd; | ||
3797 | |||
3798 | sd = efl_data_scope_safe_get(obj, MY_CLASS); | ||
3799 | if (!sd) return; | ||
3795 | 3800 | ||
3796 | if (!label) | 3801 | if (!label) |
3797 | { | 3802 | { |
@@ -3817,16 +3822,6 @@ _elm_widget_domain_translatable_part_text_set(Eo *obj, Elm_Widget_Smart_Data *sd | |||
3817 | sd->on_translate = EINA_FALSE; | 3822 | sd->on_translate = EINA_FALSE; |
3818 | } | 3823 | } |
3819 | 3824 | ||
3820 | EOLIAN static const char* | ||
3821 | _elm_widget_translatable_part_text_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, const char *part) | ||
3822 | { | ||
3823 | Elm_Translate_String_Data *ts; | ||
3824 | |||
3825 | ts = _translate_string_data_get(sd->translate_strings, part); | ||
3826 | if (ts) return ts->string; | ||
3827 | else return NULL; | ||
3828 | } | ||
3829 | |||
3830 | EOLIAN static void | 3825 | EOLIAN static void |
3831 | _elm_widget_domain_part_text_translatable_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *part, const char *domain, Eina_Bool translatable) | 3826 | _elm_widget_domain_part_text_translatable_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *part, const char *domain, Eina_Bool translatable) |
3832 | { | 3827 | { |
@@ -3853,32 +3848,23 @@ _elm_widget_domain_part_text_translatable_set(Eo *obj, Elm_Widget_Smart_Data *sd | |||
3853 | sd->on_translate = EINA_FALSE; | 3848 | sd->on_translate = EINA_FALSE; |
3854 | } | 3849 | } |
3855 | 3850 | ||
3856 | static const char* | 3851 | /* internal */ |
3857 | _part_text_translate(Eina_Inlist *translate_strings, | 3852 | const char * |
3858 | const char *part, | 3853 | elm_widget_part_translatable_text_get(const Eo *obj, const char *part, const char **domain) |
3859 | const char *text) | ||
3860 | { | 3854 | { |
3855 | Elm_Widget_Smart_Data *sd; | ||
3861 | Elm_Translate_String_Data *ts; | 3856 | Elm_Translate_String_Data *ts; |
3862 | ts = _translate_string_data_get(translate_strings, part); | ||
3863 | if (!ts) return text; | ||
3864 | 3857 | ||
3865 | if (!ts->string) ts->string = eina_stringshare_add(text); | 3858 | if (domain) *domain = NULL; |
3866 | else eina_stringshare_replace(&ts->string, text); | ||
3867 | #ifdef HAVE_GETTEXT | ||
3868 | if (text && text[0]) | ||
3869 | text = dgettext(ts->domain, text); | ||
3870 | #endif | ||
3871 | return text; | ||
3872 | } | ||
3873 | 3859 | ||
3874 | EAPI const char* | 3860 | sd = efl_data_scope_safe_get(obj, MY_CLASS); |
3875 | elm_widget_part_text_translate(Eo *obj, const char *part, const char *text) | 3861 | if (!sd) return NULL; |
3876 | { | 3862 | |
3877 | Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); | 3863 | ts = _translate_string_data_get(sd->translate_strings, part); |
3864 | if (!ts) return NULL; | ||
3878 | 3865 | ||
3879 | if (!sd) return text; | 3866 | if (domain) *domain = ts->domain; |
3880 | if (!sd->translate_strings || sd->on_translate) return text; | 3867 | return ts->string; |
3881 | return _part_text_translate(sd->translate_strings, part, text); | ||
3882 | } | 3868 | } |
3883 | 3869 | ||
3884 | EOLIAN static void | 3870 | EOLIAN static void |
diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index 123c8baecc..679b7beff0 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo | |||
@@ -296,23 +296,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, | |||
296 | translatable: bool; [[$true if translatable, $false otherwise]] | 296 | translatable: bool; [[$true if translatable, $false otherwise]] |
297 | } | 297 | } |
298 | } | 298 | } |
299 | translatable_part_text_get @const { | ||
300 | [[Get translatable part text]] | ||
301 | return: string; [[Part text]] | ||
302 | params { | ||
303 | @in part: string; [[Part name]] | ||
304 | } | ||
305 | } | ||
306 | @property domain_translatable_part_text { | ||
307 | [[Domain translatable text part property]] | ||
308 | set { | ||
309 | } | ||
310 | values { | ||
311 | part: string; [[Part name]] | ||
312 | domain: string; [[Domain name]] | ||
313 | label: string; [[Label]] | ||
314 | } | ||
315 | } | ||
316 | 299 | ||
317 | /* Internal hooks. */ | 300 | /* Internal hooks. */ |
318 | widget_sub_object_add @protected { | 301 | widget_sub_object_add @protected { |
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index a57630fd28..dd99b0273b 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h | |||
@@ -635,7 +635,6 @@ EAPI Eina_Bool elm_widget_api_check(int ver); | |||
635 | EAPI Eina_Bool elm_widget_access(Evas_Object *obj, Eina_Bool is_access); | 635 | EAPI Eina_Bool elm_widget_access(Evas_Object *obj, Eina_Bool is_access); |
636 | EAPI Efl_Ui_Theme_Apply elm_widget_theme(Evas_Object *obj); | 636 | EAPI Efl_Ui_Theme_Apply elm_widget_theme(Evas_Object *obj); |
637 | EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force); | 637 | EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force); |
638 | EAPI void efl_ui_translatable_translation_update(Evas_Object *obj); | ||
639 | EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void *data, Efl_Ui_Scrollable_On_Show_Region func, Eina_Free_Cb data_free); | 638 | EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void *data, Efl_Ui_Scrollable_On_Show_Region func, Eina_Free_Cb data_free); |
640 | EAPI Eina_Bool elm_widget_sub_object_parent_add(Evas_Object *sobj); | 639 | EAPI Eina_Bool elm_widget_sub_object_parent_add(Evas_Object *sobj); |
641 | EAPI Eina_Bool elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj); | 640 | EAPI Eina_Bool elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj); |
@@ -728,10 +727,8 @@ EAPI void elm_widget_focus_mouse_up_handle(Evas_Object *obj); | |||
728 | EAPI void elm_widget_activate(Evas_Object *obj, Elm_Activate act); | 727 | EAPI void elm_widget_activate(Evas_Object *obj, Elm_Activate act); |
729 | EAPI void elm_widget_part_text_set(Evas_Object *obj, const char *part, const char *label); | 728 | EAPI void elm_widget_part_text_set(Evas_Object *obj, const char *part, const char *label); |
730 | EAPI const char *elm_widget_part_text_get(const Evas_Object *obj, const char *part); | 729 | EAPI const char *elm_widget_part_text_get(const Evas_Object *obj, const char *part); |
731 | EAPI void elm_widget_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text); | ||
732 | EAPI const char *elm_widget_translatable_part_text_get(const Evas_Object *obj, const char *part); | 730 | EAPI const char *elm_widget_translatable_part_text_get(const Evas_Object *obj, const char *part); |
733 | EAPI void elm_widget_domain_part_text_translatable_set(Evas_Object *obj, const char *part, const char *domain, Eina_Bool translatable); | 731 | EAPI void elm_widget_domain_part_text_translatable_set(Evas_Object *obj, const char *part, const char *domain, Eina_Bool translatable); |
734 | EAPI const char * elm_widget_part_text_translate(Evas_Object *obj, const char *part, const char *text); | ||
735 | EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content); | 732 | EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content); |
736 | EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part); | 733 | EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part); |
737 | EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); | 734 | EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); |
@@ -743,6 +740,8 @@ EAPI Eina_Rect elm_widget_focus_highlight_geometry_get(const Evas_Object | |||
743 | void _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *it); | 740 | void _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *it); |
744 | EAPI void elm_widget_focus_region_show_mode_set(Evas_Object *obj, Elm_Focus_Region_Show_Mode mode); | 741 | EAPI void elm_widget_focus_region_show_mode_set(Evas_Object *obj, Elm_Focus_Region_Show_Mode mode); |
745 | EAPI Elm_Focus_Region_Show_Mode elm_widget_focus_region_show_mode_get(const Evas_Object *obj); | 742 | EAPI Elm_Focus_Region_Show_Mode elm_widget_focus_region_show_mode_get(const Evas_Object *obj); |
743 | const char *elm_widget_part_translatable_text_get(const Eo *obj, const char *part, const char **domain); | ||
744 | void elm_widget_part_translatable_text_set(Eo *obj, const char *part, const char *label, const char *domain); | ||
746 | 745 | ||
747 | /* debug function. don't use it unless you are tracking parenting issues */ | 746 | /* debug function. don't use it unless you are tracking parenting issues */ |
748 | EAPI void elm_widget_tree_dump(const Evas_Object *top); | 747 | EAPI void elm_widget_tree_dump(const Evas_Object *top); |