mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-03 06:45:51 +01:00
- improved behaviour for the shared appicon thing.
- added a 'Bool recursive' flag to WMMergePLDictionaries() in WINGs
This commit is contained in:
@@ -6,6 +6,7 @@ Changes since wmaker 0.70.0:
|
||||
included too
|
||||
- removed a wsyserror() message when reading a property list from file
|
||||
(the programmer should decide if to give that message or just ignore).
|
||||
- added a 'Bool recursive' flag to WMMergePLDictionaries()
|
||||
|
||||
|
||||
Changes since wmaker 0.65.0:
|
||||
|
||||
@@ -772,7 +772,8 @@ void WMRemoveFromPLDictionary(WMPropList *plist, WMPropList *key);
|
||||
/* It inserts all key/value pairs from source into dest, overwriting
|
||||
* the values with the same keys from dest, keeping all values with keys
|
||||
* only present in dest unchanged */
|
||||
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source);
|
||||
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source,
|
||||
Bool recursive);
|
||||
|
||||
int WMGetPropListItemCount(WMPropList *plist);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ typedef WMPropList* proplist_t;
|
||||
#define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
|
||||
#define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
|
||||
#define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
|
||||
#define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source)
|
||||
#define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source, False)
|
||||
|
||||
#define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
|
||||
|
||||
|
||||
@@ -1211,16 +1211,25 @@ WMRemoveFromPLDictionary(WMPropList *plist, WMPropList *key)
|
||||
|
||||
|
||||
WMPropList*
|
||||
WMMergePLDictionaries(WMPropList *dest, WMPropList *source)
|
||||
WMMergePLDictionaries(WMPropList *dest, WMPropList *source, Bool recursive)
|
||||
{
|
||||
WMPropList *key, *value;
|
||||
WMPropList *key, *value, *dvalue;
|
||||
WMHashEnumerator e;
|
||||
|
||||
wassertr(source->type==WPLDictionary && dest->type==WPLDictionary);
|
||||
|
||||
e = WMEnumerateHashTable(source->d.dict);
|
||||
while (WMNextHashEnumeratorItemAndKey(&e, (void**)&value, (void**)&key)) {
|
||||
WMPutInPLDictionary(dest, key, value);
|
||||
if (recursive && value->type==WPLDictionary) {
|
||||
dvalue = WMGetFromPLDictionary(dest, key);
|
||||
if (dvalue && dvalue->type==WPLDictionary) {
|
||||
WMMergePLDictionaries(dvalue, value, recursive);
|
||||
} else {
|
||||
WMPutInPLDictionary(dest, key, value);
|
||||
}
|
||||
} else {
|
||||
WMPutInPLDictionary(dest, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
||||
@@ -181,7 +181,7 @@ WMSynchronizeUserDefaults(WMUserDefaults *database)
|
||||
if (database->dirty && fileIsNewer) {
|
||||
plF = WMReadPropListFromFile(path);
|
||||
if (plF) {
|
||||
plF = WMMergePLDictionaries(plF, database->appDomain);
|
||||
plF = WMMergePLDictionaries(plF, database->appDomain, False);
|
||||
WMReleasePropList(database->appDomain);
|
||||
database->appDomain = plF;
|
||||
key = database->searchList[0];
|
||||
|
||||
Reference in New Issue
Block a user