]> Pileus Git - ~andy/gtk/commitdiff
Really fix printer URI construction
authorMatthias Clasen <matthiasc@src.gnome.org>
Thu, 12 Jun 2008 13:03:35 +0000 (13:03 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 12 Jun 2008 13:03:35 +0000 (13:03 +0000)
svn path=/trunk/; revision=20360

ChangeLog
modules/printbackends/cups/gtkprintbackendcups.c

index 3e271160110447890a21d867a312340e6438e5b2..1fbbe5c7845919e572b20e0d2102b2c75d97b8ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-12  Matthias Clasen  <mclasen@redhat.com>
+
+       RH bug 248245 and 449379: cups client printing from gnome
+       applications fail
+
+       * modules/printbackends/cups/gtkprintbackendcups.c: Really fix
+       printer URI construction. Patch by Marek Kasik
+       
 2008-06-12  Michael Natterer  <mitch@imendio.com>
 
        * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
index ff623cf992238caacf41902a2deaf9487f897763..bed56a6f4f31028615c1ad4453edef361e0ff4f4 100644 (file)
@@ -433,6 +433,7 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend         *print_backend,
   GtkCupsRequest *request;
   GtkPrintSettings *settings;
   const gchar *title;
+  char  printer_absolute_uri[HTTP_MAX_URI];
 
   GTK_NOTE (PRINTING,
             g_print ("CUPS Backend: %s\n", G_STRFUNC));   
@@ -444,12 +445,30 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend         *print_backend,
                                   GTK_CUPS_POST,
                                   IPP_PRINT_JOB,
                                  data_io,
-                                 cups_printer->hostname
+                                 NULL
                                  cups_printer->device_uri);
 
+#if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) || CUPS_VERSION_MAJOR > 1
+  httpAssembleURIf (HTTP_URI_CODING_ALL,
+                    printer_absolute_uri,
+                    sizeof (printer_absolute_uri),
+                    "ipp",
+                    NULL,
+                    "localhost",
+                    ippPort (),
+                    "/printers/%s",
+                    gtk_printer_get_name (gtk_print_job_get_printer (job)));
+#else
+  g_snprintf (printer_absolute_uri,
+              sizeof (printer_absolute_uri),
+              "ipp://localhost:%d/printers/%s",
+              ippPort (),
+              gtk_printer_get_name (gtk_print_job_get_printer (job)));
+#endif
+
   gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, 
                                    IPP_TAG_URI, "printer-uri",
-                                   NULL, cups_printer->printer_uri);
+                                   NULL, printer_absolute_uri);
 
   title = gtk_print_job_get_title (job);
   if (title)