discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Application Controller/ Notifications For Power Managment


From: Niels Grewe
Subject: Re: Application Controller/ Notifications For Power Managment
Date: Wed, 07 Sep 2011 19:29:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Icedove/3.1.13

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]