[gnome-control-center/gnome-3-20] printers: add compatibility code for older cups



commit 6bf2c9f2ee49fb9cc5991c467163b55836c1ba30
Author: Hiroshi Takekawa <sian big or jp>
Date:   Sun Mar 27 19:27:43 2016 +0900

    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(+), 0 deletions(-)
---
diff --git a/panels/printers/pp-cups.c b/panels/printers/pp-cups.c
index b6692ed..6521b90 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 0c7c267..7307760 100644
--- a/panels/printers/pp-job.c
+++ b/panels/printers/pp-job.c
@@ -23,6 +23,26 @@
 #include <gio/gio.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
 {
   GObject parent;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]