]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/sysman.c
Remove svn:keywords since they cause svn_load_dirs.pl to complain about every file.
[thirdparty/cups.git] / scheduler / sysman.c
index de312d3138e1facba4f124a7ae33ee437ac896ed..7590a205bbc9c7ae96079a9a3877115cfd0c43e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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
@@ -264,6 +232,7 @@ cupsdStopSystemMonitor(void)
 void
 cupsdUpdateSystemMonitor(void)
 {
+  int                  i;              /* Looping var */
   cupsd_sysevent_t     sysevent;       /* The system event */
   cupsd_printer_t      *p;             /* Printer information */
 
@@ -278,14 +247,25 @@ cupsdUpdateSystemMonitor(void)
     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)
       {
@@ -310,6 +290,7 @@ cupsdUpdateSystemMonitor(void)
       Sleeping = 1;
 
       cupsdStopAllJobs();
+      cupsdSaveAllJobs();
 
       for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
            p;
@@ -640,7 +621,9 @@ sysEventPowerNotifier(
 
     case kIOMessageSystemWillNotPowerOff:
     case kIOMessageSystemWillNotSleep:
+#ifdef kIOMessageSystemWillPowerOn
     case kIOMessageSystemWillPowerOn:
+#endif /* kIOMessageSystemWillPowerOn */
     default:
        sendit = 0;
        break;
@@ -744,5 +727,5 @@ sysEventTimerNotifier(
 
 
 /*
- * 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 $".
  */