| 200 const char* ui_get_property(const char *name) { |
201 const char* ui_get_property(const char *name) { |
| 201 return cxMapGet(application_properties, name); |
202 return cxMapGet(application_properties, name); |
| 202 } |
203 } |
| 203 |
204 |
| 204 void ui_set_property(const char *name, const char *value) { |
205 void ui_set_property(const char *name, const char *value) { |
| 205 cxMapPut(application_properties, name, (char*)value); |
206 if(value) { |
| |
207 cxMapPut(application_properties, name, strdup(value)); |
| |
208 } else { |
| |
209 cxMapRemove(application_properties, name); |
| |
210 } |
| 206 } |
211 } |
| 207 |
212 |
| 208 const char* ui_set_default_property(const char *name, const char *value) { |
213 const char* ui_set_default_property(const char *name, const char *value) { |
| 209 const char *v = cxMapGet(application_properties, name); |
214 const char *v = cxMapGet(application_properties, name); |
| 210 if(!v) { |
215 if(!v) { |
| 239 return str; |
244 return str; |
| 240 } |
245 } |
| 241 |
246 |
| 242 #ifndef UI_COCOA |
247 #ifndef UI_COCOA |
| 243 |
248 |
| 244 void ui_locales_dir(char *path) { |
249 void ui_locales_dir(const char *path) { |
| 245 locales_dir = path; |
250 free(locales_dir); |
| 246 } |
251 locales_dir = path ? strdup(path) : NULL; |
| 247 |
252 } |
| 248 void ui_pixmaps_dir(char *path) { |
253 |
| 249 pixmaps_dir = path; |
254 void ui_pixmaps_dir(const char *path) { |
| |
255 free(pixmaps_dir); |
| |
256 pixmaps_dir = path ? strdup(path) : NULL; |
| 250 } |
257 } |
| 251 |
258 |
| 252 char* uic_get_image_path(const char *imgfilename) { |
259 char* uic_get_image_path(const char *imgfilename) { |
| 253 if(pixmaps_dir) { |
260 if(pixmaps_dir) { |
| 254 return uic_concat_path(pixmaps_dir, imgfilename, NULL); |
261 return uic_concat_path(pixmaps_dir, imgfilename, NULL); |
| 255 } else { |
262 } else { |
| 256 return NULL; |
263 return NULL; |
| 257 } |
264 } |
| 258 } |
265 } |
| 259 |
266 |
| 260 void ui_load_lang(char *locale) { |
267 void ui_load_lang(const char *locale) { |
| 261 if(!locale) { |
268 if(!locale) { |
| 262 locale = "en_EN"; |
269 locale = "en_EN"; |
| 263 } |
270 } |
| 264 |
271 |
| 265 char *path = uic_concat_path(locales_dir, locale, ".properties"); |
272 char *path = uic_concat_path(locales_dir, locale, ".properties"); |
| 317 language = lang; |
324 language = lang; |
| 318 |
325 |
| 319 return 0; |
326 return 0; |
| 320 } |
327 } |
| 321 |
328 |
| 322 char* uistr(char *name) { |
329 char* uistr(const char *name) { |
| 323 char *value = uistr_n(name); |
330 char *value = uistr_n(name); |
| 324 return value ? value : "missing string"; |
331 return value ? value : "missing string"; |
| 325 } |
332 } |
| 326 |
333 |
| 327 char* uistr_n(char *name) { |
334 char* uistr_n(const char *name) { |
| 328 if(!language) { |
335 if(!language) { |
| 329 return NULL; |
336 return NULL; |
| 330 } |
337 } |
| 331 return cxMapGet(language, name); |
338 return cxMapGet(language, name); |
| 332 } |
339 } |