summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_imf
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2009-02-25 11:03:47 +0000
committerCedric BAIL <cedric.bail@free.fr>2009-02-25 11:03:47 +0000
commit6978e98dc6247373e7a2a3ec2ec58b37ff404c01 (patch)
treebf9d12da012faab9bc4c2bd925b864c19a38d8d9 /legacy/ecore/src/lib/ecore_imf
parente31b5e961eff9b2c8d5c6a5419502d391e12ca00 (diff)
* estickies,
* etk, * PROTO/exalt, * E-MODULES-EXTRA/diskio, * E-MODULES-EXTRA/drawer, * E-MODULES-EXTRA/penguins, * E-MODULES-EXTRA/slideshow, * E-MODULES-EXTRA/mail, * E-MODULES-EXTRA/forecasts, * E-MODULES-EXTRA/iiirk, * E-MODULES-EXTRA/places, * e, * ewl, * ecore, * elitaire, * entrance, * e_dbus, * efreet: Here we go, move from Ecore_List to Eina_List. NOTE: This patch is huge, I did test it a lot, and I hope nothing is broken. But if you think something change after this commit, please contact me ASAP. SVN revision: 39200
Diffstat (limited to 'legacy/ecore/src/lib/ecore_imf')
-rw-r--r--legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h4
-rw-r--r--legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c14
-rw-r--r--legacy/ecore/src/lib/ecore_imf/ecore_imf_module.c53
-rw-r--r--legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h6
4 files changed, 25 insertions, 52 deletions
diff --git a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h
index 71f890f27c..1ae870846f 100644
--- a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h
+++ b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h
@@ -294,8 +294,8 @@ extern "C" {
294 EAPI int ecore_imf_init(void); 294 EAPI int ecore_imf_init(void);
295 EAPI int ecore_imf_shutdown(void); 295 EAPI int ecore_imf_shutdown(void);
296 296
297 EAPI Ecore_List *ecore_imf_context_available_ids_get(void); 297 EAPI Eina_List *ecore_imf_context_available_ids_get(void);
298 EAPI Ecore_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type); 298 EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
299 EAPI const char *ecore_imf_context_default_id_get(void); 299 EAPI const char *ecore_imf_context_default_id_get(void);
300 EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type); 300 EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
301 EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id); 301 EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c
index 827b794ec1..d8b7ce1104 100644
--- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c
+++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c
@@ -24,20 +24,20 @@
24/** 24/**
25 * Get the list of the available Input Method Context ids. 25 * Get the list of the available Input Method Context ids.
26 * 26 *
27 * Note that the caller is responsible for freeing the Ecore_List 27 * Note that the caller is responsible for freeing the Eina_List
28 * when finished with it. There is no need to finish the list strings. 28 * when finished with it. There is no need to finish the list strings.
29 * 29 *
30 * @return Return an Ecore_List of strings; 30 * @return Return an EIna_List of strings;
31 * on failure it returns NULL. 31 * on failure it returns NULL.
32 * @ingroup Ecore_IMF_Context_Group 32 * @ingroup Ecore_IMF_Context_Group
33 */ 33 */
34EAPI Ecore_List * 34EAPI Eina_List *
35ecore_imf_context_available_ids_get(void) 35ecore_imf_context_available_ids_get(void)
36{ 36{
37 return ecore_imf_module_context_ids_get(); 37 return ecore_imf_module_context_ids_get();
38} 38}
39 39
40EAPI Ecore_List * 40EAPI Eina_List *
41ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type) 41ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
42{ 42{
43 return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type); 43 return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
@@ -85,7 +85,7 @@ EAPI const char *
85ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) 85ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
86{ 86{
87 const char *id; 87 const char *id;
88 Ecore_List *modules; 88 Eina_List *modules;
89 Ecore_IMF_Module *module; 89 Ecore_IMF_Module *module;
90 char *locale; 90 char *locale;
91 char *tmp; 91 char *tmp;
@@ -113,8 +113,7 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
113 113
114 id = NULL; 114 id = NULL;
115 115
116 ecore_list_first_goto(modules); 116 EINA_LIST_FREE(modules, module)
117 while ((module = ecore_list_next(modules)))
118 { 117 {
119 if (canvas_type && 118 if (canvas_type &&
120 strcmp(module->info->canvas_type, canvas_type) == 0) 119 strcmp(module->info->canvas_type, canvas_type) == 0)
@@ -135,7 +134,6 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
135 p = q ? q + 1 : NULL; 134 p = q ? q + 1 : NULL;
136 } 135 }
137 } 136 }
138 ecore_list_destroy(modules);
139 137
140 free(locale); 138 free(locale);
141 return id; 139 return id;
diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_module.c b/legacy/ecore/src/lib/ecore_imf/ecore_imf_module.c
index 78de2dc98e..07fd849168 100644
--- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_module.c
+++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_module.c
@@ -66,33 +66,25 @@ ecore_imf_module_shutdown(void)
66static Eina_Bool 66static Eina_Bool
67_hash_module_available_get(const Eina_Hash *hash, int *data, void *list) 67_hash_module_available_get(const Eina_Hash *hash, int *data, void *list)
68{ 68{
69 ecore_list_append(list, data); 69 *(Eina_List**)list = eina_list_append(*(Eina_List**)list, data);
70 return EINA_TRUE; 70 return EINA_TRUE;
71} 71}
72 72
73Ecore_List * 73Eina_List *
74ecore_imf_module_available_get(void) 74ecore_imf_module_available_get(void)
75{ 75{
76 Ecore_List *values; 76 Eina_List *values = NULL;
77 Eina_Iterator *it = NULL; 77 Eina_Iterator *it = NULL;
78 78
79 if (!modules) return NULL; 79 if (!modules) return NULL;
80 80
81 values = ecore_list_new();
82 if (!values) return NULL;
83
84 it = eina_hash_iterator_data_new(modules); 81 it = eina_hash_iterator_data_new(modules);
85 if (!it) 82 if (!it)
86 {
87 ecore_list_destroy(values);
88 return NULL; 83 return NULL;
89 }
90 84
91 eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), values); 85 eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), &values);
92 eina_iterator_free(it); 86 eina_iterator_free(it);
93 87
94 ecore_list_first_goto(values);
95
96 return values; 88 return values;
97} 89}
98 90
@@ -128,29 +120,23 @@ ecore_imf_module_context_create(const char *ctx_id)
128static Eina_Bool 120static Eina_Bool
129_hash_ids_get(const Eina_Hash *hash, const char *key, void *list) 121_hash_ids_get(const Eina_Hash *hash, const char *key, void *list)
130{ 122{
131 ecore_list_append(list, key); 123 *(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
132 return EINA_TRUE; 124 return EINA_TRUE;
133} 125}
134 126
135Ecore_List * 127Eina_List *
136ecore_imf_module_context_ids_get(void) 128ecore_imf_module_context_ids_get(void)
137{ 129{
138 Ecore_List *l = NULL; 130 Eina_List *l = NULL;
139 Eina_Iterator *it = NULL; 131 Eina_Iterator *it = NULL;
140 132
141 if (!modules) return NULL; 133 if (!modules) return NULL;
142 134
143 l = ecore_list_new();
144 if (!l) return NULL;
145
146 it = eina_hash_iterator_key_new(modules); 135 it = eina_hash_iterator_key_new(modules);
147 if (!it) 136 if (!it)
148 {
149 ecore_list_destroy(l);
150 return NULL; 137 return NULL;
151 }
152 138
153 eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), l); 139 eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), &l);
154 eina_iterator_free(it); 140 eina_iterator_free(it);
155 141
156 return l; 142 return l;
@@ -163,16 +149,16 @@ _hash_ids_by_canvas_type_get(const Eina_Hash *hash, void *data, void *fdata)
163 Ecore_IMF_Selector *selector = fdata; 149 Ecore_IMF_Selector *selector = fdata;
164 150
165 if (!strcmp(module->info->canvas_type, selector->toselect)) 151 if (!strcmp(module->info->canvas_type, selector->toselect))
166 ecore_list_append(selector->selected, (void *)module->info->id); 152 selector->selected = eina_list_append(selector->selected, (void *)module->info->id);
167 153
168 return EINA_TRUE; 154 return EINA_TRUE;
169} 155}
170 156
171Ecore_List * 157Eina_List *
172ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type) 158ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
173{ 159{
174 Ecore_IMF_Selector selector; 160 Ecore_IMF_Selector selector;
175 Ecore_List *values; 161 Eina_List *values = NULL;
176 Eina_Iterator *it = NULL; 162 Eina_Iterator *it = NULL;
177 163
178 if (!modules) return NULL; 164 if (!modules) return NULL;
@@ -180,30 +166,22 @@ ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type)
180 if (!canvas_type) 166 if (!canvas_type)
181 return ecore_imf_module_context_ids_get(); 167 return ecore_imf_module_context_ids_get();
182 168
183 values = ecore_list_new();
184 if (!values) return NULL;
185
186 it = eina_hash_iterator_data_new(modules); 169 it = eina_hash_iterator_data_new(modules);
187 if (!it) 170 if (!it)
188 {
189 ecore_list_destroy(values);
190 return NULL; 171 return NULL;
191 }
192 172
193 selector.toselect = canvas_type; 173 selector.toselect = canvas_type;
194 selector.selected = values; 174 selector.selected = values;
195 eina_iterator_foreach(it, EINA_EACH(_hash_ids_by_canvas_type_get), &selector); 175 eina_iterator_foreach(it, EINA_EACH(_hash_ids_by_canvas_type_get), &selector);
196 eina_iterator_free(it); 176 eina_iterator_free(it);
197 177
198 ecore_list_first_goto(values);
199
200 return values; 178 return values;
201} 179}
202 180
203static void 181static void
204_ecore_imf_module_load_all(void) 182_ecore_imf_module_load_all(void)
205{ 183{
206 Ecore_List *avail; 184 Eina_List *avail;
207 char *filename; 185 char *filename;
208 Ecore_Plugin *plugin; 186 Ecore_Plugin *plugin;
209 const Ecore_IMF_Context_Info *info = NULL; 187 const Ecore_IMF_Context_Info *info = NULL;
@@ -213,8 +191,7 @@ _ecore_imf_module_load_all(void)
213 avail = ecore_plugin_available_get(ecore_imf_modules_path); 191 avail = ecore_plugin_available_get(ecore_imf_modules_path);
214 if (!avail) return; 192 if (!avail) return;
215 193
216 ecore_list_first_goto(avail); 194 EINA_LIST_FREE(avail, filename)
217 while ((filename = ecore_list_next(avail)))
218 { 195 {
219 plugin = ecore_plugin_load(ecore_imf_modules_path, filename, NULL); 196 plugin = ecore_plugin_load(ecore_imf_modules_path, filename, NULL);
220 if (!plugin) 197 if (!plugin)
@@ -255,8 +232,6 @@ _ecore_imf_module_load_all(void)
255 232
256 _ecore_imf_module_append(plugin, info, imf_module_create); 233 _ecore_imf_module_append(plugin, info, imf_module_create);
257 } 234 }
258
259 ecore_list_destroy(avail);
260} 235}
261 236
262static void 237static void
@@ -267,7 +242,7 @@ _ecore_imf_module_append(Ecore_Plugin *plugin,
267 Ecore_IMF_Module *module; 242 Ecore_IMF_Module *module;
268 243
269 if (!modules) 244 if (!modules)
270 modules = eina_hash_string_superfast_new(_ecore_imf_module_free); 245 modules = eina_hash_string_superfast_new(EINA_FREE_CB(_ecore_imf_module_free));
271 246
272 module = malloc(sizeof(Ecore_IMF_Module)); 247 module = malloc(sizeof(Ecore_IMF_Module));
273 module->plugin = plugin; 248 module->plugin = plugin;
diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h b/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h
index dd951e2c89..e6812e7866 100644
--- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h
+++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_private.h
@@ -29,10 +29,10 @@ struct _Ecore_IMF_Module
29 29
30void ecore_imf_module_init(void); 30void ecore_imf_module_init(void);
31void ecore_imf_module_shutdown(void); 31void ecore_imf_module_shutdown(void);
32Ecore_List *ecore_imf_module_available_get(void); 32Eina_List *ecore_imf_module_available_get(void);
33Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id); 33Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id);
34Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id); 34Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id);
35Ecore_List *ecore_imf_module_context_ids_get(void); 35Eina_List *ecore_imf_module_context_ids_get(void);
36Ecore_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type); 36Eina_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type);
37 37
38#endif 38#endif