ui/common/properties.c

changeset 753
882e49cf7192
parent 674
51670b0bc625
child 762
9452eccfc0f0
equal deleted inserted replaced
752:08a2421957f1 753:882e49cf7192
71 #else 71 #else
72 #define UI_PATH_SEPARATOR '\\' 72 #define UI_PATH_SEPARATOR '\\'
73 #define UI_ENV_HOME "USERPROFILE" 73 #define UI_ENV_HOME "USERPROFILE"
74 #endif 74 #endif
75 75
76 char* ui_configfile(char *name) { 76 char* ui_configfile(const char *name) {
77 const char *appname = ui_appname(); 77 const char *appname = ui_appname();
78 if(!appname) { 78 if(!appname) {
79 return NULL; 79 return NULL;
80 } 80 }
81 81
239 return str; 239 return str;
240 } 240 }
241 241
242 #ifndef UI_COCOA 242 #ifndef UI_COCOA
243 243
244 void ui_locales_dir(char *path) { 244 void ui_locales_dir(const char *path) {
245 locales_dir = path; 245 free(locales_dir);
246 } 246 locales_dir = path ? strdup(path) : NULL;
247 247 }
248 void ui_pixmaps_dir(char *path) { 248
249 pixmaps_dir = path; 249 void ui_pixmaps_dir(const char *path) {
250 free(pixmaps_dir);
251 pixmaps_dir = path ? strdup(path) : NULL;
250 } 252 }
251 253
252 char* uic_get_image_path(const char *imgfilename) { 254 char* uic_get_image_path(const char *imgfilename) {
253 if(pixmaps_dir) { 255 if(pixmaps_dir) {
254 return uic_concat_path(pixmaps_dir, imgfilename, NULL); 256 return uic_concat_path(pixmaps_dir, imgfilename, NULL);
255 } else { 257 } else {
256 return NULL; 258 return NULL;
257 } 259 }
258 } 260 }
259 261
260 void ui_load_lang(char *locale) { 262 void ui_load_lang(const char *locale) {
261 if(!locale) { 263 if(!locale) {
262 locale = "en_EN"; 264 locale = "en_EN";
263 } 265 }
264 266
265 char *path = uic_concat_path(locales_dir, locale, ".properties"); 267 char *path = uic_concat_path(locales_dir, locale, ".properties");
317 language = lang; 319 language = lang;
318 320
319 return 0; 321 return 0;
320 } 322 }
321 323
322 char* uistr(char *name) { 324 char* uistr(const char *name) {
323 char *value = uistr_n(name); 325 char *value = uistr_n(name);
324 return value ? value : "missing string"; 326 return value ? value : "missing string";
325 } 327 }
326 328
327 char* uistr_n(char *name) { 329 char* uistr_n(const char *name) {
328 if(!language) { 330 if(!language) {
329 return NULL; 331 return NULL;
330 } 332 }
331 return cxMapGet(language, name); 333 return cxMapGet(language, name);
332 } 334 }

mercurial