Submitted By:            Armin K. <krejzi at email dot com>
Date:                    2012-08-15
Initial Package Version: 3.4.2
Upstream Status:         Fixed upstream
Origin:                  Upstream bugzilla            
Description:             Fixes compiling with CUPS 1.6.0 and later

--- gnome-settings-daemon.orig/plugins/print-notifications/gsd-printer.c	2012-04-16 14:34:43.000000000 +0200
+++ gnome-settings-daemon/plugins/print-notifications/gsd-printer.c	2012-08-15 16:35:57.760278617 +0200
@@ -63,6 +63,14 @@
 #define GNOME_SESSION_PRESENCE_DBUS_PATH  "/org/gnome/SessionManager/Presence"
 #define GNOME_SESSION_PRESENCE_DBUS_IFACE "org.gnome.SessionManager.Presence"
 
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
+#define HAVE_CUPS_1_6 1
+#endif
+
+#ifndef HAVE_CUPS_1_6
+#define ippGetState(ipp) ipp->state
+#endif
+
 enum {
   PRESENCE_STATUS_AVAILABLE = 0,
   PRESENCE_STATUS_INVISIBLE,
@@ -725,7 +733,7 @@
                                                         "AutoConfigure",
                                                         ("Automatic configuration"));
                 if (response) {
-                        if (response->state == IPP_ERROR)
+                        if (ippGetState (response) == IPP_ERROR)
                                 g_warning ("An error has occured during automatic configuration of new printer.");
                         ippDelete (response);
                 }
--- gnome-settings-daemon.orig/plugins/print-notifications/gsd-print-notifications-manager.c	2012-05-15 12:14:49.000000000 +0200
+++ gnome-settings-daemon/plugins/print-notifications/gsd-print-notifications-manager.c	2012-08-15 16:35:57.758278605 +0200
@@ -52,6 +52,16 @@
 #define CONNECTING_TIMEOUT    60
 #define REASON_TIMEOUT        15000
 
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
+#define HAVE_CUPS_1_6 1
+#endif
+
+#ifndef HAVE_CUPS_1_6
+#define ippGetStatusCode(ipp) ipp->request.status.status_code
+#define ippGetInteger(attr, element) attr->values[element].integer
+#define ippGetString(attr, element, language) attr->values[element].string.text
+#endif
+
 struct GsdPrintNotificationsManagerPrivate
 {
         GDBusProxy                   *cups_proxy;
@@ -396,10 +406,10 @@
                         response = cupsDoRequest (http, request, "/");
 
                         if (response) {
-                                if (response->request.status.status_code <= IPP_OK_CONFLICT &&
+                                if (ippGetStatusCode (response) <= IPP_OK_CONFLICT &&
                                     (attr = ippFindAttribute(response, "job-originating-user-name",
                                                              IPP_TAG_NAME))) {
-                                        if (g_strcmp0 (attr->values[0].string.text, cupsUser ()) == 0)
+                                        if (g_strcmp0 (ippGetString (attr, 0, NULL), cupsUser ()) == 0)
                                                 my_job = TRUE;
                                 }
                                 ippDelete(response);
@@ -889,12 +899,12 @@
                                        "notify-lease-duration", SUBSCRIPTION_DURATION);
                         response = cupsDoRequest (http, request, "/");
 
-                        if (response != NULL && response->request.status.status_code <= IPP_OK_CONFLICT) {
+                        if (response != NULL && ippGetStatusCode (response) <= IPP_OK_CONFLICT) {
                                 if ((attr = ippFindAttribute (response, "notify-subscription-id",
                                                               IPP_TAG_INTEGER)) == NULL)
                                         g_debug ("No notify-subscription-id in response!\n");
                                 else
-                                        manager->priv->subscription_id = attr->values[0].integer;
+                                        manager->priv->subscription_id = ippGetInteger (attr, 0);
                         }
 
                         if (response)
