[PATCH] Add compatibility code for older cups



Hi,

I'm rebuilding gnome suite since 3.20 has been released, and found
gnome-control-center cannot be built with older cups.

Probably older cups become unsupported and you're not interested in this
patch.  Though I created this patch for me anyway, so I'm trying to send
this for merge.

--
Hiroshi Takekawa <sian big or jp>
"Sometimes the only way to stay sane is to go a little crazy."
                                          -- Girl, interrupted

From c346cd24f0bc69ca82bcee5aff425b0d038231ba Mon Sep 17 00:00:00 2001
From: Hiroshi Takekawa <sian big or jp>
Date: Sun, 27 Mar 2016 19:27:43 +0900
Subject: [PATCH] Add compatibility code for older cups

---
 panels/printers/pp-cups.c | 11 +++++++++++
 panels/printers/pp-job.c  | 18 ++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/panels/printers/pp-cups.c b/panels/printers/pp-cups.c
index b6692ed..e4cc9c7 100644
--- a/panels/printers/pp-cups.c
+++ b/panels/printers/pp-cups.c
@@ -20,6 +20,17 @@
 
 #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 ippGetState(ipp) ipp->state
+#define ippGetStatusCode(ipp) ipp->request.status.status_code
+#define ippGetString(attr, element, language) attr->values[element].string.text
+#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..050170c 100644
--- a/panels/printers/pp-job.c
+++ b/panels/printers/pp-job.c
@@ -23,6 +23,24 @@
 #include <gio/gio.h>
 #include <cups/cups.h>
 
+#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 ippGetState(ipp) ipp->state
+#define ippGetStatusCode(ipp) ipp->request.status.status_code
+#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;
-- 
2.2.1



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