gtk+ r20361 - in branches/gtk-2-12: . modules/printbackends/cups



Author: matthiasc
Date: Thu Jun 12 13:07:43 2008
New Revision: 20361
URL: http://svn.gnome.org/viewvc/gtk+?rev=20361&view=rev

Log:
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



Modified:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/modules/printbackends/cups/gtkprintbackendcups.c

Modified: branches/gtk-2-12/modules/printbackends/cups/gtkprintbackendcups.c
==============================================================================
--- branches/gtk-2-12/modules/printbackends/cups/gtkprintbackendcups.c	(original)
+++ branches/gtk-2-12/modules/printbackends/cups/gtkprintbackendcups.c	Thu Jun 12 13:07:43 2008
@@ -414,6 +414,7 @@
   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));   
@@ -428,9 +429,27 @@
 				  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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]