summaryrefslogtreecommitdiff
path: root/data/uicaboodle.py
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-07-24 00:44:25 +0000
committerJay Freeman <saurik@saurik.com>2008-07-24 00:44:25 +0000
commit62aa52291982c9b377b08e65d4ec72efc89221b9 (patch)
tree37d149333bbf96dc82fee5d139b83908db332929 /data/uicaboodle.py
parent65512e67f20607810bfc8e2aa72adf770d720b58 (diff)
Added backwards compatibility for UICaboodle (mostly due to confusion).
git-svn-id: http://svn.telesphoreo.org/trunk@382 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/uicaboodle.py')
-rw-r--r--data/uicaboodle.py/_metadata/version2
-rw-r--r--data/uicaboodle.py/uicaboodle.m36
2 files changed, 30 insertions, 8 deletions
diff --git a/data/uicaboodle.py/_metadata/version b/data/uicaboodle.py/_metadata/version
index 14fde4785..6fd80a11c 100644
--- a/data/uicaboodle.py/_metadata/version
+++ b/data/uicaboodle.py/_metadata/version
@@ -1 +1 @@
-1.0.2307
+1.0.2491
diff --git a/data/uicaboodle.py/uicaboodle.m b/data/uicaboodle.py/uicaboodle.m
index aa219ec52..d40750cf0 100644
--- a/data/uicaboodle.py/uicaboodle.m
+++ b/data/uicaboodle.py/uicaboodle.m
@@ -21,19 +21,32 @@ static PyObject* objc_UIApplicationMain(
int res = -1;
PyObject *arga;
- PyObject *_class;
+ PyObject *_class = NULL;
+
+#ifdef __OBJC2__
+ PyObject *principal;
+ PyObject *delegate;
+#endif
_assert(PyObjC_API != NULL);
_assert(args != NULL);
- /* XXX: correctly parse __OBJC2__ condition */
- if (!PyArg_ParseTuple(args, "OO", &arga, &_class)) {
- PyErr_SetString(PyExc_TypeError, "Invalid Arguments");
+ if (PyArg_ParseTuple(args, "OO", &arga, &_class)) {
+ if (_class == NULL) {
+ PyErr_SetString(PyExc_TypeError, "UIApplicationMain: null class");
+ return NULL;
+ }
+ }
+#ifdef __OBJC2__
+ else if (!PyArg_ParseTuple(args, "OOO", &arga, &principal, &delegate)) {
+ }
+#endif
+ else {
+ PyErr_SetString(PyExc_TypeError, "Invalid Arguments");
return NULL;
}
_assert(arga != NULL);
- _assert(_class != NULL);
argc = PySequence_Size(arga);
argv = calloc(argc + 1, sizeof(char *));
@@ -64,9 +77,18 @@ static PyObject* objc_UIApplicationMain(
PyObjC_DURING
#ifdef __OBJC2__
- res = UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:class_getName(PyObjC_API->cls_get_class(_class))]);
+ if (_class == NULL)
+ res = UIApplicationMain(argc, argv,
+ /* XXX: do I have to do these null checks? */
+ principal == NULL ? nil : PyObjCObject_GetObject(principal),
+ delegate == NULL ? nil : PyObjCObject_GetObject(delegate)
+ );
+ else {
+ NSString *name = [NSString stringWithUTF8String:class_getName(PyObjCClass_GetClass(_class))];
+ res = UIApplicationMain(argc, argv, name, name);
+ }
#else
- res = UIApplicationMain(argc, argv, PyObjC_API->cls_get_class(_class));
+ res = UIApplicationMain(argc, argv, PyObjCClass_GetClass(_class));
#endif
PyObjC_HANDLER
PyObjCErr_FromObjC(localException);