summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.meson6
-rw-r--r--modules/printbackends/gtkcupsutils.c60
-rw-r--r--modules/printbackends/gtkprintbackendcups.c209
-rw-r--r--modules/printbackends/gtkprintercups.c4
-rw-r--r--modules/printbackends/gtkprintercups.h11
-rw-r--r--modules/printbackends/meson.build11
6 files changed, 35 insertions, 266 deletions
diff --git a/config.h.meson b/config.h.meson
index b792b4ae93..a549f58ecc 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -24,12 +24,6 @@
/* Define to 1 if you have the <crt_externs.h> header file. */
#mesondefine HAVE_CRT_EXTERNS_H
-/* Define to 1 if CUPS 1.6 API is available */
-#mesondefine HAVE_CUPS_API_1_6
-
-/* Define to 1 if CUPS 2.0 API is available */
-#mesondefine HAVE_CUPS_API_2_0
-
/* Define to 1 if you have the `dcgettext' function. */
#mesondefine HAVE_DCGETTEXT
diff --git a/modules/printbackends/gtkcupsutils.c b/modules/printbackends/gtkcupsutils.c
index d2916f6110..8e7413a20a 100644
--- a/modules/printbackends/gtkcupsutils.c
+++ b/modules/printbackends/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/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c
index 48b4eb8461..68396c46c9 100644
--- a/modules/printbackends/gtkprintbackendcups.c
+++ b/modules/printbackends/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
@@ -143,14 +140,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;
@@ -228,9 +225,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,
@@ -272,51 +267,6 @@ g_io_module_query (void)
return g_strdupv (eps);
}
-/* 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 ippGet:Integer(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
*/
@@ -737,18 +687,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,
@@ -787,7 +732,6 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend,
}
}
else
-#endif
{
request = gtk_cups_request_new_with_username (NULL,
GTK_CUPS_POST,
@@ -897,9 +841,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;
@@ -920,7 +862,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;
@@ -929,7 +870,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);
@@ -965,11 +905,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)
@@ -984,9 +922,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));
@@ -1002,7 +938,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++)
@@ -1038,7 +973,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);
}
@@ -1792,18 +1726,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)
@@ -2039,9 +1963,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;
@@ -2472,13 +2394,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);
@@ -2554,9 +2474,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;
@@ -2735,7 +2653,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,
@@ -2858,11 +2775,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,
@@ -2930,9 +2843,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)
{
@@ -3505,7 +3416,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,
@@ -3554,7 +3464,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))
{
@@ -3570,42 +3479,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)
{
@@ -3703,9 +3591,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;
@@ -3727,12 +3613,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);
}
static void
@@ -3821,9 +3703,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
}
}
@@ -3859,26 +3739,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);
-
- return;
- }
-#endif
-
if (!gtk_cups_result_is_error (result))
{
/* let ppdOpenFd take over the ownership of the open file */
@@ -3888,7 +3748,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
@@ -3908,7 +3767,6 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend,
return;
}
-#endif
gtk_printer_set_has_details (printer, TRUE);
g_signal_emit_by_name (printer, "details-acquired", TRUE);
@@ -3934,11 +3792,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;
@@ -3972,16 +3826,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);
@@ -4285,13 +4133,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);
@@ -4344,11 +4193,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/gtkprintercups.c b/modules/printbackends/gtkprintercups.c
index 9d260cb9c3..d358d19eab 100644
--- a/modules/printbackends/gtkprintercups.c
+++ b/modules/printbackends/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/gtkprintercups.h b/modules/printbackends/gtkprintercups.h
index f26bbab677..d51306a4da 100644
--- a/modules/printbackends/gtkprintercups.h
+++ b/modules/printbackends/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 00ee33a80d..8dee6f0a4d 100644
--- a/modules/printbackends/meson.build
+++ b/modules/printbackends/meson.build
@@ -26,14 +26,7 @@ if enable_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')
@@ -45,7 +38,7 @@ if enable_cups
print_backends += ['cups']
else
- error('Need CUPS version >= 1.2')
+ error('Need CUPS version >= 2.0')
endif
else
error('Cannot find CUPS headers in default prefix.')