printers: add compatibility code for older cups

https://bugzilla.gnome.org/show_bug.cgi?id=764780
This commit is contained in:
Hiroshi Takekawa 2016-03-27 19:27:43 +09:00 committed by Felipe Borges
parent 87bf4cc06e
commit 6ed989a544
2 changed files with 29 additions and 0 deletions

View file

@ -20,6 +20,15 @@
#include "pp-cups.h" #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); G_DEFINE_TYPE (PpCups, pp_cups, G_TYPE_OBJECT);
static void static void

View file

@ -23,6 +23,26 @@
#include <gio/gio.h> #include <gio/gio.h>
#include <cups/cups.h> #include <cups/cups.h>
#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 typedef struct
{ {
GObject parent; GObject parent;