summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2014-10-01 15:17:39 +0200
committerMarek Kasik <mkasik@redhat.com>2014-10-10 13:40:24 +0200
commita73c858f4ba31d800e63f6ef5e6eaeebc716488b (patch)
treec8eb09ea60b19710ea7baa3dd851a0bc680317ad
parent6bdaa95164119182dac0ef710aeb1dc13d9d11dc (diff)
downloadgtk+-a73c858f4ba31d800e63f6ef5e6eaeebc716488b.tar.gz
Remove dead code from CUPS backend
https://bugzilla.gnome.org/show_bug.cgi?id=725441
-rw-r--r--modules/printbackends/cups/gtkprintbackendcups.c133
1 files changed, 0 insertions, 133 deletions
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index b3ef390392..1c69b6bba9 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -1610,132 +1610,6 @@ cups_request_execute (GtkPrintBackendCups *print_backend,
}
}
-#if 0
-static void
-cups_request_printer_info_cb (GtkPrintBackendCups *backend,
- GtkCupsResult *result,
- gpointer user_data)
-{
- ipp_attribute_t *attr;
- ipp_t *response;
- gchar *printer_name;
- GtkPrinterCups *cups_printer;
- GtkPrinter *printer;
- gchar *loc;
- gchar *desc;
- gchar *state_msg;
- int job_count;
- gboolean status_changed;
-
- g_assert (GTK_IS_PRINT_BACKEND_CUPS (backend));
-
- printer_name = (gchar *)user_data;
- printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (backend),
- printer_name);
-
- GTK_NOTE (PRINTING,
- g_print ("CUPS Backend: %s - Got printer info for printer '%s'\n", G_STRFUNC, printer_name));
-
- if (!printer)
- {
- GTK_NOTE (PRINTING,
- g_print ("CUPS Backend: Could not find printer called '%s'\n", printer_name));
- return;
- }
-
- cups_printer = GTK_PRINTER_CUPS (printer);
-
- if (gtk_cups_result_is_error (result))
- {
- if (gtk_printer_is_new (printer))
- {
- gtk_print_backend_remove_printer (GTK_PRINT_BACKEND (backend),
- printer);
- return;
- }
- else
- return; /* TODO: mark as inactive printer */
- }
-
- response = gtk_cups_result_get_response (result);
-
- /* TODO: determine printer type and use correct icon */
- gtk_printer_set_icon_name (printer, "printer");
-
- state_msg = "";
- loc = "";
- desc = "";
- job_count = 0;
- for (attr = response->attrs; attr != NULL; attr = attr->next)
- {
- if (!attr->name)
- continue;
-
- _CUPS_MAP_ATTR_STR (attr, loc, "printer-location");
- _CUPS_MAP_ATTR_STR (attr, desc, "printer-info");
- _CUPS_MAP_ATTR_STR (attr, state_msg, "printer-state-message");
- _CUPS_MAP_ATTR_INT (attr, cups_printer->state, "printer-state");
- _CUPS_MAP_ATTR_INT (attr, job_count, "queued-job-count");
- }
-
- status_changed = gtk_printer_set_job_count (printer, job_count);
-
- status_changed |= gtk_printer_set_location (printer, loc);
- status_changed |= gtk_printer_set_description (printer, desc);
- status_changed |= gtk_printer_set_state_message (printer, state_msg);
-
- if (status_changed)
- g_signal_emit_by_name (GTK_PRINT_BACKEND (backend),
- "printer-status-changed", printer);
-}
-
-static void
-cups_request_printer_info (GtkPrintBackendCups *print_backend,
- const gchar *printer_name)
-{
- GtkCupsRequest *request;
- gchar *printer_uri;
- static const char * const pattrs[] = /* Attributes we're interested in */
- {
- "printer-location",
- "printer-info",
- "printer-state-message",
- "printer-state",
- "queued-job-count",
- "job-sheets-supported",
- "job-sheets-default"
- };
-
- request = gtk_cups_request_new_with_username (NULL,
- GTK_CUPS_POST,
- IPP_GET_PRINTER_ATTRIBUTES,
- NULL,
- NULL,
- NULL,
- print_backend->username);
-
- printer_uri = g_strdup_printf ("ipp://localhost/printers/%s",
- printer_name);
- gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, printer_uri);
-
- GTK_NOTE (PRINTING,
- g_print ("CUPS Backend: %s - Requesting printer info for URI '%s'\n", G_STRFUNC, printer_uri));
-
- g_free (printer_uri);
-
- gtk_cups_request_ipp_add_strings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
- "requested-attributes", G_N_ELEMENTS (pattrs),
- NULL, pattrs);
-
- cups_request_execute (print_backend,
- request,
- (GtkPrintCupsResponseCallbackFunc) cups_request_printer_info_cb,
- g_strdup (printer_name),
- (GDestroyNotify) g_free);
-}
-#endif
-
typedef struct {
GtkPrintBackendCups *print_backend;
GtkPrintJob *job;
@@ -3359,13 +3233,6 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
gtk_printer_set_is_new (printer, FALSE);
}
-#if 0
- /* Getting printer info with separate requests overwhelms cups
- * when the printer list has more than a handful of printers.
- */
- cups_request_printer_info (cups_backend, gtk_printer_get_name (printer));
-#endif
-
GTK_PRINTER_CUPS (printer)->state = info->state;
GTK_PRINTER_CUPS (printer)->ipp_version_major = info->ipp_version_major;
GTK_PRINTER_CUPS (printer)->ipp_version_minor = info->ipp_version_minor;