mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-31 02:52:30 +01:00
- Finished moving to the new proplist handling code in WINGs.
- Also tested the backward compatibility ability of the WINGs proplist code which seems to work quite well. Starting with this moment, Window Maker no longer needs libPropList and is now using the better and much more robust proplist code from WINGs. Also the WINGs based proplist code is actively maintained while the old libPropList code is practically dead and flawed by the fact that it borrowed concepts from the UserDefaults which conflicted with the retain/release mechanism, making some problems that libPropList had, practically unsolvable without a complete redesign (which can be found in the more robust WINGs code).
This commit is contained in:
@@ -10,14 +10,6 @@
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Warning: proplist.h #defines BOOL which will clash with the
|
||||
* typedef BOOL in Xmd.h
|
||||
* proplist.h should use Bool (which is a #define in Xlib.h) instead.
|
||||
*
|
||||
*/
|
||||
#include <proplist.h>
|
||||
|
||||
|
||||
#ifndef WMAX
|
||||
# define WMAX(a,b) ((a)>(b) ? (a) : (b))
|
||||
@@ -231,7 +223,7 @@ char* wfindfile(char *paths, char *file);
|
||||
|
||||
char* wfindfileinlist(char **path_list, char *file);
|
||||
|
||||
char* wfindfileinarray(proplist_t array, char *file);
|
||||
char* wfindfileinarray(WMPropList* array, char *file);
|
||||
|
||||
char* wexpandpath(char *path);
|
||||
|
||||
@@ -761,6 +753,10 @@ WMPropList* WMRetainPropList(WMPropList *plist);
|
||||
|
||||
void WMReleasePropList(WMPropList *plist);
|
||||
|
||||
/* Objects inserted in arrays and dictionaries will be retained,
|
||||
* so you can safely release them after insertion.
|
||||
* For dictionaries both the key and value are retained.
|
||||
* Objects removed from arrays or dictionaries are released */
|
||||
void WMInsertInPLArray(WMPropList *plist, int index, WMPropList *item);
|
||||
|
||||
void WMAddToPLArray(WMPropList *plist, WMPropList *item);
|
||||
@@ -773,6 +769,9 @@ void WMPutInPLDictionary(WMPropList *plist, WMPropList *key, WMPropList *value);
|
||||
|
||||
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);
|
||||
|
||||
int WMGetPropListItemCount(WMPropList *plist);
|
||||
@@ -787,26 +786,38 @@ Bool WMIsPLDictionary(WMPropList *plist);
|
||||
|
||||
Bool WMIsPropListEqualTo(WMPropList *plist, WMPropList *other);
|
||||
|
||||
/* Returns a reference. Do not free it! */
|
||||
char* WMGetFromPLString(WMPropList *plist);
|
||||
|
||||
/* Returns a reference. Do not free it! */
|
||||
WMData* WMGetFromPLData(WMPropList *plist);
|
||||
|
||||
/* Returns a reference. Do not free it! */
|
||||
const unsigned char* WMGetPLDataBytes(WMPropList *plist);
|
||||
|
||||
int WMGetPLDataLength(WMPropList *plist);
|
||||
|
||||
/* Returns a reference. */
|
||||
WMPropList* WMGetFromPLArray(WMPropList *plist, int index);
|
||||
|
||||
/* Returns a reference. */
|
||||
WMPropList* WMGetFromPLDictionary(WMPropList *plist, WMPropList *key);
|
||||
|
||||
/* Returns a PropList array with all the dictionary keys. Release it when
|
||||
* you're done. Keys in array are retained from the original dictionary
|
||||
* not copied */
|
||||
WMPropList* WMGetPLDictionaryKeys(WMPropList *plist);
|
||||
|
||||
/* Creates only the first level deep object. All the elements inside are
|
||||
* retained from the original */
|
||||
WMPropList* WMShallowCopyPropList(WMPropList *plist);
|
||||
|
||||
/* Makes a completely separate replica of the original proplist */
|
||||
WMPropList* WMDeepCopyPropList(WMPropList *plist);
|
||||
|
||||
WMPropList* WMCreatePropListFromDescription(char *desc);
|
||||
|
||||
/* Free the returned string when you're done */
|
||||
char* WMGetPropListDescription(WMPropList *plist, Bool indented);
|
||||
|
||||
WMPropList* WMReadPropListFromFile(char *file);
|
||||
@@ -825,14 +836,14 @@ void WMSaveUserDefaults(WMUserDefaults *database);
|
||||
|
||||
void WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable);
|
||||
|
||||
/* Returns a PLArray with all keys in the user defaults database.
|
||||
* Free the returned array with PLRelease() when no longer needed,
|
||||
* but do not free the elements of the array! They're just references. */
|
||||
proplist_t WMGetUDAllKeys(WMUserDefaults *database);
|
||||
/* Returns a WMPropList array with all the keys in the user defaults database.
|
||||
* Free the array with WMReleasePropList() when no longer needed.
|
||||
* Keys in array are just retained references to the original keys */
|
||||
WMPropList* WMGetUDKeys(WMUserDefaults *database);
|
||||
|
||||
proplist_t WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
WMPropList* WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
void WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
|
||||
void WMSetUDObjectForKey(WMUserDefaults *database, WMPropList *object,
|
||||
char *defaultName);
|
||||
|
||||
void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
@@ -857,9 +868,9 @@ void WMSetUDFloatForKey(WMUserDefaults *database, float value,
|
||||
void WMSetUDBoolForKey(WMUserDefaults *database, Bool value,
|
||||
char *defaultName);
|
||||
|
||||
proplist_t WMGetUDSearchList(WMUserDefaults *database);
|
||||
WMPropList* WMGetUDSearchList(WMUserDefaults *database);
|
||||
|
||||
void WMSetUDSearchList(WMUserDefaults *database, proplist_t list);
|
||||
void WMSetUDSearchList(WMUserDefaults *database, WMPropList *list);
|
||||
|
||||
extern char *WMUserDefaultsDidChangeNotification;
|
||||
|
||||
|
||||
@@ -1,3 +1,56 @@
|
||||
/*
|
||||
* This header file is provided for old libPropList compatibility.
|
||||
* DO _NOT_ USE this except for letting your old libPropList-based code to
|
||||
* work with the new property list code from WINGs, with minimal changes.
|
||||
*
|
||||
* All code written with old libPropList functions should work, given
|
||||
* that the following changes are made:
|
||||
*
|
||||
* 1. Replace all
|
||||
* #include <proplist.h>
|
||||
* with
|
||||
* #include <WINGs/proplist-compat.h>
|
||||
* in your code.
|
||||
*
|
||||
* 2. Change all calls to PLSave() to have the extra filename parameter like:
|
||||
* PLSave(proplist_t proplist, char* filename, Bool atomically)
|
||||
*
|
||||
* 3. The PLSetStringCmpHook() function is no longer available. There is a
|
||||
* similar but simpler function provided which is enough for practical
|
||||
* purposes:
|
||||
* PLSetCaseSensitive(Bool caseSensitive)
|
||||
*
|
||||
* 4. The following functions do no longer exist. They were removed because
|
||||
* they were based on concepts borrowed from UserDefaults which conflict
|
||||
* with the retain/release mechanism:
|
||||
* PLSynchronize(), PLDeepSynchronize(), PLShallowSynchronize()
|
||||
* PLSetFilename(), PLGetFilename()
|
||||
* PLGetContainer()
|
||||
* You should change your code to not use them anymore.
|
||||
*
|
||||
* 5. The following functions are no longer available. They were removed
|
||||
* because they also used borrowed concepts which have no place in a
|
||||
* property list as defined in the OpenStep specifications. Also these
|
||||
* functions were hardly ever used in programs to our knowledge.
|
||||
* PLGetDomainNames(), PLGetDomain(), PLSetDomain(), PLDeleteDomain()
|
||||
* PLRegister(), PLUnregister()
|
||||
* You should also change your code to not use them anymore (in case you
|
||||
* ever used them anyway ;-) ).
|
||||
*
|
||||
* 6. Link your program with libWINGs or libWUtil instead of libPropList.
|
||||
* (libWINGs should be used for GUI apps, while libWUtil for non-GUI apps)
|
||||
*
|
||||
*
|
||||
* Our recommandation is to rewrite your code to use the new functions and
|
||||
* link against libWINGs/libWUtil. We do not recommend you to keep using old
|
||||
* libPropList function names. This file is provided just to allow existing
|
||||
* libropList based applications to run with minimal changes with the new
|
||||
* proplist code from WINGs before their authors get the time to rewrite
|
||||
* them. New proplist code from WINGs provide a better integration with the
|
||||
* other data types from WINGs, not to mention that the proplist code in WINGs
|
||||
* is actively maintained while the old libPropList is dead.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PROPLIST_COMPAT_H_
|
||||
@@ -12,8 +65,8 @@ typedef WMPropList* proplist_t;
|
||||
|
||||
#define PLMakeString(bytes) WMCreatePLString(bytes)
|
||||
#define PLMakeData(bytes, length) WMCreatePLDataFromBytes(bytes, length)
|
||||
#define PLMakeArrayFromElements(pl, ...) WMCreatePLArray(pl, ...)
|
||||
#define PLMakeDictionaryFromEntries(key, value, ...) WMCreatePLDictionary(key, value, ...)
|
||||
#define PLMakeArrayFromElements WMCreatePLArray
|
||||
#define PLMakeDictionaryFromEntries WMCreatePLDictionary
|
||||
|
||||
#define PLRetain(pl) WMRetainPropList(pl)
|
||||
#define PLRelease(pl) WMReleasePropList(pl)
|
||||
@@ -38,7 +91,7 @@ typedef WMPropList* proplist_t;
|
||||
#define PLGetString(pl) WMGetFromPLString(pl)
|
||||
#define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
|
||||
#define PLGetDataLength(pl) WMGetPLDataLength(pl)
|
||||
#define PLGetArrayElement(pl, index) WMGetFromArray(pl, index)
|
||||
#define PLGetArrayElement(pl, index) WMGetFromPLArray(pl, index)
|
||||
#define PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
|
||||
#define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
|
||||
|
||||
@@ -55,20 +108,22 @@ typedef WMPropList* proplist_t;
|
||||
#define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
|
||||
|
||||
|
||||
#if 0
|
||||
#define PLSetStringCmpHook(fn)
|
||||
#define PLDeepSynchronize(pl) PLDeepSynchronize_is_not_supported
|
||||
#define PLSynchronize(pl) PLSynchronize_is_not_supported
|
||||
#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
|
||||
#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
|
||||
#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
|
||||
#define PLGetContainer(pl)
|
||||
|
||||
//#define PLSetStringCmpHook(fn)
|
||||
//#define PLDeepSynchronize(pl) PLDeepSynchronize_is_not_supported
|
||||
//#define PLSynchronize(pl) PLSynchronize_is_not_supported
|
||||
//#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
|
||||
//#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
|
||||
//#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
|
||||
//#define PLGetDomainNames()
|
||||
//#define PLGetDomain(name)
|
||||
//#define PLSetDomain(name, value, kickme)
|
||||
//#define PLDeleteDomain(name, kickme)
|
||||
//#define PLRegister(name, callback)
|
||||
//#define PLUnregister(name)
|
||||
//#define PLGetContainer(pl)
|
||||
#define PLGetDomainNames()
|
||||
#define PLGetDomain(name)
|
||||
#define PLSetDomain(name, value, kickme)
|
||||
#define PLDeleteDomain(name, kickme)
|
||||
#define PLRegister(name, callback)
|
||||
#define PLUnregister(name)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user