codler / Battery-Time-Remaining

Show battery time remaining in Mac OS X 10.8+ Mountain Lion and Mavericks
http://yap.nu/battery-time-remaining/
Other
412 stars 72 forks source link

Open «System Preferences --> Energy Saver» using Cocoa Scripting Bridge #59

Closed ericbroska closed 10 years ago

ericbroska commented 11 years ago
codler commented 11 years ago

Thats alot of code just for replacing one hardcoded path. Why is SystemPreferences.h needed and what does it do? Is it a private API class in Apple?

ericbroska commented 11 years ago

@codler yeah, you're right — it's a quite big piece of code, but… I just don't like any kind of hardcode :)
SystemPreferences.h is a declaration of «System Preferences.app»'s Apple Scripting interface, so it's needed for using such things as SystemPreferencesPane and SystemPreferencesApplication. It's the public API and you can generate it yourself:

 $ sdef "/Applications/System Preferences.app" | sdp -fh --basename SystemPreferences -o ~/SystemPreferences.h   

Also, it is possible to remove some code from this header (for instance, we don't need SystemPreferencesItem, SystemPreferencesDocument, SystemPreferencesWindow, SystemPreferencesText and so on).

codler commented 10 years ago

Sry, this wont be merged