/*
- * "$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).
*
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,
#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...
cupsdClearString(&p->op_policy);
cupsdClearString(&p->error_policy);
+#ifdef __APPLE__
+ cupsdClearString(&p->recoverable);
+#endif /* __APPLE__ */
+
free(p);
/*
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 */
}
}
- cupsd_printer_type = p->type;
+ printer_type = p->type;
p->raw = 0;
ppdClose(ppd);
- cupsd_printer_type = p->type;
+ printer_type = p->type;
}
else if (!access(filename, 0))
{
* 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
}
}
- /*
- * 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));
/*
- * 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 $".
*/