mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Bug 670373: modules/printing/cups/gtkprintbackendcups.c won't build with CUPS 1.6
Fix up accesses of ipp structures in gtkcupsutils.c
This commit is contained in:
parent
02f57f9642
commit
2c000c8e61
@ -81,6 +81,14 @@ 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
|
||||
#endif
|
||||
|
||||
static void
|
||||
gtk_cups_result_set_error (GtkCupsResult *result,
|
||||
GtkCupsErrorType error_type,
|
||||
@ -163,8 +171,8 @@ gtk_cups_request_new_with_username (http_t *connection,
|
||||
request->data_io = data_io;
|
||||
|
||||
request->ipp_request = ippNew ();
|
||||
request->ipp_request->request.op.operation_id = operation_id;
|
||||
request->ipp_request->request.op.request_id = 1;
|
||||
ippSetOperation (request->ipp_request, operation_id);
|
||||
ippSetRequestId (request->ipp_request, 1);
|
||||
|
||||
language = cupsLangDefault ();
|
||||
|
||||
@ -353,8 +361,8 @@ gtk_cups_request_ipp_get_string (GtkCupsRequest *request,
|
||||
name,
|
||||
tag);
|
||||
|
||||
if (attribute != NULL && attribute->values != NULL)
|
||||
return attribute->values[0].string.text;
|
||||
if (attribute != NULL && ippGetCount (attribute) > 0)
|
||||
return ippGetString (attribute, 0, NULL);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -732,7 +740,7 @@ _post_send (GtkCupsRequest *request)
|
||||
request->attempts = 0;
|
||||
|
||||
request->state = GTK_CUPS_POST_WRITE_REQUEST;
|
||||
request->ipp_request->state = IPP_IDLE;
|
||||
ippSetState (request->ipp_request, IPP_IDLE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1221,7 +1229,7 @@ _get_send (GtkCupsRequest *request)
|
||||
request->state = GTK_CUPS_GET_CHECK;
|
||||
request->poll_state = GTK_CUPS_HTTP_READ;
|
||||
|
||||
request->ipp_request->state = IPP_IDLE;
|
||||
ippSetState (request->ipp_request, IPP_IDLE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user