summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-10-01 17:24:42 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-10-02 11:32:04 +0200
commitca134076ebf010092b5d2df55ce461a951bbb97d (patch)
tree43152a693ab7795956d7af1cc198c9a954b213b3 /legacy/elementary/src/lib/elm_interface_atspi_accessible.c
parent6606ad372a1d4a48e5aa844ba00e850981510318 (diff)
atspi: encapsulate common behaviour in atspi mixin class.
This patch moves some duplicated implementation from elm_widget and elm_widget_item classes into atspi base mixin. It allows to better share code and reduce maintainability. Change-Id: I8d264661e7ffade7da72299f29075a536d71eaa3
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/lib/elm_interface_atspi_accessible.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/legacy/elementary/src/lib/elm_interface_atspi_accessible.c b/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
index 3524008951..5bfb80e646 100644
--- a/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
+++ b/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
@@ -121,10 +121,21 @@ struct _Elm_Atspi_Event_Handler
121 void *data; 121 void *data;
122}; 122};
123 123
124struct _Elm_Interface_Atspi_Accessible_Data
125{
126 Elm_Atspi_Role role;
127 const char *name;
128 const char *description;
129 Elm_Interface_Atspi_Accessible *parent;
130};
131
132typedef struct _Elm_Interface_Atspi_Accessible_Data Elm_Interface_Atspi_Accessible_Data;
133
134
124static Eina_List *global_callbacks; 135static Eina_List *global_callbacks;
125 136
126EOLIAN static int 137EOLIAN static int
127_elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, void *pd EINA_UNUSED) 138_elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
128{ 139{
129 Eina_List *l, *children = NULL; 140 Eina_List *l, *children = NULL;
130 Eo *chld, *parent = NULL; 141 Eo *chld, *parent = NULL;
@@ -151,27 +162,24 @@ _elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, void *pd EINA_UNUSE
151 return ret; 162 return ret;
152} 163}
153 164
154EOLIAN static Eo * 165EOLIAN static Elm_Interface_Atspi_Accessible *
155_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 166_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
156{ 167{
157 Eo *parent = NULL; 168 return pd->parent;
158
159 /* By default using Eo_Base object hierarchy */
160 eo_do(obj, parent = eo_parent_get());
161 if (!parent) return NULL;
162
163 return eo_isa(parent, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN) ? parent : NULL;
164} 169}
165 170
166EOLIAN static void 171EOLIAN static void
167_elm_interface_atspi_accessible_parent_set(Eo *obj, void *priv EINA_UNUSED, Eo *new_parent EINA_UNUSED) 172_elm_interface_atspi_accessible_parent_set(Eo *obj, Elm_Interface_Atspi_Accessible_Data *pd, Elm_Interface_Atspi_Accessible *new_parent)
168{ 173{
169 WRN("The %s object does not implement the \"accessible_parent_set\" function.", 174 if (pd->parent != new_parent)
170 eo_class_name_get(eo_class_get(obj))); 175 {
176 pd->parent = new_parent;
177 elm_interface_atspi_accessible_parent_changed_signal_emit(obj);
178 }
171} 179}
172 180
173EOLIAN Eina_List* 181EOLIAN Eina_List*
174_elm_interface_atspi_accessible_attributes_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 182_elm_interface_atspi_accessible_attributes_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
175{ 183{
176 WRN("The %s object does not implement the \"accessible_attributes_set\" function.", 184 WRN("The %s object does not implement the \"accessible_attributes_set\" function.",
177 eo_class_name_get(eo_class_get(obj))); 185 eo_class_name_get(eo_class_get(obj)));
@@ -179,20 +187,23 @@ _elm_interface_atspi_accessible_attributes_get(Eo *obj EINA_UNUSED, void *pd EIN
179} 187}
180 188
181EOLIAN static Elm_Atspi_Role 189EOLIAN static Elm_Atspi_Role
182_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 190_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
183{ 191{
184 return ELM_ATSPI_ROLE_UNKNOWN; 192 return pd->role;
185} 193}
186 194
187EOLIAN static void 195EOLIAN static void
188_elm_interface_atspi_accessible_role_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Elm_Atspi_Role role EINA_UNUSED) 196_elm_interface_atspi_accessible_role_set(Eo *obj, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED, Elm_Atspi_Role role)
189{ 197{
190 WRN("The %s object does not implement the \"accessible_role_set\" function.", 198 if (pd->role != role)
191 eo_class_name_get(eo_class_get(obj))); 199 {
200 pd->role = role;
201 elm_interface_atspi_accessible_role_changed_signal_emit(obj);
202 }
192} 203}
193 204
194EOLIAN const char * 205EOLIAN const char *
195_elm_interface_atspi_accessible_role_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 206_elm_interface_atspi_accessible_role_name_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
196{ 207{
197 Elm_Atspi_Role role; 208 Elm_Atspi_Role role;
198 209
@@ -202,36 +213,30 @@ _elm_interface_atspi_accessible_role_name_get(Eo *obj EINA_UNUSED, void *pd EINA
202} 213}
203 214
204EOLIAN char * 215EOLIAN char *
205_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 216_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
206{ 217{
207 WRN("The %s object does not implement the \"accessible_name_get\" function.", 218 return pd->name ? strdup(pd->name) : NULL;
208 eo_class_name_get(eo_class_get(obj)));
209 return NULL;
210} 219}
211 220
212EOLIAN static void 221EOLIAN static void
213_elm_interface_atspi_accessible_name_set(Eo *obj, void *pd EINA_UNUSED, char *val EINA_UNUSED) 222_elm_interface_atspi_accessible_name_set(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd, char *val)
214{ 223{
215 WRN("The %s object does not implement the \"accessible_name_set\" function.", 224 eina_stringshare_replace(&pd->name, val);
216 eo_class_name_get(eo_class_get(obj)));
217} 225}
218 226
219const char * _elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 227const char * _elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
220{ 228{
221 WRN("The %s object does not implement the \"accessible_description_get\" function.", 229 return pd->description;
222 eo_class_name_get(eo_class_get(obj)));
223 return NULL;
224} 230}
225 231
226EOLIAN static void 232EOLIAN static void
227_elm_interface_atspi_accessible_description_set(Eo *obj, void *pd EINA_UNUSED, const char *val EINA_UNUSED) 233_elm_interface_atspi_accessible_description_set(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd, const char *val)
228{ 234{
229 WRN("The %s object does not implement the \"accessible_description_set\" function.", 235 eina_stringshare_replace(&pd->description, val);
230 eo_class_name_get(eo_class_get(obj)));
231} 236}
232 237
233EOLIAN static const char * 238EOLIAN static const char *
234_elm_interface_atspi_accessible_localized_role_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 239_elm_interface_atspi_accessible_localized_role_name_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
235{ 240{
236 const char *ret = NULL; 241 const char *ret = NULL;
237 eo_do(obj, ret = elm_interface_atspi_accessible_role_name_get()); 242 eo_do(obj, ret = elm_interface_atspi_accessible_role_name_get());
@@ -242,7 +247,7 @@ _elm_interface_atspi_accessible_localized_role_name_get(Eo *obj EINA_UNUSED, voi
242} 247}
243 248
244EOLIAN static Eina_List * 249EOLIAN static Eina_List *
245_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 250_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
246{ 251{
247 Eina_List *children = NULL; 252 Eina_List *children = NULL;
248 Eina_Iterator *iter = NULL; 253 Eina_Iterator *iter = NULL;
@@ -263,14 +268,13 @@ _elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, void *pd EINA_
263} 268}
264 269
265EOLIAN static Elm_Atspi_State_Set 270EOLIAN static Elm_Atspi_State_Set
266_elm_interface_atspi_accessible_state_set_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 271_elm_interface_atspi_accessible_state_set_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
267{ 272{
268 Elm_Atspi_State_Set ret = 0; 273 return 0;
269 return ret;
270} 274}
271 275
272EOLIAN Eina_List* 276EOLIAN Eina_List*
273_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 277_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED)
274{ 278{
275 WRN("The %s object does not implement the \"accessible_relation_set\" function.", 279 WRN("The %s object does not implement the \"accessible_relation_set\" function.",
276 eo_class_name_get(eo_class_get(obj))); 280 eo_class_name_get(eo_class_get(obj)));