]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/printers.c
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / printers.c
index 74a893b3c2f1364ca0aa569260744fe7a9c8869a..801606b4da193417ed3530641f2e206c16cd3b7d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: printers.c 4989 2006-01-26 00:59:45Z mike $"
+ * "$Id: printers.c 5039 2006-02-01 16:29:57Z mike $"
  *
  *   Printer routines for the Common UNIX Printing System (CUPS).
  *
@@ -242,6 +242,11 @@ cupsdAddPrinterHistory(
   ippAddBoolean(history, IPP_TAG_PRINTER, "printer-is-shared", p->shared);
   ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-state-message",
                NULL, p->state_message);
+#ifdef __APPLE__
+  if (p->recoverable)
+    ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+                 "com.apple.print.recoverable-message", NULL, p->recoverable);
+#endif /* __APPLE__ */
   if (p->num_reasons == 0)
     ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
                  "printer-state-reasons", NULL,
@@ -719,12 +724,32 @@ cupsdDeletePrinter(
 #endif /* __sgi */
 
  /*
-  * If p is the default printer, assign the next one...
-  * TODO: use next network default printer or NULL...
+  * If p is the default printer, assign a different one...
   */
 
   if (p == DefaultPrinter)
-    DefaultPrinter = (cupsd_printer_t *)cupsArrayFirst(Printers);
+  {
+    DefaultPrinter = NULL;
+
+    if (UseNetworkDefault)
+    {
+     /*
+      * Find the first network default printer and use it...
+      */
+
+      cupsd_printer_t  *dp;            /* New default printer */
+
+
+      for (dp = (cupsd_printer_t *)cupsArrayFirst(Printers);
+          dp;
+          dp = (cupsd_printer_t *)cupsArrayNext(Printers))
+       if (dp != p && (dp->type & CUPS_PRINTER_DEFAULT))
+       {
+         DefaultPrinter = p;
+         break;
+       }
+    }
+  }
 
  /*
   * Remove this printer from any classes and send a browse delete message...
@@ -776,6 +801,10 @@ cupsdDeletePrinter(
   cupsdClearString(&p->op_policy);
   cupsdClearString(&p->error_policy);
 
+#ifdef __APPLE__
+  cupsdClearString(&p->recoverable);
+#endif /* __APPLE__ */
+
   free(p);
 
  /*
@@ -1422,8 +1451,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
   int                  num_media;      /* Number of media options */
   cupsd_location_t     *auth;          /* Pointer to authentication element */
   const char           *auth_supported;/* Authentication supported */
-  cups_ptype_t         cupsd_printer_type;
-                                       /* Printer type data */
+  cups_ptype_t         printer_type;   /* Printer type data */
   ppd_file_t           *ppd;           /* PPD file data */
   ppd_option_t         *input_slot,    /* InputSlot options */
                        *media_type,    /* MediaType options */
@@ -1549,7 +1577,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
     }
   }
 
-  cupsd_printer_type = p->type;
+  printer_type = p->type;
 
   p->raw = 0;
 
@@ -1894,7 +1922,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
 
        ppdClose(ppd);
 
-        cupsd_printer_type = p->type;
+        printer_type = p->type;
       }
       else if (!access(filename, 0))
       {
@@ -1958,7 +1986,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
          * Tell the client this is really a hard-wired remote printer.
          */
 
-          cupsd_printer_type |= CUPS_PRINTER_REMOTE;
+          printer_type |= CUPS_PRINTER_REMOTE;
 
          /*
          * Point the printer-uri-supported attribute to the
@@ -2002,18 +2030,6 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
     }
   }
 
- /*
-  * Add the CUPS-specific printer-type attribute...
-  */
-
-  if (!p->shared)
-    p->type |= CUPS_PRINTER_NOT_SHARED;
-  else
-    p->type &= ~CUPS_PRINTER_NOT_SHARED;
-
-  ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-type",
-                cupsd_printer_type);
-
   DEBUG_printf(("cupsdSetPrinterAttrs: leaving name = %s, type = %x\n", p->name,
                 p->type));
 
@@ -2882,5 +2898,5 @@ write_irix_state(cupsd_printer_t *p)      /* I - Printer to update */
 
 
 /*
- * End of "$Id: printers.c 4989 2006-01-26 00:59:45Z mike $".
+ * End of "$Id: printers.c 5039 2006-02-01 16:29:57Z mike $".
  */