Hi,

Am 07.09.2011 19:17, schrieb BTS:
> 
> Just some suggestions for app controller messages, it is written lasily in
> pseudo code, my objective-c is pretty weak at the moment.
> 
> AppController.m
> 
> /*These methods are called if the system battery is low on laptops, or the
> power has failed and a UPS has kicked in.  
> */
> 
> //This method tells the notification center that the program wishes to be
> notified about power events
> [NSNotificationCenter RegisterForPMNotifications With:Self]
> 
> //Called if power is being drawn from UPS
> //or if the laptop battery has less time than is defined in NSDefaults
> Global Domain MayLosePowerThreshold.
> -(void) SystemMayLosePower()
> //Called if all UPSs are deemed near dead
> //or if the system has requested time to preform safe power loss
> -(void) SystemWillLosePower()

This is most certainly not what you want. NSNotificationCenter is a
quite generic mechanism for dispatching and receiving notifications.
What you want is a object that talks to the system power management
facilities and that posts something like PMMayLosePowerNotification or
PMWillLosePowerNotification, which you then observe from your application.
You can achieve something like this quite easily by wrapping HAL or
UPower using DBusKit, which is in fact one item on my todo-list for Étoilé.

Cheers,

Niels

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to