From: Jing Yigang Date: Tue, 4 Sep 2012 02:17:50 +0000 (+0800) Subject: [Feature] modify saving font type at the request of Deokjin Kim . X-Git-Tag: 2.0_alpha~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a89307724b70000cb1dd9346f1d8a30c68243d9f;p=apps%2Fcore%2Fpreloaded%2Fsettings.git [Feature] modify saving font type at the request of Deokjin Kim . --- diff --git a/setting-common/src/setting-common-general-func.c b/setting-common/src/setting-common-general-func.c index bae736c..18cbe02 100755 --- a/setting-common/src/setting-common-general-func.c +++ b/setting-common/src/setting-common-general-func.c @@ -1049,6 +1049,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) cur = cur->xmlChildrenNode; + Eina_Bool is_changed = EINA_FALSE; while(cur != NULL) { if((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) @@ -1058,6 +1059,18 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) { if((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) { + xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name"); + SETTING_TRACE_DEBUG("name is: %s", name); + /* if name is not 'family', break */ + if (xmlStrcmp(name, (const xmlChar *)"family")) + { + xmlFree(name); + name = NULL; + break; + } + xmlFree(name); + name = NULL; + cur3 = cur2->xmlChildrenNode; while(cur3 != NULL) { @@ -1065,23 +1078,62 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) { xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name); key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1); - SETTING_TRACE_DEBUG("after changed, string is: %s\n", key); + SETTING_TRACE_DEBUG("after changed, string is: %s", key); + xmlFree(key); + key = NULL; + is_changed = EINA_TRUE; + } + cur3 = cur3->next; + } + } + cur2 = cur2->next; + } + } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) + { + cur2 = cur->xmlChildrenNode; + while (cur2 != NULL) + { + if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) + { + xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name); + key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1); + SETTING_TRACE_DEBUG("after changed, string is: %s", key); + xmlFree(key); + key = NULL; + is_changed = EINA_TRUE; + } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) + { + cur3 = cur2->xmlChildrenNode; + while (cur3 != NULL) + { + if((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) + { + xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name); + key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1); + SETTING_TRACE_DEBUG("after changed, string is: %s", key); xmlFree(key); key = NULL; - return doc; + is_changed = EINA_TRUE; + cur3 = cur3->next; + break; /* just set first element, so break */ } cur3 = cur3->next; } } cur2 = cur2->next; } + } cur = cur->next; } - xmlFreeDoc(doc); - doc = NULL; - return NULL; + if (is_changed) { + return doc; + } else { + xmlFreeDoc(doc); + doc = NULL; + return NULL; + } } /**