home *** CD-ROM | disk | FTP | other *** search
- // EnergyServicesLib.c
- //
- // Apple Macintosh Developer Technical Support
- //
- // Contains: Glue code for calling the energy services INIT
- //
- // Copyright (work in progress) Apple Computer, Inc All rights reserved.
- //
- // You may incorporate this sample code into your applications without
- // restriction, though the sample code has been provided "AS IS" and the
- // responsibility for its operation is 100% yours. However, what you are
- // not permitted to do is to redistribute the source as "DSC Sample Code"
- // after having made changes. If you're going to re-distribute the source,
- // we require that you make it clear in the source that the code was
- // descended from Apple Sample Code, but that you've made changes.
-
-
- #include "Gestalt.h"
-
- #include "EnergyServPub.h"
-
- ESRoutineCallPtr gESMainRoutine = nil;
-
- long CallESMain(short selector, long parm1, long parm2)
- {
- ESDataPtr theLocation;
- OSErr theErr;
-
- if (gESMainRoutine == nil) {
- theErr = Gestalt('wnkl', (long *)&theLocation);
- if ((theErr == noErr) && (theLocation !=nil))
- gESMainRoutine = theLocation->WinkleINITMain;
- }
- if (gESMainRoutine != nil) {
- return (CallESRoutineProc(gESMainRoutine,selector, parm1, parm2));
- } else theErr = -1;
- return theErr;
- }
-
- OSErr ESLoadPreferences(GlobDataPtr thePrefs)
- {
- return (CallESMain(xESLoadPreferences,(long)thePrefs, 0));
- }
-
- OSErr ESGetPreferences(GlobDataPtr thePrefs)
- {
- return (CallESMain(xESGetPreferences,(long)thePrefs, 0));
- }
-
- OSErr ESSetPreferences(GlobDataPtr thePrefs)
- {
- return (CallESMain(xESSetPreferences,(long)thePrefs, 0));
- }
-
- OSErr ESRefreshSettings()
- {
- return (CallESMain(xESRefreshSettings,0, 0));
- }
-
- OSErr ESSavePreferences(GlobDataPtr thePrefs)
- {
- return (CallESMain(xESSavePreferences,(long)thePrefs, 0));
- }
-
- OSErr ESRestoreDefaults(GlobDataPtr thePrefs)
- {
- return (CallESMain(xESRestoreDefaults,(long)thePrefs, 0));
- }
-
- OSErr ESAddNoteProc(ESNotifyProcPtr theProc, long data)
- {
- return (CallESMain(xESAddNoteProc, (long)theProc, data));
- }
-
- OSErr ESRemoveNoteProc(ESNotifyProcPtr theProc)
- {
- return (CallESMain(xESRemoveNoteProc, (long)theProc, 0));
- }
-
- OSErr ESGetUnsavedFolder(Ptr theString)
- {
- return (CallESMain(xESGetUnsavedFolder, (long)theString, 0));
- }
-
- OSErr ESSetUnsavedFolder(Ptr theString)
- {
- return (CallESMain(xESSetUnsavedFolder, (long)theString, 0));
- }
-
- OSErr ESGetINITVersion(Handle* theVers)
- {
- return (CallESMain(xESGetINITVersion, (long)theVers, 0));
- }
-
- OSErr ESGetAliasFileName(Ptr theString)
- {
- return (CallESMain(1306, (long)theString, 0));
- }
-
- /*OSErr TESTInstallShutdown(long theSecs)
- {
- return (CallESMain(xESInstallShutDown, theSecs, 0));
- }
-
- OSErr TESTCancelShutdown()
- {
- return (CallESMain(xESCancelShutdown, 0, 0));
- }*/
-
-