summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-10-02 17:04:38 +0200
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>2015-10-02 21:56:14 +0200
commitac12f3adf246898f80085eb3bb0355d15cc113eb (patch)
tree3b4e9db978b3ea8daa4275acfb41091d2b86ebc4
parentb1861986385479221ef9c13ca2d5ff1c0e259f6a (diff)
atspi: add translation domain for name and description.
@feature
-rw-r--r--src/lib/elm_interface_atspi_accessible.c31
-rw-r--r--src/lib/elm_interface_atspi_accessible.eo24
-rw-r--r--src/lib/elm_widget.c2
3 files changed, 56 insertions, 1 deletions
diff --git a/src/lib/elm_interface_atspi_accessible.c b/src/lib/elm_interface_atspi_accessible.c
index 483a35f50..709d142ff 100644
--- a/src/lib/elm_interface_atspi_accessible.c
+++ b/src/lib/elm_interface_atspi_accessible.c
@@ -126,6 +126,7 @@ struct _Elm_Interface_Atspi_Accessible_Data
126 Elm_Atspi_Role role; 126 Elm_Atspi_Role role;
127 const char *name; 127 const char *name;
128 const char *description; 128 const char *description;
129 const char *translation_domain;
129 Elm_Interface_Atspi_Accessible *parent; 130 Elm_Interface_Atspi_Accessible *parent;
130}; 131};
131 132
@@ -215,7 +216,19 @@ _elm_interface_atspi_accessible_role_name_get(Eo *obj EINA_UNUSED, Elm_Interface
215EOLIAN char * 216EOLIAN char *
216_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd) 217_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
217{ 218{
218 return pd->name ? strdup(pd->name) : NULL; 219 if (pd->name)
220 {
221#ifdef ENABLE_NLS
222 if (pd->translation_domain)
223 return strdup(dgettext(pd->translation_domain, pd->name));
224 else
225 return strdup(pd->name);
226#else
227 return strdup(pd->name);
228#endif
229 }
230
231 return NULL;
219} 232}
220 233
221EOLIAN static void 234EOLIAN static void
@@ -226,6 +239,10 @@ _elm_interface_atspi_accessible_name_set(Eo *obj EINA_UNUSED, Elm_Interface_Atsp
226 239
227const char * _elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd) 240const char * _elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
228{ 241{
242#ifdef ENABLE_NLS
243 if (pd->translation_domain)
244 return dgettext(pd->translation_domain, pd->description);
245#endif
229 return pd->description; 246 return pd->description;
230} 247}
231 248
@@ -340,4 +357,16 @@ _elm_interface_atspi_accessible_event_handler_del(Eo *class EINA_UNUSED, void *p
340 } 357 }
341} 358}
342 359
360EOLIAN void
361_elm_interface_atspi_accessible_translation_domain_set(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd, const char *domain)
362{
363 eina_stringshare_replace(&pd->translation_domain, domain);
364}
365
366EOLIAN const char*
367_elm_interface_atspi_accessible_translation_domain_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
368{
369 return pd->translation_domain;
370}
371
343#include "elm_interface_atspi_accessible.eo.c" 372#include "elm_interface_atspi_accessible.eo.c"
diff --git a/src/lib/elm_interface_atspi_accessible.eo b/src/lib/elm_interface_atspi_accessible.eo
index 98e02ad9a..f6a4ed7e2 100644
--- a/src/lib/elm_interface_atspi_accessible.eo
+++ b/src/lib/elm_interface_atspi_accessible.eo
@@ -123,6 +123,30 @@ mixin Elm_Interface_Atspi_Accessible ()
123 @in event_info: void*; [[Accessibility event details.]] 123 @in event_info: void*; [[Accessibility event details.]]
124 } 124 }
125 } 125 }
126 @property translation_domain @protected {
127 get {
128 [[Gets the translation domain of "name" and "description"
129 properties.]]
130 }
131 set {
132 [[Sets the translation domain of "name" and "description"
133 properties.
134
135 Translation domain should be set if application wants to support i18n
136 for accessibily "name" and "description" properties.
137
138 When translation domain is set values of "name" and "description"
139 properties will be translated with dgettext function using
140 current translation domain as "domainname" parameter.
141
142 It is application developer responsibility to ensure that
143 translation files are loaded and binded to translation domain
144 when accessibility is enabled.]]
145 }
146 values {
147 domain: const(char)*; [[ translation domain ]]
148 }
149 }
126 } 150 }
127 events { 151 events {
128 property,changed: const(char)*; 152 property,changed: const(char)*;
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index b14a62545..73d024a53 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -4433,6 +4433,7 @@ _elm_widget_item_eo_base_destructor(Eo *eo_item, Elm_Widget_Item_Data *item)
4433 4433
4434 eo_do(eo_item, elm_interface_atspi_accessible_description_set(NULL)); 4434 eo_do(eo_item, elm_interface_atspi_accessible_description_set(NULL));
4435 eo_do(eo_item, elm_interface_atspi_accessible_name_set(NULL)); 4435 eo_do(eo_item, elm_interface_atspi_accessible_name_set(NULL));
4436 eo_do(eo_item, elm_interface_atspi_accessible_translation_domain_set(NULL));
4436 4437
4437 if (_elm_config->atspi_mode && item->widget) 4438 if (_elm_config->atspi_mode && item->widget)
4438 elm_interface_atspi_accessible_children_changed_del_signal_emit(item->widget, eo_item); 4439 elm_interface_atspi_accessible_children_changed_del_signal_emit(item->widget, eo_item);
@@ -5707,6 +5708,7 @@ _elm_widget_eo_base_destructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
5707{ 5708{
5708 eo_do(obj, elm_interface_atspi_accessible_description_set(NULL)); 5709 eo_do(obj, elm_interface_atspi_accessible_description_set(NULL));
5709 eo_do(obj, elm_interface_atspi_accessible_name_set(NULL)); 5710 eo_do(obj, elm_interface_atspi_accessible_name_set(NULL));
5711 eo_do(obj, elm_interface_atspi_accessible_translation_domain_set(NULL));
5710 elm_interface_atspi_accessible_removed(obj); 5712 elm_interface_atspi_accessible_removed(obj);
5711 5713
5712 eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor()); 5714 eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor());