From 6ed989a5442366f5c90b849ec5af8923b647a79a Mon Sep 17 00:00:00 2001 From: Hiroshi Takekawa Date: Sun, 27 Mar 2016 19:27:43 +0900 Subject: [PATCH] printers: add compatibility code for older cups https://bugzilla.gnome.org/show_bug.cgi?id=764780 --- panels/printers/pp-cups.c | 9 +++++++++ panels/printers/pp-job.c | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/panels/printers/pp-cups.c b/panels/printers/pp-cups.c index b6692ede2..6521b90ba 100644 --- a/panels/printers/pp-cups.c +++ b/panels/printers/pp-cups.c @@ -20,6 +20,15 @@ #include "pp-cups.h" +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) +#define HAVE_CUPS_1_6 1 +#endif + +#ifndef HAVE_CUPS_1_6 +#define ippGetInteger(attr, element) attr->values[element].integer +#define ippGetStatusCode(ipp) ipp->request.status.status_code +#endif + G_DEFINE_TYPE (PpCups, pp_cups, G_TYPE_OBJECT); static void diff --git a/panels/printers/pp-job.c b/panels/printers/pp-job.c index 0c7c26781..730776064 100644 --- a/panels/printers/pp-job.c +++ b/panels/printers/pp-job.c @@ -23,6 +23,26 @@ #include #include +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) +#define HAVE_CUPS_1_6 1 +#endif + +#ifndef HAVE_CUPS_1_6 +#define ippGetBoolean(attr, element) attr->values[element].boolean +#define ippGetCount(attr) attr->num_values +#define ippGetInteger(attr, element) attr->values[element].integer +#define ippGetString(attr, element, language) attr->values[element].string.text +#define ippGetValueTag(attr) attr->value_tag +static int +ippGetRange (ipp_attribute_t *attr, + int element, + int *upper) +{ + *upper = attr->values[element].range.upper; + return (attr->values[element].range.lower); +} +#endif + typedef struct { GObject parent;