diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-05-06 20:04:17 +0100 |
---|---|---|
committer | Marek Kasik <mkasik@redhat.com> | 2019-05-10 16:40:58 +0200 |
commit | a7e207abe229344224f2b26083934a48698571fb (patch) | |
tree | e28d0611394a2eabc4bd41d47cb2bb663908470e /modules | |
parent | 9236ee0564de4c7f78a6db206ee63ea7a465e24e (diff) | |
download | gtk+-a7e207abe229344224f2b26083934a48698571fb.tar.gz |
Require CUPS >= 2.0
Drop support for versions of CUPS < 2.0, to simplify the backend code
and drop a lot of conditional blocks.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/printbackends/cups/gtkcupsutils.c | 60 | ||||
-rw-r--r-- | modules/printbackends/cups/gtkprintbackendcups.c | 208 | ||||
-rw-r--r-- | modules/printbackends/cups/gtkprintercups.c | 4 | ||||
-rw-r--r-- | modules/printbackends/cups/gtkprintercups.h | 11 | ||||
-rw-r--r-- | modules/printbackends/meson.build | 11 |
5 files changed, 35 insertions, 259 deletions
diff --git a/modules/printbackends/cups/gtkcupsutils.c b/modules/printbackends/cups/gtkcupsutils.c index d2916f6110..8e7413a20a 100644 --- a/modules/printbackends/cups/gtkcupsutils.c +++ b/modules/printbackends/cups/gtkcupsutils.c @@ -81,28 +81,6 @@ static GtkCupsRequestStateFunc get_states[] = { _get_read_data }; -#ifndef HAVE_CUPS_API_1_6 -#define ippSetOperation(ipp_request, ipp_op_id) ipp_request->request.op.operation_id = ipp_op_id -#define ippSetRequestId(ipp_request, ipp_rq_id) ipp_request->request.op.request_id = ipp_rq_id -#define ippSetState(ipp_request, ipp_state) ipp_request->state = ipp_state -#define ippGetString(attr, index, foo) attr->values[index].string.text -#define ippGetCount(attr) attr->num_values - -int -ippSetVersion (ipp_t *ipp, - int major, - int minor) -{ - if (!ipp || major < 0 || minor < 0) - return 0; - - ipp->request.any.version[0] = major; - ipp->request.any.version[1] = minor; - - return 1; -} -#endif - static void gtk_cups_result_set_error (GtkCupsResult *result, GtkCupsErrorType error_type, @@ -168,17 +146,10 @@ gtk_cups_request_new_with_username (http_t *connection, } else { - request->http = NULL; -#ifdef HAVE_CUPS_API_2_0 request->http = httpConnect2 (request->server, ippPort (), NULL, AF_UNSPEC, cupsEncryption (), 1, 30000, NULL); -#else - request->http = httpConnectEncrypt (request->server, - ippPort (), - cupsEncryption ()); -#endif if (request->http) httpBlocking (request->http, 0); @@ -693,17 +664,10 @@ _connect (GtkCupsRequest *request) if (request->http == NULL) { -#ifdef HAVE_CUPS_API_2_0 request->http = httpConnect2 (request->server, ippPort (), NULL, AF_UNSPEC, cupsEncryption (), 1, 30000, NULL); -#else - request->http = httpConnectEncrypt (request->server, - ippPort (), - cupsEncryption ()); -#endif - if (request->http == NULL) request->attempts++; @@ -757,11 +721,7 @@ _post_send (GtkCupsRequest *request) { int res; -#ifdef HAVE_CUPS_API_2_0 res = httpReconnect2 (request->http, 30000, NULL); -#else - res = httpReconnect (request->http); -#endif if (res) { @@ -1061,11 +1021,7 @@ _post_check (GtkCupsRequest *request) } if (auth_result || -#ifdef HAVE_CUPS_API_2_0 httpReconnect2 (request->http, 30000, NULL)) -#else - httpReconnect (request->http)) -#endif { /* if the password has been used, reset password_state * so that we ask for a new one next time around @@ -1124,11 +1080,7 @@ _post_check (GtkCupsRequest *request) request->state = GTK_CUPS_POST_CONNECT; /* Reconnect... */ -#ifdef HAVE_CUPS_API_2_0 httpReconnect2 (request->http, 30000, NULL); -#else - httpReconnect (request->http); -#endif /* Upgrade with encryption... */ httpEncryption (request->http, HTTP_ENCRYPT_REQUIRED); @@ -1258,11 +1210,7 @@ _get_send (GtkCupsRequest *request) { int reconnect; -#ifdef HAVE_CUPS_API_2_0 reconnect = httpReconnect2 (request->http, 30000, NULL); -#else - reconnect = httpReconnect (request->http); -#endif if (reconnect) { request->state = GTK_CUPS_GET_DONE; @@ -1372,11 +1320,7 @@ _get_check (GtkCupsRequest *request) } if (auth_result || -#ifdef HAVE_CUPS_API_2_0 httpReconnect2 (request->http, 30000, NULL)) -#else - httpReconnect (request->http)) -#endif { /* if the password has been used, reset password_state * so that we ask for a new one next time around @@ -1408,11 +1352,7 @@ _get_check (GtkCupsRequest *request) request->state = GTK_CUPS_GET_CONNECT; /* Reconnect... */ -#ifdef HAVE_CUPS_API_2_0 httpReconnect2 (request->http, 30000, NULL); -#else - httpReconnect (request->http); -#endif /* Upgrade with encryption... */ httpEncryption (request->http, HTTP_ENCRYPT_REQUIRED); diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 678bab86a8..97136db612 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -24,13 +24,12 @@ #include <sys/stat.h> #include <stdlib.h> #include <time.h> + /* Cups 1.6 deprecates ppdFindAttr(), ppdFindCustomOption(), * ppdFirstCustomParam(), and ppdNextCustomParam() among others. This * turns off the warning so that it will compile. */ -#ifdef HAVE_CUPS_API_1_6 -# define _PPD_DEPRECATED -#endif +#define _PPD_DEPRECATED #include <cups/cups.h> #include <cups/language.h> @@ -71,7 +70,6 @@ typedef struct _GtkPrintBackendCupsClass GtkPrintBackendCupsClass; #define _CUPS_MAX_ATTEMPTS 10 #define _CUPS_MAX_CHUNK_SIZE 8192 -#ifdef HAVE_CUPS_API_1_6 #define AVAHI_IF_UNSPEC -1 #define AVAHI_PROTO_INET 0 #define AVAHI_PROTO_INET6 1 @@ -81,7 +79,6 @@ typedef struct _GtkPrintBackendCupsClass GtkPrintBackendCupsClass; #define AVAHI_SERVER_IFACE "org.freedesktop.Avahi.Server" #define AVAHI_SERVICE_BROWSER_IFACE "org.freedesktop.Avahi.ServiceBrowser" #define AVAHI_SERVICE_RESOLVER_IFACE "org.freedesktop.Avahi.ServiceResolver" -#endif /* define this to see warnings about ignored ppd options */ #undef PRINT_IGNORED_OPTIONS @@ -145,14 +142,14 @@ struct _GtkPrintBackendCups #ifdef HAVE_COLORD CdClient *colord_client; #endif -#ifdef HAVE_CUPS_API_1_6 + GDBusConnection *dbus_connection; - gchar *avahi_default_printer; - guint avahi_service_browser_subscription_id; - guint avahi_service_browser_subscription_ids[2]; - gchar *avahi_service_browser_paths[2]; - GCancellable *avahi_cancellable; -#endif + char *avahi_default_printer; + guint avahi_service_browser_subscription_id; + guint avahi_service_browser_subscription_ids[2]; + char *avahi_service_browser_paths[2]; + GCancellable *avahi_cancellable; + gboolean secrets_service_available; guint secrets_service_watch_id; GCancellable *secrets_service_cancellable; @@ -230,9 +227,7 @@ static gboolean is_address_local (const gchar static gboolean request_auth_info (gpointer data); static void lookup_auth_info (gpointer data); -#ifdef HAVE_CUPS_API_1_6 static void avahi_request_printer_list (GtkPrintBackendCups *cups_backend); -#endif static void secrets_service_appeared_cb (GDBusConnection *connection, const gchar *name, @@ -285,50 +280,6 @@ pb_module_create (void) { return gtk_print_backend_cups_new (); } -/* CUPS 1.6 Getter/Setter Functions CUPS 1.6 makes private most of the - * IPP structures and enforces access via new getter functions, which - * are unfortunately not available in earlier versions. We define - * below those getter functions as macros for use when building - * against earlier CUPS versions. - */ -#ifndef HAVE_CUPS_API_1_6 -#define ippGetOperation(ipp_request) ipp_request->request.op.operation_id -#define ippGetInteger(attr, index) attr->values[index].integer -#define ippGetBoolean(attr, index) attr->values[index].boolean -#define ippGetString(attr, index, foo) attr->values[index].string.text -#define ippGetValueTag(attr) attr->value_tag -#define ippGetName(attr) attr->name -#define ippGetCount(attr) attr->num_values -#define ippGetGroupTag(attr) attr->group_tag -#define ippGetCollection(attr, index) attr->values[index].collection - -static int -ippGetRange (ipp_attribute_t *attr, - int element, - int *upper) -{ - *upper = attr->values[element].range.upper; - return (attr->values[element].range.lower); -} - -static ipp_attribute_t * -ippFirstAttribute (ipp_t *ipp) -{ - if (!ipp) - return (NULL); - - return (ipp->current = ipp->attrs); -} - -static ipp_attribute_t * -ippNextAttribute (ipp_t *ipp) -{ - if (!ipp || !ipp->current) - return (NULL); - - return (ipp->current = ipp->current->next); -} -#endif /* * GtkPrintBackendCups */ @@ -753,18 +704,13 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, cups_printer = GTK_PRINTER_CUPS (gtk_print_job_get_printer (job)); settings = gtk_print_job_get_settings (job); -#ifdef HAVE_CUPS_API_1_6 if (cups_printer->avahi_browsed) { -#ifdef HAVE_CUPS_API_2_0 http = httpConnect2 (cups_printer->hostname, cups_printer->port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, 30000, NULL); -#else - http = httpConnect (cups_printer->hostname, cups_printer->port); -#endif if (http) { request = gtk_cups_request_new_with_username (http, @@ -803,7 +749,6 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, } } else -#endif { request = gtk_cups_request_new_with_username (NULL, GTK_CUPS_POST, @@ -913,9 +858,7 @@ void overwrite_and_free (gpointer data) static void gtk_print_backend_cups_init (GtkPrintBackendCups *backend_cups) { -#ifdef HAVE_CUPS_API_1_6 - gint i; -#endif + int i; backend_cups->list_printers_poll = FALSE; backend_cups->got_default_printer = FALSE; @@ -936,7 +879,6 @@ gtk_print_backend_cups_init (GtkPrintBackendCups *backend_cups) backend_cups->colord_client = cd_client_new (); #endif -#ifdef HAVE_CUPS_API_1_6 backend_cups->dbus_connection = NULL; backend_cups->avahi_default_printer = NULL; backend_cups->avahi_service_browser_subscription_id = 0; @@ -945,7 +887,6 @@ gtk_print_backend_cups_init (GtkPrintBackendCups *backend_cups) backend_cups->avahi_service_browser_paths[i] = NULL; backend_cups->avahi_service_browser_subscription_ids[i] = 0; } -#endif cups_get_local_default_printer (backend_cups); @@ -981,11 +922,9 @@ gtk_print_backend_cups_finalize (GObject *object) g_object_unref (backend_cups->colord_client); #endif -#ifdef HAVE_CUPS_API_1_6 g_clear_object (&backend_cups->avahi_cancellable); g_clear_pointer (&backend_cups->avahi_default_printer, g_free); g_clear_object (&backend_cups->dbus_connection); -#endif g_clear_object (&backend_cups->secrets_service_cancellable); if (backend_cups->secrets_service_watch_id != 0) @@ -1000,9 +939,7 @@ static void gtk_print_backend_cups_dispose (GObject *object) { GtkPrintBackendCups *backend_cups; -#ifdef HAVE_CUPS_API_1_6 - gint i; -#endif + int i; GTK_NOTE (PRINTING, g_print ("CUPS Backend: %s\n", G_STRFUNC)); @@ -1018,7 +955,6 @@ gtk_print_backend_cups_dispose (GObject *object) g_source_remove (backend_cups->default_printer_poll); backend_cups->default_printer_poll = 0; -#ifdef HAVE_CUPS_API_1_6 g_cancellable_cancel (backend_cups->avahi_cancellable); for (i = 0; i < 2; i++) @@ -1054,7 +990,6 @@ gtk_print_backend_cups_dispose (GObject *object) backend_cups->avahi_service_browser_subscription_id); backend_cups->avahi_service_browser_subscription_id = 0; } -#endif backend_parent_class->dispose (object); } @@ -1810,18 +1745,8 @@ cups_request_job_info_cb (GtkPrintBackendCups *print_backend, state = 0; -#ifdef HAVE_CUPS_API_1_6 attr = ippFindAttribute (response, "job-state", IPP_TAG_ENUM); state = ippGetInteger (attr, 0); -#else - for (attr = response->attrs; attr != NULL; attr = attr->next) - { - if (!attr->name) - continue; - - _CUPS_MAP_ATTR_INT (attr, state, "job-state"); - } -#endif done = FALSE; switch (state) @@ -2060,9 +1985,7 @@ typedef struct gboolean default_printer; gboolean got_printer_type; gboolean remote_printer; -#ifdef HAVE_CUPS_API_1_6 gboolean avahi_printer; -#endif gchar **auth_info_required; gint default_number_up; guchar ipp_version_major; @@ -2493,13 +2416,11 @@ cups_create_printer (GtkPrintBackendCups *cups_backend, char *cups_server; /* CUPS server */ #ifdef HAVE_COLORD -#ifdef HAVE_CUPS_API_1_6 if (info->avahi_printer) cups_printer = gtk_printer_cups_new (info->printer_name, backend, NULL); else -#endif cups_printer = gtk_printer_cups_new (info->printer_name, backend, cups_backend->colord_client); @@ -2575,9 +2496,7 @@ cups_create_printer (GtkPrintBackendCups *cups_backend, strcmp (cups_backend->default_printer, gtk_printer_get_name (printer)) == 0) gtk_printer_set_is_default (printer, TRUE); -#ifdef HAVE_CUPS_API_1_6 cups_printer->avahi_browsed = info->avahi_printer; -#endif gtk_print_backend_add_printer (backend, printer); return printer; @@ -2756,7 +2675,6 @@ set_default_printer (GtkPrintBackendCups *cups_backend, } } -#ifdef HAVE_CUPS_API_1_6 static void cups_request_printer_info_cb (GtkPrintBackendCups *cups_backend, GtkCupsResult *result, @@ -2883,11 +2801,7 @@ cups_request_printer_info (const gchar *printer_uri, GtkCupsRequest *request; http_t *http; -#ifdef HAVE_CUPS_API_2_0 http = httpConnect2 (host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, 30000, NULL); -#else - http = httpConnect (host, port); -#endif if (http) { request = gtk_cups_request_new_with_username (http, @@ -2955,9 +2869,7 @@ find_printer_by_uuid (GtkPrintBackendCups *backend, printer_uuid += 5; printer_uuid = g_strndup (printer_uuid, 36); -#if GLIB_CHECK_VERSION(2, 52, 0) if (g_uuid_string_is_valid (printer_uuid)) -#endif { if (g_strcmp0 (printer_uuid, UUID) == 0) { @@ -3530,7 +3442,6 @@ avahi_request_printer_list (GtkPrintBackendCups *cups_backend) cups_backend->avahi_cancellable = g_cancellable_new (); g_bus_get (G_BUS_TYPE_SYSTEM, cups_backend->avahi_cancellable, avahi_create_browsers, cups_backend); } -#endif static void cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, @@ -3581,7 +3492,6 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, removed_printer_checklist = gtk_print_backend_get_printer_list (backend); response = gtk_cups_result_get_response (result); -#ifdef HAVE_CUPS_API_1_6 for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response)) { @@ -3597,42 +3507,21 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, if (attr == NULL) break; - while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_PRINTER) - { - cups_printer_handle_attribute (cups_backend, attr, info); - attr = ippNextAttribute (response); - } -#else - for (attr = response->attrs; attr != NULL; attr = attr->next) - { - GtkPrinter *printer; - gboolean status_changed = FALSE; - GList *node; - PrinterSetupInfo *info = g_slice_new0 (PrinterSetupInfo); - info->default_number_up = 1; - /* Skip leading attributes until we hit a printer... - */ - while (attr != NULL && ippGetGroupTag (attr) != IPP_TAG_PRINTER) - attr = attr->next; - - if (attr == NULL) - break; while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_PRINTER) - { - cups_printer_handle_attribute (cups_backend, attr, info); - attr = attr->next; - } -#endif + { + cups_printer_handle_attribute (cups_backend, attr, info); + attr = ippNextAttribute (response); + } if (info->printer_name == NULL || (info->printer_uri == NULL && info->member_uris == NULL)) - { - if (attr == NULL) - break; - else - continue; - } + { + if (attr == NULL) + break; + else + continue; + } if (info->got_printer_type) { @@ -3730,9 +3619,7 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, { for (iter = removed_printer_checklist; iter; iter = iter->next) { -#ifdef HAVE_CUPS_API_1_6 if (!GTK_PRINTER_CUPS (iter->data)->avahi_browsed) -#endif { mark_printer_inactive (GTK_PRINTER (iter->data), backend); list_has_changed = TRUE; @@ -3754,12 +3641,8 @@ done: g_free (remote_default_printer); } -#ifdef HAVE_CUPS_API_1_6 if (!cups_backend->got_default_printer && cups_backend->avahi_default_printer != NULL) - { - set_default_printer (cups_backend, cups_backend->avahi_default_printer); - } -#endif + set_default_printer (cups_backend, cups_backend->avahi_default_printer); gdk_threads_leave (); } @@ -3854,9 +3737,7 @@ cups_get_printer_list (GtkPrintBackend *backend) g_source_set_name_by_id (cups_backend->list_printers_poll, "[gtk+] cups_request_printer_list"); } -#ifdef HAVE_CUPS_API_1_6 avahi_request_printer_list (cups_backend); -#endif } } @@ -3894,26 +3775,6 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, GTK_PRINTER_CUPS (printer)->reading_ppd = FALSE; print_backend->reading_ppds--; -#ifndef HAVE_CUPS_API_1_6 - if (gtk_cups_result_is_error (result)) - { - gboolean success = FALSE; - - /* If we get a 404 then it is just a raw printer without a ppd - and not an error. */ - if ((gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_HTTP) && - (gtk_cups_result_get_error_status (result) == HTTP_NOT_FOUND)) - { - gtk_printer_set_has_details (printer, TRUE); - success = TRUE; - } - - g_signal_emit_by_name (printer, "details-acquired", success); - - goto done; - } -#endif - if (!gtk_cups_result_is_error (result)) { /* let ppdOpenFd take over the ownership of the open file */ @@ -3923,7 +3784,6 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, ppdMarkDefaults (data->printer->ppd_file); } -#ifdef HAVE_CUPS_API_1_6 fstat (g_io_channel_unix_get_fd (data->ppd_io), &data_info); /* * Standalone Avahi printers and raw printers don't have PPD files or have @@ -3943,7 +3803,6 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, goto done; } -#endif gtk_printer_set_has_details (printer, TRUE); g_signal_emit_by_name (printer, "details-acquired", TRUE); @@ -3972,11 +3831,7 @@ cups_request_ppd (GtkPrinter *printer) GTK_NOTE (PRINTING, g_print ("CUPS Backend: %s\n", G_STRFUNC)); - if (cups_printer->remote -#ifdef HAVE_CUPS_API_1_6 - && !cups_printer->avahi_browsed -#endif - ) + if (cups_printer->remote && !cups_printer->avahi_browsed) { GtkCupsConnectionState state; @@ -4012,16 +3867,10 @@ cups_request_ppd (GtkPrinter *printer) } } -#ifdef HAVE_CUPS_API_2_0 http = httpConnect2 (cups_printer->hostname, cups_printer->port, NULL, AF_UNSPEC, cupsEncryption (), 1, 30000, NULL); -#else - http = httpConnectEncrypt (cups_printer->hostname, - cups_printer->port, - cupsEncryption ()); -#endif data = g_new0 (GetPPDData, 1); @@ -4329,13 +4178,14 @@ cups_request_default_printer_cb (GtkPrintBackendCups *print_backend, response = gtk_cups_result_get_response (result); if ((attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME)) != NULL) - print_backend->default_printer = g_strdup (ippGetString (attr, 0, NULL)); + print_backend->default_printer = g_strdup (ippGetString (attr, 0, NULL)); print_backend->got_default_printer = TRUE; if (print_backend->default_printer != NULL) { - printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (print_backend), print_backend->default_printer); + printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (print_backend), + print_backend->default_printer); if (printer != NULL) { gtk_printer_set_is_default (printer, TRUE); @@ -4390,11 +4240,7 @@ cups_printer_request_details (GtkPrinter *printer) if (!cups_printer->reading_ppd && gtk_printer_cups_get_ppd (cups_printer) == NULL) { - if (cups_printer->remote -#ifdef HAVE_CUPS_API_1_6 - && !cups_printer->avahi_browsed -#endif - ) + if (cups_printer->remote && !cups_printer->avahi_browsed) { if (cups_printer->get_remote_ppd_poll == 0) { diff --git a/modules/printbackends/cups/gtkprintercups.c b/modules/printbackends/cups/gtkprintercups.c index 8f609a068f..34fe0064f8 100644 --- a/modules/printbackends/cups/gtkprintercups.c +++ b/modules/printbackends/cups/gtkprintercups.c @@ -115,12 +115,10 @@ gtk_printer_cups_init (GtkPrinterCups *printer) printer->remote_cups_connection_test = NULL; printer->auth_info_required = NULL; printer->default_number_up = 1; -#ifdef HAVE_CUPS_API_1_6 printer->avahi_browsed = FALSE; printer->avahi_name = NULL; printer->avahi_type = NULL; printer->avahi_domain = NULL; -#endif printer->ipp_version_major = 1; printer->ipp_version_minor = 1; printer->supports_copies = FALSE; @@ -176,11 +174,9 @@ gtk_printer_cups_finalize (GObject *object) g_object_unref (printer->colord_profile); #endif -#ifdef HAVE_CUPS_API_1_6 g_free (printer->avahi_name); g_free (printer->avahi_type); g_free (printer->avahi_domain); -#endif g_strfreev (printer->covers); diff --git a/modules/printbackends/cups/gtkprintercups.h b/modules/printbackends/cups/gtkprintercups.h index f26bbab677..d51306a4da 100644 --- a/modules/printbackends/cups/gtkprintercups.h +++ b/modules/printbackends/cups/gtkprintercups.h @@ -81,6 +81,7 @@ struct _GtkPrinterCups guint get_remote_ppd_poll; gint get_remote_ppd_attempts; GtkCupsConnectionTest *remote_cups_connection_test; + #ifdef HAVE_COLORD CdClient *colord_client; CdDevice *colord_device; @@ -89,12 +90,12 @@ struct _GtkPrinterCups gchar *colord_title; gchar *colord_qualifier; #endif -#ifdef HAVE_CUPS_API_1_6 + gboolean avahi_browsed; - gchar *avahi_name; - gchar *avahi_type; - gchar *avahi_domain; -#endif + char *avahi_name; + char *avahi_type; + char *avahi_domain; + guchar ipp_version_major; guchar ipp_version_minor; gboolean supports_copies; diff --git a/modules/printbackends/meson.build b/modules/printbackends/meson.build index f0e134bd64..a897f022ca 100644 --- a/modules/printbackends/meson.build +++ b/modules/printbackends/meson.build @@ -74,14 +74,7 @@ if enabled_print_backends.contains('cups') cups_major_version = cc.compute_int('CUPS_VERSION_MAJOR', prefix : '#include <cups/cups.h>') cups_minor_version = cc.compute_int('CUPS_VERSION_MINOR', prefix : '#include <cups/cups.h>') message('Found CUPS version: @0@.@1@'.format(cups_major_version, cups_minor_version)) - if cups_major_version > 1 or cups_minor_version >= 2 - if cups_major_version > 1 or cups_minor_version >= 6 - cdata.set('HAVE_CUPS_API_1_6', 1) - endif - if cups_major_version > 1 or cups_minor_version >= 7 - cdata.set('HAVE_CUPS_API_2_0', 1) - endif - + if cups_major_version >= 2 if cc.compiles('#include <cups/http.h> \n http_t http; char *s = http.authstring;') cdata.set('HAVE_HTTP_AUTHSTRING', 1, description :'Define if cups http_t authstring field is accessible') @@ -91,7 +84,7 @@ if enabled_print_backends.contains('cups') cdata.set('HAVE_HTTPGETAUTHSTRING', 1) endif else - cups_error = 'Need CUPS version >= 1.2' + cups_error = 'Need CUPS version >= 2.0' endif else cups_error = 'Cannot find CUPS headers in default prefix.' |