ui/common/properties.c

changeset 762
9452eccfc0f0
parent 753
882e49cf7192
child 763
258ec399fbe6
equal deleted inserted replaced
761:b963af4aac40 762:9452eccfc0f0
126 #endif 126 #endif
127 } 127 }
128 128
129 void uic_load_app_properties() { 129 void uic_load_app_properties() {
130 application_properties = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 128); 130 application_properties = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 128);
131 application_properties->collection.simple_destructor = free;
131 132
132 if(!ui_appname()) { 133 if(!ui_appname()) {
133 // applications without name cannot load app properties 134 // applications without name cannot load app properties
134 return; 135 return;
135 } 136 }
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 cxMapRemove(application_properties, name);
208 } else {
209 cxMapPut(application_properties, name, strdup(value));
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) {

mercurial