mirror of https://github.com/python/cpython.git
Added CFPreferences support. Added these as functions, not methods, which seemed counter-intuitive.
This commit is contained in:
parent
4402241450
commit
23be1ceb51
|
@ -28,6 +28,7 @@
|
||||||
#include <CFString.h>
|
#include <CFString.h>
|
||||||
#include <CFURL.h>
|
#include <CFURL.h>
|
||||||
#include <CFPropertyList.h>
|
#include <CFPropertyList.h>
|
||||||
|
#include <CFPreferences.h>
|
||||||
#else
|
#else
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -3320,6 +3321,323 @@ static PyObject *CF_CFDictionaryCreateMutableCopy(PyObject *_self, PyObject *_ar
|
||||||
return _res;
|
return _res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesCopyAppValue(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFTypeRef _rv;
|
||||||
|
CFStringRef key;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
#ifndef CFPreferencesCopyAppValue
|
||||||
|
PyMac_PRECHECK(CFPreferencesCopyAppValue);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&",
|
||||||
|
CFStringRefObj_Convert, &key,
|
||||||
|
CFStringRefObj_Convert, &applicationID))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesCopyAppValue(key,
|
||||||
|
applicationID);
|
||||||
|
_res = Py_BuildValue("O&",
|
||||||
|
CFTypeRefObj_New, _rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesGetAppBooleanValue(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
Boolean _rv;
|
||||||
|
CFStringRef key;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
Boolean keyExistsAndHasValidFormat;
|
||||||
|
#ifndef CFPreferencesGetAppBooleanValue
|
||||||
|
PyMac_PRECHECK(CFPreferencesGetAppBooleanValue);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&",
|
||||||
|
CFStringRefObj_Convert, &key,
|
||||||
|
CFStringRefObj_Convert, &applicationID))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesGetAppBooleanValue(key,
|
||||||
|
applicationID,
|
||||||
|
&keyExistsAndHasValidFormat);
|
||||||
|
_res = Py_BuildValue("ll",
|
||||||
|
_rv,
|
||||||
|
keyExistsAndHasValidFormat);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesGetAppIntegerValue(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFIndex _rv;
|
||||||
|
CFStringRef key;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
Boolean keyExistsAndHasValidFormat;
|
||||||
|
#ifndef CFPreferencesGetAppIntegerValue
|
||||||
|
PyMac_PRECHECK(CFPreferencesGetAppIntegerValue);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&",
|
||||||
|
CFStringRefObj_Convert, &key,
|
||||||
|
CFStringRefObj_Convert, &applicationID))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesGetAppIntegerValue(key,
|
||||||
|
applicationID,
|
||||||
|
&keyExistsAndHasValidFormat);
|
||||||
|
_res = Py_BuildValue("ll",
|
||||||
|
_rv,
|
||||||
|
keyExistsAndHasValidFormat);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesSetAppValue(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFStringRef key;
|
||||||
|
CFTypeRef value;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
#ifndef CFPreferencesSetAppValue
|
||||||
|
PyMac_PRECHECK(CFPreferencesSetAppValue);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&",
|
||||||
|
CFStringRefObj_Convert, &key,
|
||||||
|
CFTypeRefObj_Convert, &value,
|
||||||
|
CFStringRefObj_Convert, &applicationID))
|
||||||
|
return NULL;
|
||||||
|
CFPreferencesSetAppValue(key,
|
||||||
|
value,
|
||||||
|
applicationID);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_res = Py_None;
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesAddSuitePreferencesToApp(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef suiteID;
|
||||||
|
#ifndef CFPreferencesAddSuitePreferencesToApp
|
||||||
|
PyMac_PRECHECK(CFPreferencesAddSuitePreferencesToApp);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&",
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &suiteID))
|
||||||
|
return NULL;
|
||||||
|
CFPreferencesAddSuitePreferencesToApp(applicationID,
|
||||||
|
suiteID);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_res = Py_None;
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesRemoveSuitePreferencesFromApp(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef suiteID;
|
||||||
|
#ifndef CFPreferencesRemoveSuitePreferencesFromApp
|
||||||
|
PyMac_PRECHECK(CFPreferencesRemoveSuitePreferencesFromApp);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&",
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &suiteID))
|
||||||
|
return NULL;
|
||||||
|
CFPreferencesRemoveSuitePreferencesFromApp(applicationID,
|
||||||
|
suiteID);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_res = Py_None;
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesAppSynchronize(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
Boolean _rv;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
#ifndef CFPreferencesAppSynchronize
|
||||||
|
PyMac_PRECHECK(CFPreferencesAppSynchronize);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&",
|
||||||
|
CFStringRefObj_Convert, &applicationID))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesAppSynchronize(applicationID);
|
||||||
|
_res = Py_BuildValue("l",
|
||||||
|
_rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesCopyValue(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFTypeRef _rv;
|
||||||
|
CFStringRef key;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesCopyValue
|
||||||
|
PyMac_PRECHECK(CFPreferencesCopyValue);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&O&",
|
||||||
|
CFStringRefObj_Convert, &key,
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesCopyValue(key,
|
||||||
|
applicationID,
|
||||||
|
userName,
|
||||||
|
hostName);
|
||||||
|
_res = Py_BuildValue("O&",
|
||||||
|
CFTypeRefObj_New, _rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesCopyMultiple(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFDictionaryRef _rv;
|
||||||
|
CFArrayRef keysToFetch;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesCopyMultiple
|
||||||
|
PyMac_PRECHECK(CFPreferencesCopyMultiple);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&O&",
|
||||||
|
CFArrayRefObj_Convert, &keysToFetch,
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesCopyMultiple(keysToFetch,
|
||||||
|
applicationID,
|
||||||
|
userName,
|
||||||
|
hostName);
|
||||||
|
_res = Py_BuildValue("O&",
|
||||||
|
CFDictionaryRefObj_New, _rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesSetValue(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFStringRef key;
|
||||||
|
CFTypeRef value;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesSetValue
|
||||||
|
PyMac_PRECHECK(CFPreferencesSetValue);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
|
||||||
|
CFStringRefObj_Convert, &key,
|
||||||
|
CFTypeRefObj_Convert, &value,
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
CFPreferencesSetValue(key,
|
||||||
|
value,
|
||||||
|
applicationID,
|
||||||
|
userName,
|
||||||
|
hostName);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_res = Py_None;
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesSetMultiple(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFDictionaryRef keysToSet;
|
||||||
|
CFArrayRef keysToRemove;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesSetMultiple
|
||||||
|
PyMac_PRECHECK(CFPreferencesSetMultiple);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
|
||||||
|
CFDictionaryRefObj_Convert, &keysToSet,
|
||||||
|
CFArrayRefObj_Convert, &keysToRemove,
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
CFPreferencesSetMultiple(keysToSet,
|
||||||
|
keysToRemove,
|
||||||
|
applicationID,
|
||||||
|
userName,
|
||||||
|
hostName);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_res = Py_None;
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesSynchronize(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
Boolean _rv;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesSynchronize
|
||||||
|
PyMac_PRECHECK(CFPreferencesSynchronize);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&",
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesSynchronize(applicationID,
|
||||||
|
userName,
|
||||||
|
hostName);
|
||||||
|
_res = Py_BuildValue("l",
|
||||||
|
_rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesCopyApplicationList(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFArrayRef _rv;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesCopyApplicationList
|
||||||
|
PyMac_PRECHECK(CFPreferencesCopyApplicationList);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&",
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesCopyApplicationList(userName,
|
||||||
|
hostName);
|
||||||
|
_res = Py_BuildValue("O&",
|
||||||
|
CFArrayRefObj_New, _rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *CF_CFPreferencesCopyKeyList(PyObject *_self, PyObject *_args)
|
||||||
|
{
|
||||||
|
PyObject *_res = NULL;
|
||||||
|
CFArrayRef _rv;
|
||||||
|
CFStringRef applicationID;
|
||||||
|
CFStringRef userName;
|
||||||
|
CFStringRef hostName;
|
||||||
|
#ifndef CFPreferencesCopyKeyList
|
||||||
|
PyMac_PRECHECK(CFPreferencesCopyKeyList);
|
||||||
|
#endif
|
||||||
|
if (!PyArg_ParseTuple(_args, "O&O&O&",
|
||||||
|
CFStringRefObj_Convert, &applicationID,
|
||||||
|
CFStringRefObj_Convert, &userName,
|
||||||
|
CFStringRefObj_Convert, &hostName))
|
||||||
|
return NULL;
|
||||||
|
_rv = CFPreferencesCopyKeyList(applicationID,
|
||||||
|
userName,
|
||||||
|
hostName);
|
||||||
|
_res = Py_BuildValue("O&",
|
||||||
|
CFArrayRefObj_New, _rv);
|
||||||
|
return _res;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *CF_CFStringGetTypeID(PyObject *_self, PyObject *_args)
|
static PyObject *CF_CFStringGetTypeID(PyObject *_self, PyObject *_args)
|
||||||
{
|
{
|
||||||
PyObject *_res = NULL;
|
PyObject *_res = NULL;
|
||||||
|
@ -3884,6 +4202,34 @@ static PyMethodDef CF_methods[] = {
|
||||||
"(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
|
"(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
|
||||||
{"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
|
{"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
|
||||||
"(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)"},
|
"(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)"},
|
||||||
|
{"CFPreferencesCopyAppValue", (PyCFunction)CF_CFPreferencesCopyAppValue, 1,
|
||||||
|
"(CFStringRef key, CFStringRef applicationID) -> (CFTypeRef _rv)"},
|
||||||
|
{"CFPreferencesGetAppBooleanValue", (PyCFunction)CF_CFPreferencesGetAppBooleanValue, 1,
|
||||||
|
"(CFStringRef key, CFStringRef applicationID) -> (Boolean _rv, Boolean keyExistsAndHasValidFormat)"},
|
||||||
|
{"CFPreferencesGetAppIntegerValue", (PyCFunction)CF_CFPreferencesGetAppIntegerValue, 1,
|
||||||
|
"(CFStringRef key, CFStringRef applicationID) -> (CFIndex _rv, Boolean keyExistsAndHasValidFormat)"},
|
||||||
|
{"CFPreferencesSetAppValue", (PyCFunction)CF_CFPreferencesSetAppValue, 1,
|
||||||
|
"(CFStringRef key, CFTypeRef value, CFStringRef applicationID) -> None"},
|
||||||
|
{"CFPreferencesAddSuitePreferencesToApp", (PyCFunction)CF_CFPreferencesAddSuitePreferencesToApp, 1,
|
||||||
|
"(CFStringRef applicationID, CFStringRef suiteID) -> None"},
|
||||||
|
{"CFPreferencesRemoveSuitePreferencesFromApp", (PyCFunction)CF_CFPreferencesRemoveSuitePreferencesFromApp, 1,
|
||||||
|
"(CFStringRef applicationID, CFStringRef suiteID) -> None"},
|
||||||
|
{"CFPreferencesAppSynchronize", (PyCFunction)CF_CFPreferencesAppSynchronize, 1,
|
||||||
|
"(CFStringRef applicationID) -> (Boolean _rv)"},
|
||||||
|
{"CFPreferencesCopyValue", (PyCFunction)CF_CFPreferencesCopyValue, 1,
|
||||||
|
"(CFStringRef key, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFTypeRef _rv)"},
|
||||||
|
{"CFPreferencesCopyMultiple", (PyCFunction)CF_CFPreferencesCopyMultiple, 1,
|
||||||
|
"(CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFDictionaryRef _rv)"},
|
||||||
|
{"CFPreferencesSetValue", (PyCFunction)CF_CFPreferencesSetValue, 1,
|
||||||
|
"(CFStringRef key, CFTypeRef value, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None"},
|
||||||
|
{"CFPreferencesSetMultiple", (PyCFunction)CF_CFPreferencesSetMultiple, 1,
|
||||||
|
"(CFDictionaryRef keysToSet, CFArrayRef keysToRemove, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None"},
|
||||||
|
{"CFPreferencesSynchronize", (PyCFunction)CF_CFPreferencesSynchronize, 1,
|
||||||
|
"(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (Boolean _rv)"},
|
||||||
|
{"CFPreferencesCopyApplicationList", (PyCFunction)CF_CFPreferencesCopyApplicationList, 1,
|
||||||
|
"(CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)"},
|
||||||
|
{"CFPreferencesCopyKeyList", (PyCFunction)CF_CFPreferencesCopyKeyList, 1,
|
||||||
|
"(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)"},
|
||||||
{"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
|
{"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
|
||||||
"() -> (CFTypeID _rv)"},
|
"() -> (CFTypeID _rv)"},
|
||||||
{"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
|
{"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
|
||||||
|
@ -4017,6 +4363,17 @@ void init_CF(void)
|
||||||
Py_INCREF(&CFURLRef_Type);
|
Py_INCREF(&CFURLRef_Type);
|
||||||
if (PyDict_SetItemString(d, "CFURLRefType", (PyObject *)&CFURLRef_Type) != 0)
|
if (PyDict_SetItemString(d, "CFURLRefType", (PyObject *)&CFURLRef_Type) != 0)
|
||||||
Py_FatalError("can't initialize CFURLRefType");
|
Py_FatalError("can't initialize CFURLRefType");
|
||||||
|
|
||||||
|
#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
|
||||||
|
_STRINGCONST(kCFPreferencesAnyApplication);
|
||||||
|
_STRINGCONST(kCFPreferencesCurrentApplication);
|
||||||
|
_STRINGCONST(kCFPreferencesAnyHost);
|
||||||
|
_STRINGCONST(kCFPreferencesCurrentHost);
|
||||||
|
_STRINGCONST(kCFPreferencesAnyUser);
|
||||||
|
_STRINGCONST(kCFPreferencesCurrentUser);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================= End module _CF ========================= */
|
/* ========================= End module _CF ========================= */
|
||||||
|
|
|
@ -31,7 +31,7 @@ def main():
|
||||||
"CFDictionary.h",
|
"CFDictionary.h",
|
||||||
## "CFNumber.h",
|
## "CFNumber.h",
|
||||||
## "CFPlugIn.h",
|
## "CFPlugIn.h",
|
||||||
## "CFPreferences.h",
|
"CFPreferences.h",
|
||||||
"CFPropertyList.h",
|
"CFPropertyList.h",
|
||||||
## "CFSet.h",
|
## "CFSet.h",
|
||||||
"CFString.h",
|
"CFString.h",
|
||||||
|
@ -54,7 +54,7 @@ class MyScanner(Scanner_OSX):
|
||||||
def destination(self, type, name, arglist):
|
def destination(self, type, name, arglist):
|
||||||
classname = "Function"
|
classname = "Function"
|
||||||
listname = "functions"
|
listname = "functions"
|
||||||
if arglist:
|
if arglist and name[:13] != 'CFPreferences':
|
||||||
t, n, m = arglist[0]
|
t, n, m = arglist[0]
|
||||||
if t in OBJECTS and m == "InMode":
|
if t in OBJECTS and m == "InMode":
|
||||||
classname = "Method"
|
classname = "Method"
|
||||||
|
|
|
@ -50,6 +50,7 @@ def parseArgumentList(self, args):
|
||||||
#include <CFString.h>
|
#include <CFString.h>
|
||||||
#include <CFURL.h>
|
#include <CFURL.h>
|
||||||
#include <CFPropertyList.h>
|
#include <CFPropertyList.h>
|
||||||
|
#include <CFPreferences.h>
|
||||||
#else
|
#else
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -165,6 +166,17 @@ def parseArgumentList(self, args):
|
||||||
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert);
|
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
variablestuff="""
|
||||||
|
#define _STRINGCONST(name) PyModule_AddObject(m, #name, CFStringRefObj_New(name))
|
||||||
|
_STRINGCONST(kCFPreferencesAnyApplication);
|
||||||
|
_STRINGCONST(kCFPreferencesCurrentApplication);
|
||||||
|
_STRINGCONST(kCFPreferencesAnyHost);
|
||||||
|
_STRINGCONST(kCFPreferencesCurrentHost);
|
||||||
|
_STRINGCONST(kCFPreferencesAnyUser);
|
||||||
|
_STRINGCONST(kCFPreferencesCurrentUser);
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
Boolean = Type("Boolean", "l")
|
Boolean = Type("Boolean", "l")
|
||||||
CFTypeID = Type("CFTypeID", "l") # XXXX a guess, seems better than OSTypeType.
|
CFTypeID = Type("CFTypeID", "l") # XXXX a guess, seems better than OSTypeType.
|
||||||
CFHashCode = Type("CFHashCode", "l")
|
CFHashCode = Type("CFHashCode", "l")
|
||||||
|
@ -405,7 +417,7 @@ def outputRepr(self):
|
||||||
# From here on it's basically all boiler plate...
|
# From here on it's basically all boiler plate...
|
||||||
|
|
||||||
# Create the generator groups and link them
|
# Create the generator groups and link them
|
||||||
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
|
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)
|
||||||
CFTypeRef_object = CFTypeRefObjectDefinition('CFTypeRef', 'CFTypeRefObj', 'CFTypeRef')
|
CFTypeRef_object = CFTypeRefObjectDefinition('CFTypeRef', 'CFTypeRefObj', 'CFTypeRef')
|
||||||
CFArrayRef_object = CFArrayRefObjectDefinition('CFArrayRef', 'CFArrayRefObj', 'CFArrayRef')
|
CFArrayRef_object = CFArrayRefObjectDefinition('CFArrayRef', 'CFArrayRefObj', 'CFArrayRef')
|
||||||
CFMutableArrayRef_object = CFMutableArrayRefObjectDefinition('CFMutableArrayRef', 'CFMutableArrayRefObj', 'CFMutableArrayRef')
|
CFMutableArrayRef_object = CFMutableArrayRefObjectDefinition('CFMutableArrayRef', 'CFMutableArrayRefObj', 'CFMutableArrayRef')
|
||||||
|
|
Loading…
Reference in New Issue