Re: Notification on Login Items change?
Re: Notification on Login Items change?
- Subject: Re: Notification on Login Items change?
- From: Karl Moskowski <email@hidden>
- Date: Fri, 17 Oct 2008 16:14:51 -0400
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@hidden>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden