[Pyobjc-dev] Interfacing with CF/Carbon API from PyObjC
Brought to you by:
ronaldoussoren
From: aesboe <ae...@gm...> - 2007-02-25 08:01:05
|
Hello all, I would like to access the Carbon MDQuery API from PyObjC. I cannot use the Cocoa API because it has some limitations. I've searched on this mailing list and googled for tips on glueing CF and PyObjc but I can't seem to find anything. I've pasted a simple outline of my CF based C code below. Is there anyway I could rewrite this in PyObjC? Or wrap it in Python and access it from within PyObjC? Any pointers/suggestions would be greatly appreciated - I am stuck/frustrated with the Cocoa API :) Thanks isb #include <CoreServices/CoreServices.h> static void MyCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { // ... } int main (int argc, const char * argv[]) { MDQueryRef query; query = MDQueryCreate(kCFAllocatorDefault, CFSTR("MDItemKeywords == '*Tiger*'"), NULL, NULL); CFNotificationCenterRef nc = CFNotificationCenterGetLocalCenter(); // register callback for results CFNotificationCenterAddObserver(nc, NULL, &MyCallback, kMDQueryDidUpdateNotification, query, CFNotificationSuspensionBehaviorDeliverImmediately); MDQueryExecute(query, kMDQueryWantsUpdates); CFRunLoopRun(); return 0; } |