annotate Mac/Modules/launch/_Launchmodule.c @ 37850:ebe59cd18273

Use explicit relative import for an, ehm, relative import.
author Thomas Wouters <thomas@python.org>
date Tue, 18 Apr 2006 21:41:36 +0000
parents 5df1c692bb41
children c34e34057714
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 /* ========================= Module _Launch ========================= */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4 #include "Python.h"
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8 #include "pymactoolbox.h"
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 /* Macro to test whether a weak-loaded CFM function exists */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
12 PyErr_SetString(PyExc_NotImplementedError, \
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
13 "Not available in this shared library/OS version"); \
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
14 return NULL; \
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 }} while(0)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17
31160
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
18 #if PY_VERSION_HEX < 0x02040000
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
19 PyObject *PyMac_GetOSErrException(void);
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
20 #endif
2a0782cc151f Made this module compatible with Python2.3, and added a temporary setup
Jack Jansen <jack.jansen@cwi.nl>
parents: 31091
diff changeset
21
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22 #include <ApplicationServices/ApplicationServices.h>
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24 /*
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 ** Optional CFStringRef. None will pass NULL
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27 static int
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28 OptCFStringRefObj_Convert(PyObject *v, CFStringRef *spec)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
30 if (v == Py_None) {
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
31 *spec = NULL;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
32 return 1;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
33 }
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
34 return CFStringRefObj_Convert(v, spec);
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
35 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
37 PyObject *
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
38 OptCFStringRefObj_New(CFStringRef it)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
40 if (it == NULL) {
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
41 Py_INCREF(Py_None);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
42 return Py_None;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
43 }
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
44 return CFStringRefObj_New(it);
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47 /*
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48 ** Convert LSItemInfoRecord to Python.
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50 PyObject *
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
51 LSItemInfoRecord_New(LSItemInfoRecord *it)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
52 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
53 return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}",
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
54 "flags", it->flags,
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
55 "filetype", PyMac_BuildOSType, it->filetype,
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
56 "creator", PyMac_BuildOSType, it->creator,
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
57 "extension", OptCFStringRefObj_New, it->extension,
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
58 "iconFileName", OptCFStringRefObj_New, it->iconFileName,
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 31160
diff changeset
59 "kindID", it->kindID);
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
60 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
61
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
62 static PyObject *Launch_Error;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
63
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
64 static PyObject *Launch_LSCopyItemInfoForRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
65 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
66 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
67 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 FSRef inItemRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69 LSRequestedInfo inWhichInfo;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
70 LSItemInfoRecord outItemInfo;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
71 if (!PyArg_ParseTuple(_args, "O&l",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
72 PyMac_GetFSRef, &inItemRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
73 &inWhichInfo))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
74 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
75 _err = LSCopyItemInfoForRef(&inItemRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
76 inWhichInfo,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
77 &outItemInfo);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
78 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
79 _res = Py_BuildValue("O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
80 LSItemInfoRecord_New, &outItemInfo);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
81 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
82 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
83
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
84 static PyObject *Launch_LSCopyItemInfoForURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
85 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
86 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
87 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
88 CFURLRef inURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
89 LSRequestedInfo inWhichInfo;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
90 LSItemInfoRecord outItemInfo;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
91 if (!PyArg_ParseTuple(_args, "O&l",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
92 CFURLRefObj_Convert, &inURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
93 &inWhichInfo))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
94 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
95 _err = LSCopyItemInfoForURL(inURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
96 inWhichInfo,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
97 &outItemInfo);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
98 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
99 _res = Py_BuildValue("O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
100 LSItemInfoRecord_New, &outItemInfo);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
101 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
102 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
103
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
104 static PyObject *Launch_LSGetExtensionInfo(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
105 {
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
106 PyObject *_res = NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
107 OSStatus _err;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
108 UniChar *inNameLen__in__;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
109 UniCharCount inNameLen__len__;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
110 int inNameLen__in_len__;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
111 UniCharCount outExtStartIndex;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
112 if (!PyArg_ParseTuple(_args, "u#",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
113 &inNameLen__in__, &inNameLen__in_len__))
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
114 return NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
115 inNameLen__len__ = inNameLen__in_len__;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
116 _err = LSGetExtensionInfo(inNameLen__len__, inNameLen__in__,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
117 &outExtStartIndex);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
118 if (_err != noErr) return PyMac_Error(_err);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
119 _res = Py_BuildValue("l",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
120 outExtStartIndex);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
121 return _res;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
122 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
123
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
124 static PyObject *Launch_LSCopyDisplayNameForRef(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
125 {
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
126 PyObject *_res = NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
127 OSStatus _err;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
128 FSRef inRef;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
129 CFStringRef outDisplayName;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
130 if (!PyArg_ParseTuple(_args, "O&",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
131 PyMac_GetFSRef, &inRef))
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
132 return NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
133 _err = LSCopyDisplayNameForRef(&inRef,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
134 &outDisplayName);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
135 if (_err != noErr) return PyMac_Error(_err);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
136 _res = Py_BuildValue("O&",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
137 CFStringRefObj_New, outDisplayName);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
138 return _res;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
139 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
140
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
141 static PyObject *Launch_LSCopyDisplayNameForURL(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
142 {
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
143 PyObject *_res = NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
144 OSStatus _err;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
145 CFURLRef inURL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
146 CFStringRef outDisplayName;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
147 if (!PyArg_ParseTuple(_args, "O&",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
148 CFURLRefObj_Convert, &inURL))
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
149 return NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
150 _err = LSCopyDisplayNameForURL(inURL,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
151 &outDisplayName);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
152 if (_err != noErr) return PyMac_Error(_err);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
153 _res = Py_BuildValue("O&",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
154 CFStringRefObj_New, outDisplayName);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
155 return _res;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
156 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
157
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
158 static PyObject *Launch_LSSetExtensionHiddenForRef(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
159 {
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
160 PyObject *_res = NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
161 OSStatus _err;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
162 FSRef inRef;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
163 Boolean inHide;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
164 if (!PyArg_ParseTuple(_args, "O&b",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
165 PyMac_GetFSRef, &inRef,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
166 &inHide))
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
167 return NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
168 _err = LSSetExtensionHiddenForRef(&inRef,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
169 inHide);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
170 if (_err != noErr) return PyMac_Error(_err);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
171 Py_INCREF(Py_None);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
172 _res = Py_None;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
173 return _res;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
174 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
175
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
176 static PyObject *Launch_LSSetExtensionHiddenForURL(PyObject *_self, PyObject *_args)
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
177 {
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
178 PyObject *_res = NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
179 OSStatus _err;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
180 CFURLRef inURL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
181 Boolean inHide;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
182 if (!PyArg_ParseTuple(_args, "O&b",
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
183 CFURLRefObj_Convert, &inURL,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
184 &inHide))
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
185 return NULL;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
186 _err = LSSetExtensionHiddenForURL(inURL,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
187 inHide);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
188 if (_err != noErr) return PyMac_Error(_err);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
189 Py_INCREF(Py_None);
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
190 _res = Py_None;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
191 return _res;
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
192 }
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
193
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
194 static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
195 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
196 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
197 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
198 FSRef inFSRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
199 CFStringRef outKindString;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
200 if (!PyArg_ParseTuple(_args, "O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
201 PyMac_GetFSRef, &inFSRef))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
202 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
203 _err = LSCopyKindStringForRef(&inFSRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
204 &outKindString);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
205 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
206 _res = Py_BuildValue("O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
207 CFStringRefObj_New, outKindString);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
208 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
209 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
210
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
211 static PyObject *Launch_LSCopyKindStringForURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
212 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
213 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
214 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
215 CFURLRef inURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
216 CFStringRef outKindString;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
217 if (!PyArg_ParseTuple(_args, "O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
218 CFURLRefObj_Convert, &inURL))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
219 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
220 _err = LSCopyKindStringForURL(inURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
221 &outKindString);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
222 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
223 _res = Py_BuildValue("O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
224 CFStringRefObj_New, outKindString);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
225 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
226 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
227
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
228 static PyObject *Launch_LSGetApplicationForItem(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
229 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
230 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
231 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
232 FSRef inItemRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
233 LSRolesMask inRoleMask;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
234 FSRef outAppRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
235 CFURLRef outAppURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
236 if (!PyArg_ParseTuple(_args, "O&l",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
237 PyMac_GetFSRef, &inItemRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
238 &inRoleMask))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
239 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
240 _err = LSGetApplicationForItem(&inItemRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
241 inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
242 &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
243 &outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
244 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
245 _res = Py_BuildValue("O&O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
246 PyMac_BuildFSRef, &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
247 CFURLRefObj_New, outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
248 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
249 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
250
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
251 static PyObject *Launch_LSGetApplicationForInfo(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
252 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
253 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
254 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
255 OSType inType;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
256 OSType inCreator;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
257 CFStringRef inExtension;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
258 LSRolesMask inRoleMask;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
259 FSRef outAppRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
260 CFURLRef outAppURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
261 if (!PyArg_ParseTuple(_args, "O&O&O&l",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
262 PyMac_GetOSType, &inType,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
263 PyMac_GetOSType, &inCreator,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
264 OptCFStringRefObj_Convert, &inExtension,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
265 &inRoleMask))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
266 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
267 _err = LSGetApplicationForInfo(inType,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
268 inCreator,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
269 inExtension,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
270 inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
271 &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
272 &outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
273 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
274 _res = Py_BuildValue("O&O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
275 PyMac_BuildFSRef, &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
276 CFURLRefObj_New, outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
277 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
278 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
279
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
280 static PyObject *Launch_LSGetApplicationForURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
281 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
282 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
283 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
284 CFURLRef inURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
285 LSRolesMask inRoleMask;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
286 FSRef outAppRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
287 CFURLRef outAppURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
288 if (!PyArg_ParseTuple(_args, "O&l",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
289 CFURLRefObj_Convert, &inURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
290 &inRoleMask))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
291 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
292 _err = LSGetApplicationForURL(inURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
293 inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
294 &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
295 &outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
296 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
297 _res = Py_BuildValue("O&O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
298 PyMac_BuildFSRef, &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
299 CFURLRefObj_New, outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
300 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
301 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
302
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
303 static PyObject *Launch_LSFindApplicationForInfo(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
304 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
305 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
306 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
307 OSType inCreator;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
308 CFStringRef inBundleID;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
309 CFStringRef inName;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
310 FSRef outAppRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
311 CFURLRef outAppURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
312 if (!PyArg_ParseTuple(_args, "O&O&O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
313 PyMac_GetOSType, &inCreator,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
314 OptCFStringRefObj_Convert, &inBundleID,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
315 OptCFStringRefObj_Convert, &inName))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
316 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
317 _err = LSFindApplicationForInfo(inCreator,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
318 inBundleID,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
319 inName,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
320 &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
321 &outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
322 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
323 _res = Py_BuildValue("O&O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
324 PyMac_BuildFSRef, &outAppRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
325 CFURLRefObj_New, outAppURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
326 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
327 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
328
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
329 static PyObject *Launch_LSCanRefAcceptItem(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
330 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
331 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
332 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
333 FSRef inItemFSRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
334 FSRef inTargetRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
335 LSRolesMask inRoleMask;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
336 LSAcceptanceFlags inFlags;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
337 Boolean outAcceptsItem;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
338 if (!PyArg_ParseTuple(_args, "O&O&ll",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
339 PyMac_GetFSRef, &inItemFSRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
340 PyMac_GetFSRef, &inTargetRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
341 &inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
342 &inFlags))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
343 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
344 _err = LSCanRefAcceptItem(&inItemFSRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
345 &inTargetRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
346 inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
347 inFlags,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
348 &outAcceptsItem);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
349 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
350 _res = Py_BuildValue("b",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
351 outAcceptsItem);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
352 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
353 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
354
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
355 static PyObject *Launch_LSCanURLAcceptURL(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
356 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
357 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
358 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
359 CFURLRef inItemURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
360 CFURLRef inTargetURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
361 LSRolesMask inRoleMask;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
362 LSAcceptanceFlags inFlags;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
363 Boolean outAcceptsItem;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
364 if (!PyArg_ParseTuple(_args, "O&O&ll",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
365 CFURLRefObj_Convert, &inItemURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
366 CFURLRefObj_Convert, &inTargetURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
367 &inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
368 &inFlags))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
369 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
370 _err = LSCanURLAcceptURL(inItemURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
371 inTargetURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
372 inRoleMask,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
373 inFlags,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
374 &outAcceptsItem);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
375 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
376 _res = Py_BuildValue("b",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
377 outAcceptsItem);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
378 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
379 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
380
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
381 static PyObject *Launch_LSOpenFSRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
382 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
383 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
384 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
385 FSRef inRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
386 FSRef outLaunchedRef;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
387 if (!PyArg_ParseTuple(_args, "O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
388 PyMac_GetFSRef, &inRef))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
389 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
390 _err = LSOpenFSRef(&inRef,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
391 &outLaunchedRef);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
392 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
393 _res = Py_BuildValue("O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
394 PyMac_BuildFSRef, &outLaunchedRef);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
395 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
396 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
397
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
398 static PyObject *Launch_LSOpenCFURLRef(PyObject *_self, PyObject *_args)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
399 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
400 PyObject *_res = NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
401 OSStatus _err;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
402 CFURLRef inURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
403 CFURLRef outLaunchedURL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
404 if (!PyArg_ParseTuple(_args, "O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
405 CFURLRefObj_Convert, &inURL))
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
406 return NULL;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
407 _err = LSOpenCFURLRef(inURL,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
408 &outLaunchedURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
409 if (_err != noErr) return PyMac_Error(_err);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
410 _res = Py_BuildValue("O&",
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
411 CFURLRefObj_New, outLaunchedURL);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
412 return _res;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
413 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
414
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
415 static PyMethodDef Launch_methods[] = {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
416 {"LSCopyItemInfoForRef", (PyCFunction)Launch_LSCopyItemInfoForRef, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
417 PyDoc_STR("(FSRef inItemRef, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
418 {"LSCopyItemInfoForURL", (PyCFunction)Launch_LSCopyItemInfoForURL, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
419 PyDoc_STR("(CFURLRef inURL, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")},
31091
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
420 {"LSGetExtensionInfo", (PyCFunction)Launch_LSGetExtensionInfo, 1,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
421 PyDoc_STR("(Buffer inNameLen) -> (UniCharCount outExtStartIndex)")},
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
422 {"LSCopyDisplayNameForRef", (PyCFunction)Launch_LSCopyDisplayNameForRef, 1,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
423 PyDoc_STR("(FSRef inRef) -> (CFStringRef outDisplayName)")},
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
424 {"LSCopyDisplayNameForURL", (PyCFunction)Launch_LSCopyDisplayNameForURL, 1,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
425 PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outDisplayName)")},
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
426 {"LSSetExtensionHiddenForRef", (PyCFunction)Launch_LSSetExtensionHiddenForRef, 1,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
427 PyDoc_STR("(FSRef inRef, Boolean inHide) -> None")},
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
428 {"LSSetExtensionHiddenForURL", (PyCFunction)Launch_LSSetExtensionHiddenForURL, 1,
3861eb467c29 Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Jack Jansen <jack.jansen@cwi.nl>
parents: 31086
diff changeset
429 PyDoc_STR("(CFURLRef inURL, Boolean inHide) -> None")},
31075
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
430 {"LSCopyKindStringForRef", (PyCFunction)Launch_LSCopyKindStringForRef, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
431 PyDoc_STR("(FSRef inFSRef) -> (CFStringRef outKindString)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
432 {"LSCopyKindStringForURL", (PyCFunction)Launch_LSCopyKindStringForURL, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
433 PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outKindString)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
434 {"LSGetApplicationForItem", (PyCFunction)Launch_LSGetApplicationForItem, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
435 PyDoc_STR("(FSRef inItemRef, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
436 {"LSGetApplicationForInfo", (PyCFunction)Launch_LSGetApplicationForInfo, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
437 PyDoc_STR("(OSType inType, OSType inCreator, CFStringRef inExtension, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
438 {"LSGetApplicationForURL", (PyCFunction)Launch_LSGetApplicationForURL, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
439 PyDoc_STR("(CFURLRef inURL, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
440 {"LSFindApplicationForInfo", (PyCFunction)Launch_LSFindApplicationForInfo, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
441 PyDoc_STR("(OSType inCreator, CFStringRef inBundleID, CFStringRef inName) -> (FSRef outAppRef, CFURLRef outAppURL)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
442 {"LSCanRefAcceptItem", (PyCFunction)Launch_LSCanRefAcceptItem, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
443 PyDoc_STR("(FSRef inItemFSRef, FSRef inTargetRef, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
444 {"LSCanURLAcceptURL", (PyCFunction)Launch_LSCanURLAcceptURL, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
445 PyDoc_STR("(CFURLRef inItemURL, CFURLRef inTargetURL, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
446 {"LSOpenFSRef", (PyCFunction)Launch_LSOpenFSRef, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
447 PyDoc_STR("(FSRef inRef) -> (FSRef outLaunchedRef)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
448 {"LSOpenCFURLRef", (PyCFunction)Launch_LSOpenCFURLRef, 1,
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
449 PyDoc_STR("(CFURLRef inURL) -> (CFURLRef outLaunchedURL)")},
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
450 {NULL, NULL, 0}
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
451 };
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
452
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
453
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
454
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
455
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
456 void init_Launch(void)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
457 {
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
458 PyObject *m;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
459 PyObject *d;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
460
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
461
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
462
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
463
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
464 m = Py_InitModule("_Launch", Launch_methods);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
465 d = PyModule_GetDict(m);
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
466 Launch_Error = PyMac_GetOSErrException();
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
467 if (Launch_Error == NULL ||
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
468 PyDict_SetItemString(d, "Error", Launch_Error) != 0)
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
469 return;
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
470 }
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
471
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
472 /* ======================= End module _Launch ======================= */
5b515cc90b5a An interface to the LaunchServices API.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
473