Remove dead code from OSX overlay contextmenu.

This commit is contained in:
Mikkel Krautz 2009-03-22 12:56:22 +01:00
parent 5b42a49520
commit fbd9fa25fc
2 changed files with 28 additions and 60 deletions

View File

@ -139,53 +139,47 @@ static OSStatus ContextMenuHandleSelection(ContextMenuPlugin *p, AEDesc *desc, S
CFStringRef bundleFn = NULL;
CFArrayRef argv = NULL;
OSStatus err = noErr;
char *path;
FSRef ref;
if (commandId != 'OLAY')
return noErr;
ContextMenuGetAppBundlePath(desc, &path, NULL);
if (path) {
err = FSPathMakeRef((const UInt8 *) MUMBLE_OVERLAY_LAUNCHER_PATH, &ref, NULL);
if (err != noErr)
return noErr;
err = FSPathMakeRef((const UInt8 *) MUMBLE_OVERLAY_LAUNCHER_PATH, &ref, NULL);
if (err != noErr)
return noErr;
bundle = ContextMenuGetAppBundleFromDescList(desc);
if (!bundle)
goto out;
bundle = ContextMenuGetAppBundleFromDescList(desc);
if (!bundle)
goto out;
bundleUrl = CFBundleCopyBundleURL(bundle);
if (!bundleUrl)
goto out;
bundleUrl = CFBundleCopyBundleURL(bundle);
if (!bundleUrl)
goto out;
bundleFn = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle);
if (!bundleFn)
goto out;
bundleFn = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle);
if (!bundleFn)
goto out;
CFStringRef array[] = { bundleFn };
argv = CFArrayCreate(kCFAllocatorDefault, array, 1, NULL);
if (!argv)
goto out;
CFStringRef array[] = { bundleFn };
argv = CFArrayCreate(kCFAllocatorDefault, array, 1, NULL);
if (!argv)
goto out;
LSApplicationParameters parm = {
.version = 0,
.flags = kLSLaunchDefaults,
.application = &ref,
.asyncLaunchRefCon = NULL,
.environment = NULL,
.argv = argv,
.initialEvent = NULL
};
LSApplicationParameters parm = {
.version = 0,
.flags = kLSLaunchDefaults,
.application = &ref,
.asyncLaunchRefCon = NULL,
.environment = NULL,
.argv = argv,
.initialEvent = NULL
};
err = LSOpenApplication(&parm, NULL);
if (err != noErr)
goto out;
}
err = LSOpenApplication(&parm, NULL);
if (err != noErr)
goto out;
out:
if (path)
free(path);
if (bundle)
CFRelease(bundle);
if (bundleUrl)
@ -264,28 +258,3 @@ static bool ContextMenuAEDescIsAppBundle(const AEDesc *desc) {
return false;
}
static void ContextMenuGetAppBundlePath(const AEDesc *desc, char **path, int *len) {
if (!path)
return;
CFBundleRef bundle = ContextMenuGetAppBundleFromDescList(desc);
if (!bundle)
return;
CFURLRef bundleUrl = CFBundleCopyBundleURL(bundle);
CFStringRef bundleStr = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle);
CFIndex strLen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(bundleStr), kCFStringEncodingUTF8);
*path = calloc(strLen+1, 1);
if (*path) {
CFStringGetCString(bundleStr, *path, strLen, kCFStringEncodingUTF8);
if (len)
*len = (int) strLen;
}
CFRelease(bundleUrl);
CFRelease(bundleStr);
CFRelease(bundle);
}

View File

@ -71,6 +71,5 @@ static void ContextMenuDeallocateInstance(ContextMenuPlugin *p);
static CFBundleRef ContextMenuGetAppBundleFromDescList(const AEDesc *desc);
static bool ContextMenuAEDescIsAppBundle(const AEDesc *desc);
static void ContextMenuGetAppBundlePath(const AEDesc *desc, char **path, int *len);
#endif /* __CONTEXTMENU_H__ */