Thanks to Nick, I've started looking at the LSSharedFileList observation methods. However, it's still not working correctly.

First, In my class' init method, I added an observer:
LSSharedFileListRef list = LSSharedFileListCreate(kCFAllocatorDefault, kLSSharedFileListSessionLoginItems, nil); LSSharedFileListAddObserver(list, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, &LoginItemsListChanged, nil);
        if (list) CFRelease(list);

Then I added the callback method (per the prototype in the .h):
static void LoginItemsListChanged(LSSharedFileListRef inList, void *context) {
                NSLog(@"login items changed");
        }

Now, when I add & remove an app to the Login Items in System Prefs, the callback method gets called once for each of N items in the list (instead of once), and the inList argument is invalid - it seems to contain N invalid items. If I try to snapshot the list to an array (in which to look for my app), it contains N nil objects.
        UInt32 seed;
        CFArrayRef loginItems = LSSharedFileListCopySnapshot(list, &seed);

Any ideas, anyone? Thanks.

----
Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to