/*
- * "$Id: sysman.c 5018 2006-01-28 06:06:55Z mike $"
+ * "$Id: sysman.c 177 2006-06-21 00:20:03Z jlovell $"
*
* System management definitions for the Common UNIX Printing System (CUPS).
*
* common to wake up in a new location.
*/
-#ifndef __APPLE__
-/*
- * 'cupsdStartSystemMonitor()' - Start monitoring for system change.
- */
-
-void
-cupsdStartSystemMonitor(void)
-{
-}
-
-
-/*
- * 'cupsdStopSystemMonitor()' - Stop monitoring for system change.
- */
-
-void
-cupsdStopSystemMonitor(void)
-{
-}
-
-
-/*
- * 'cupsdUpdateSystemMonitor()' - Update the current system state.
- */
-
-void
-cupsdUpdateSystemMonitor(void)
-{
-}
-#endif /* !__APPLE__ */
-
-
#ifdef __APPLE__
/*
* This is the Apple-specific system event code. It works by creating
void
cupsdUpdateSystemMonitor(void)
{
+ int i; /* Looping var */
cupsd_sysevent_t sysevent; /* The system event */
cupsd_printer_t *p; /* Printer information */
if (sysevent.event & SYSEVENT_CANSLEEP)
{
/*
- * If there are any active printers cancel the sleep request...
+ * If there are active printers that don't have the connecting-to-device
+ * printer-state-reason then cancel the sleep request (i.e. this reason
+ * indicates a job that is not yet connected to the printer)...
*/
for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
p;
p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ {
if (p->job)
- break;
+ {
+ for (i = 0; i < p->num_reasons; i ++)
+ if (!strcmp(p->reasons[i], "connecting-to-device"))
+ break;
+
+ if (!p->num_reasons || i >= p->num_reasons)
+ break;
+ }
+ }
if (p)
{
Sleeping = 1;
cupsdStopAllJobs();
+ cupsdSaveAllJobs();
for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
p;
case kIOMessageSystemWillNotPowerOff:
case kIOMessageSystemWillNotSleep:
+#ifdef kIOMessageSystemWillPowerOn
case kIOMessageSystemWillPowerOn:
+#endif /* kIOMessageSystemWillPowerOn */
default:
sendit = 0;
break;
/*
- * End of "$Id: sysman.c 5018 2006-01-28 06:06:55Z mike $".
+ * End of "$Id: sysman.c 177 2006-06-21 00:20:03Z jlovell $".
*/