2009-01-19 13:44:41 +00:00
|
|
|
--- modules/printbackends/cups/gtkprintbackendcups.c 2009-01-01 20:41:58.000000000 +0100
|
2009-01-28 14:46:27 +00:00
|
|
|
+++ modules/printbackends/cups/gtkprintbackendcups.c 2009-01-21 13:54:39.000000000 +0100
|
|
|
|
@@ -1103,6 +1103,7 @@ cups_request_printer_list_cb (GtkPrintBa
|
|
|
|
ipp_t *response;
|
|
|
|
gboolean list_has_changed;
|
|
|
|
GList *removed_printer_checklist;
|
|
|
|
+ gchar *remote_default_printer = NULL;
|
|
|
|
|
|
|
|
GDK_THREADS_ENTER ();
|
|
|
|
|
|
|
|
@@ -1190,6 +1191,7 @@ cups_request_printer_list_cb (GtkPrintBa
|
|
|
|
gboolean is_accepting_jobs = TRUE;
|
|
|
|
gboolean default_printer = FALSE;
|
|
|
|
gboolean got_printer_type = FALSE;
|
|
|
|
+ gboolean remote_printer = FALSE;
|
|
|
|
|
|
|
|
/* Skip leading attributes until we hit a printer...
|
|
|
|
*/
|
|
|
|
@@ -1307,6 +1309,11 @@ cups_request_printer_list_cb (GtkPrintBa
|
2009-01-19 13:44:41 +00:00
|
|
|
default_printer = TRUE;
|
|
|
|
else
|
|
|
|
default_printer = FALSE;
|
2009-01-28 14:46:27 +00:00
|
|
|
+
|
|
|
|
+ if (attr->values[0].integer & 0x00000002)
|
|
|
|
+ remote_printer = TRUE;
|
|
|
|
+ else
|
|
|
|
+ remote_printer = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@@ -1330,8 +1337,16 @@ cups_request_printer_list_cb (GtkPrintBa
|
|
|
|
{
|
|
|
|
if (default_printer && !cups_backend->got_default_printer)
|
|
|
|
{
|
|
|
|
- cups_backend->got_default_printer = TRUE;
|
|
|
|
- cups_backend->default_printer = g_strdup (printer_name);
|
|
|
|
+ if (!remote_printer)
|
|
|
|
+ {
|
|
|
|
+ cups_backend->got_default_printer = TRUE;
|
|
|
|
+ cups_backend->default_printer = g_strdup (printer_name);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (remote_default_printer == NULL)
|
|
|
|
+ remote_default_printer = g_strdup (printer_name);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
@@ -1552,6 +1567,26 @@ done:
|
|
|
|
|
|
|
|
gtk_print_backend_set_list_done (backend);
|
|
|
|
|
|
|
|
+ if (!cups_backend->got_default_printer && remote_default_printer != NULL)
|
|
|
|
+ {
|
|
|
|
+ cups_backend->default_printer = g_strdup (remote_default_printer);
|
|
|
|
+ cups_backend->got_default_printer = TRUE;
|
|
|
|
+ g_free (remote_default_printer);
|
|
|
|
+
|
|
|
|
+ if (cups_backend->default_printer != NULL)
|
|
|
|
+ {
|
|
|
|
+ GtkPrinter *default_printer = NULL;
|
|
|
|
+ default_printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (cups_backend),
|
|
|
|
+ cups_backend->default_printer);
|
|
|
|
+ if (default_printer != NULL)
|
|
|
|
+ {
|
|
|
|
+ gtk_printer_set_is_default (default_printer, TRUE);
|
|
|
|
+ g_signal_emit_by_name (GTK_PRINT_BACKEND (cups_backend),
|
|
|
|
+ "printer-status-changed", default_printer);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
GDK_THREADS_LEAVE ();
|
|
|
|
}
|
|
|
|
|