[gtk+/gtk-2-24] printing: Check connection to remote CUPS server on correct port
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] printing: Check connection to remote CUPS server on correct port
- Date: Wed, 13 May 2015 10:28:03 +0000 (UTC)
commit d63bee09e0ba4ddd94c26bed97522896dc9be5c6
Author: Marek Kasik <mkasik redhat com>
Date: Fri Jul 11 11:35:35 2014 +0200
printing: Check connection to remote CUPS server on correct port
Add parameter for specification of port to gtk_cups_connection_cups_new().
Use default port returned by ippPort() if the given port is lower than 0.
https://bugzilla.gnome.org/show_bug.cgi?id=693738
modules/printbackends/cups/gtkcupsutils.c | 8 ++++++--
modules/printbackends/cups/gtkcupsutils.h | 3 ++-
modules/printbackends/cups/gtkprintbackendcups.c | 8 +++++---
3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/modules/printbackends/cups/gtkcupsutils.c b/modules/printbackends/cups/gtkcupsutils.c
index 6b10db3..dbf9d51 100644
--- a/modules/printbackends/cups/gtkcupsutils.c
+++ b/modules/printbackends/cups/gtkcupsutils.c
@@ -1534,7 +1534,8 @@ gtk_cups_result_get_error_string (GtkCupsResult *result)
* a socket for communication with a CUPS server 'server'.
*/
GtkCupsConnectionTest *
-gtk_cups_connection_test_new (const char *server)
+gtk_cups_connection_test_new (const char *server,
+ const int port)
{
GtkCupsConnectionTest *result = NULL;
#ifdef HAVE_CUPS_API_1_2
@@ -1542,7 +1543,10 @@ gtk_cups_connection_test_new (const char *server)
result = g_new (GtkCupsConnectionTest, 1);
- port_str = g_strdup_printf ("%d", ippPort ());
+ if (port >= 0)
+ port_str = g_strdup_printf ("%d", port);
+ else
+ port_str = g_strdup_printf ("%d", ippPort ());
if (server != NULL)
result->addrlist = httpAddrGetList (server, AF_UNSPEC, port_str);
diff --git a/modules/printbackends/cups/gtkcupsutils.h b/modules/printbackends/cups/gtkcupsutils.h
index 53171ed..e1d1e82 100644
--- a/modules/printbackends/cups/gtkcupsutils.h
+++ b/modules/printbackends/cups/gtkcupsutils.h
@@ -191,7 +191,8 @@ GtkCupsErrorType gtk_cups_result_get_error_type (GtkCupsResult *
int gtk_cups_result_get_error_status (GtkCupsResult *result);
int gtk_cups_result_get_error_code (GtkCupsResult *result);
const char * gtk_cups_result_get_error_string (GtkCupsResult *result);
-GtkCupsConnectionTest * gtk_cups_connection_test_new (const char *server);
+GtkCupsConnectionTest * gtk_cups_connection_test_new (const char *server,
+ const int port);
GtkCupsConnectionState gtk_cups_connection_test_get_state (GtkCupsConnectionTest *test);
void gtk_cups_connection_test_free (GtkCupsConnectionTest *test);
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c
b/modules/printbackends/cups/gtkprintbackendcups.c
index cebdc17..24d4d8b 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -3300,7 +3300,7 @@ cups_get_printer_list (GtkPrintBackend *backend)
cups_backend = GTK_PRINT_BACKEND_CUPS (backend);
if (cups_backend->cups_connection_test == NULL)
- cups_backend->cups_connection_test = gtk_cups_connection_test_new (NULL);
+ cups_backend->cups_connection_test = gtk_cups_connection_test_new (NULL, -1);
if (cups_backend->list_printers_poll == 0)
{
@@ -3682,7 +3682,7 @@ cups_get_default_printer (GtkPrintBackendCups *backend)
cups_backend = backend;
if (cups_backend->cups_connection_test == NULL)
- cups_backend->cups_connection_test = gtk_cups_connection_test_new (NULL);
+ cups_backend->cups_connection_test = gtk_cups_connection_test_new (NULL, -1);
if (cups_backend->default_printer_poll == 0)
{
@@ -3817,7 +3817,9 @@ cups_printer_request_details (GtkPrinter *printer)
{
if (cups_printer->get_remote_ppd_poll == 0)
{
- cups_printer->remote_cups_connection_test = gtk_cups_connection_test_new
(cups_printer->hostname);
+ cups_printer->remote_cups_connection_test =
+ gtk_cups_connection_test_new (cups_printer->hostname,
+ cups_printer->port);
if (cups_request_ppd (printer))
cups_printer->get_remote_ppd_poll = gdk_threads_add_timeout (50,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]