diff options
author | Javier Jardón <jjardon@gnome.org> | 2012-03-16 12:54:40 +0000 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2012-03-19 00:10:14 +0000 |
commit | 80d54b45338fbf08f719efdaae08edc31bb89a73 (patch) | |
tree | afbfa284ed659d37c3b44e99c5994fd92516c3d8 /modules | |
parent | 86b55b4bb16af13fc60c84ebe6f58832984288e3 (diff) | |
download | gtk+-80d54b45338fbf08f719efdaae08edc31bb89a73.tar.gz |
build: require cups >= 1.2
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=672182
Diffstat (limited to 'modules')
-rw-r--r-- | modules/printbackends/cups/gtkcupsutils.c | 22 | ||||
-rw-r--r-- | modules/printbackends/cups/gtkcupsutils.h | 2 | ||||
-rw-r--r-- | modules/printbackends/cups/gtkprintbackendcups.c | 42 |
3 files changed, 0 insertions, 66 deletions
diff --git a/modules/printbackends/cups/gtkcupsutils.c b/modules/printbackends/cups/gtkcupsutils.c index 42254c0a45..e9cc9b6487 100644 --- a/modules/printbackends/cups/gtkcupsutils.c +++ b/modules/printbackends/cups/gtkcupsutils.c @@ -834,11 +834,7 @@ _post_write_data (GtkCupsRequest *request) } -#if HAVE_CUPS_API_1_2 if (httpWrite2 (request->http, buffer, bytes) < bytes) -#else - if (httpWrite (request->http, buffer, (int) bytes) < bytes) -#endif /* HAVE_CUPS_API_1_2 */ { int http_errno; @@ -1412,11 +1408,7 @@ _get_read_data (GtkCupsRequest *request) request->poll_state = GTK_CUPS_HTTP_READ; -#if HAVE_CUPS_API_1_2 bytes = httpRead2 (request->http, buffer, sizeof (buffer)); -#else - bytes = httpRead (request->http, buffer, sizeof (buffer)); -#endif /* HAVE_CUPS_API_1_2 */ request->bytes_received += bytes; GTK_NOTE (PRINTING, @@ -1443,11 +1435,7 @@ _get_read_data (GtkCupsRequest *request) } /* Stop if we do not expect any more data or EOF was received. */ -#if HAVE_CUPS_API_1_2 if (httpGetLength2 (request->http) <= request->bytes_received || bytes == 0) -#else - if (httpGetLength (request->http) <= request->bytes_received || bytes == 0) -#endif /* HAVE_CUPS_API_1_2 */ { request->state = GTK_CUPS_GET_DONE; request->poll_state = GTK_CUPS_HTTP_IDLE; @@ -1505,7 +1493,6 @@ GtkCupsConnectionTest * gtk_cups_connection_test_new (const char *server) { GtkCupsConnectionTest *result = NULL; -#ifdef HAVE_CUPS_API_1_2 gchar *port_str = NULL; result = g_new (GtkCupsConnectionTest, 1); @@ -1525,9 +1512,6 @@ gtk_cups_connection_test_new (const char *server) result->at_init = GTK_CUPS_CONNECTION_NOT_AVAILABLE; result->at_init = gtk_cups_connection_test_get_state (result); -#else - result = g_new (GtkCupsConnectionTest, 1); -#endif return result; } @@ -1541,7 +1525,6 @@ gtk_cups_connection_test_new (const char *server) GtkCupsConnectionState gtk_cups_connection_test_get_state (GtkCupsConnectionTest *test) { -#ifdef HAVE_CUPS_API_1_2 GtkCupsConnectionState result = GTK_CUPS_CONNECTION_NOT_AVAILABLE; http_addrlist_t *iter; gint error_code; @@ -1622,9 +1605,6 @@ gtk_cups_connection_test_get_state (GtkCupsConnectionTest *test) return result; } -#else - return GTK_CUPS_CONNECTION_AVAILABLE; -#endif } /* This function frees memory used by the GtkCupsConnectionTest structure. @@ -1635,7 +1615,6 @@ gtk_cups_connection_test_free (GtkCupsConnectionTest *test) if (test == NULL) return; -#ifdef HAVE_CUPS_API_1_2 test->current_addr = NULL; test->last_wrong_addr = NULL; httpAddrFreeList (test->addrlist); @@ -1644,6 +1623,5 @@ gtk_cups_connection_test_free (GtkCupsConnectionTest *test) close (test->socket); test->socket = -1; } -#endif g_free (test); } diff --git a/modules/printbackends/cups/gtkcupsutils.h b/modules/printbackends/cups/gtkcupsutils.h index 50701818bf..e49a5d3bc5 100644 --- a/modules/printbackends/cups/gtkcupsutils.h +++ b/modules/printbackends/cups/gtkcupsutils.h @@ -106,13 +106,11 @@ struct _GtkCupsRequest struct _GtkCupsConnectionTest { -#ifdef HAVE_CUPS_API_1_2 GtkCupsConnectionState at_init; http_addrlist_t *addrlist; http_addrlist_t *current_addr; http_addrlist_t *last_wrong_addr; gint socket; -#endif }; #define GTK_CUPS_REQUEST_START 0 diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index bc1f30508c..f7081daef3 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -733,40 +733,6 @@ is_address_local (const gchar *address) return FALSE; } -#ifndef HAVE_CUPS_API_1_2 -/* Included from CUPS library because of backward compatibility */ -const char * -httpGetHostname(http_t *http, - char *s, - int slen) -{ - struct hostent *host; - - if (!s || slen <= 1) - return (NULL); - - if (http) - { - if (http->hostname[0] == '/') - g_strlcpy (s, "localhost", slen); - else - g_strlcpy (s, http->hostname, slen); - } - else - { - if (gethostname (s, slen) < 0) - g_strlcpy (s, "localhost", slen); - - if (!strchr (s, '.')) - { - if ((host = gethostbyname (s)) != NULL && host->h_name) - g_strlcpy (s, host->h_name, slen); - } - } - return (s); -} -#endif - static void gtk_print_backend_cups_set_password (GtkPrintBackend *backend, gchar **auth_info_required, @@ -1002,11 +968,7 @@ cups_dispatch_add_poll (GSource *source) else dispatch->data_poll->events = 0; -#ifdef HAVE_CUPS_API_1_2 dispatch->data_poll->fd = httpGetFd (dispatch->request->http); -#else - dispatch->data_poll->fd = dispatch->request->http->fd; -#endif g_source_add_poll (source, dispatch->data_poll); } } @@ -3300,9 +3262,7 @@ create_pickone_option (ppd_file_t *ppd_file, char *label; int n_choices; int i; -#ifdef HAVE_CUPS_API_1_2 ppd_coption_t *coption; -#endif g_assert (ppd_option->ui == PPD_UI_PICKONE); @@ -3318,7 +3278,6 @@ create_pickone_option (ppd_file_t *ppd_file, label = get_option_text (ppd_file, ppd_option); -#ifdef HAVE_CUPS_API_1_2 coption = ppdFindCustomOption (ppd_file, ppd_option->keyword); if (coption) @@ -3371,7 +3330,6 @@ create_pickone_option (ppd_file_t *ppd_file, g_warning ("CUPS Backend: Multi-parameter PPD Custom Option not supported"); #endif } -#endif /* HAVE_CUPS_API_1_2 */ if (!option) option = gtk_printer_option_new (gtk_name, label, |