• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Add Preference Pane for Background-only app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add Preference Pane for Background-only app


  • Subject: Re: Add Preference Pane for Background-only app
  • From: Gregory Weston <email@hidden>
  • Date: Fri, 18 May 2007 07:15:49 -0400

Kam Dahlin wrote:

I have a Background-Only application that is started as a user login
item.  This is working great, but I would like to add a simple System
Preferences pane to control some specific behavior of the background
app.  I am looking for some advice or maybe the location of a few
online examples that could help me achieve this?

It's fairly straightforward. Just have your preference pane write to the background app's defaults using and use NSDistributedNotificationCenter to signal to the background app that the defaults have changed.


Somewhere in the startup code for the backgrounder ...

NSNotificationCenter* theCenter = [NSDistributedNotificationCenter defaultCenter];
[theCenter addObserver:self selector:@selector(doReloadPrefs:)
name:CompostNotificationReloadPrefs
object:[[NSBundle mainBundle] bundleIdentifier]];


and ...

- (void)doReloadPrefs:(NSNotification*)inNotification
{
  // Make sure we're all up-to-date.
  [[NSUserDefaults standardUserDefaults] synchronize];
}

The prefPane just has to finish the code that modifies the prefs with ...

NSDistributedNotificationCenter* theCenter = [NSDistributedNotificationCenter defaultCenter];
[theCenter postNotificationName:@"ReloadPrefs" object:myAppSignature
userInfo:NULL deliverImmediately:YES];



G


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Re: Fill text in a circle path - NSVIEW
  • Next by Date: Re: Unique items in Core Data models
  • Previous by thread: Add Preference Pane for Background-only app
  • Next by thread: NSTableView clicked row
  • Index(es):
    • Date
    • Thread