1
From 644b7e358f992f35f370015c392ef4c9bcfb9ed8 Mon Sep 17 00:00:00 2001
2
From: Jiri Popelka <jpopelka@redhat.com>
3
Date: Wed, 11 Jul 2012 16:17:12 +0000
4
Subject: Use CUPS-1.6 IPP API getter/setter functions.
6
CUPS 1.6 makes various structures private and
7
introduces these ippGet and ippSet functions
8
for all of the fields in these structures.
9
http://www.cups.org/str.php?L3928
11
We define our own accessors when
12
building against CUPS < 1.6.
14
Index: gnome-settings-daemon-3.4.2/plugins/print-notifications/gsd-print-notifications-manager.c
15
===================================================================
16
--- gnome-settings-daemon-3.4.2.orig/plugins/print-notifications/gsd-print-notifications-manager.c 2012-08-08 15:36:25.000000000 +0200
17
+++ gnome-settings-daemon-3.4.2/plugins/print-notifications/gsd-print-notifications-manager.c 2012-08-08 15:38:48.820909196 +0200
19
#define CONNECTING_TIMEOUT 60
20
#define REASON_TIMEOUT 15000
22
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
23
+#define HAVE_CUPS_1_6 1
26
+#ifndef HAVE_CUPS_1_6
27
+#define ippGetStatusCode(ipp) ipp->request.status.status_code
28
+#define ippGetInteger(attr, element) attr->values[element].integer
29
+#define ippGetString(attr, element, language) attr->values[element].string.text
32
struct GsdPrintNotificationsManagerPrivate
34
GDBusProxy *cups_proxy;
36
response = cupsDoRequest (http, request, "/");
39
- if (response->request.status.status_code <= IPP_OK_CONFLICT &&
40
+ if (ippGetStatusCode (response) <= IPP_OK_CONFLICT &&
41
(attr = ippFindAttribute(response, "job-originating-user-name",
43
- if (g_strcmp0 (attr->values[0].string.text, cupsUser ()) == 0)
44
+ if (g_strcmp0 (ippGetString (attr, 0, NULL), cupsUser ()) == 0)
49
"notify-lease-duration", SUBSCRIPTION_DURATION);
50
response = cupsDoRequest (http, request, "/");
52
- if (response != NULL && response->request.status.status_code <= IPP_OK_CONFLICT) {
53
+ if (response != NULL && ippGetStatusCode (response) <= IPP_OK_CONFLICT) {
54
if ((attr = ippFindAttribute (response, "notify-subscription-id",
55
IPP_TAG_INTEGER)) == NULL)
56
g_debug ("No notify-subscription-id in response!\n");
58
- manager->priv->subscription_id = attr->values[0].integer;
59
+ manager->priv->subscription_id = ippGetInteger (attr, 0);
63
Index: gnome-settings-daemon-3.4.2/plugins/print-notifications/gsd-printer.c
64
===================================================================
65
--- gnome-settings-daemon-3.4.2.orig/plugins/print-notifications/gsd-printer.c 2012-04-16 14:34:43.000000000 +0200
66
+++ gnome-settings-daemon-3.4.2/plugins/print-notifications/gsd-printer.c 2012-08-08 15:38:48.824909196 +0200
68
#define GNOME_SESSION_PRESENCE_DBUS_PATH "/org/gnome/SessionManager/Presence"
69
#define GNOME_SESSION_PRESENCE_DBUS_IFACE "org.gnome.SessionManager.Presence"
71
+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
72
+#define HAVE_CUPS_1_6 1
75
+#ifndef HAVE_CUPS_1_6
76
+#define ippGetState(ipp) ipp->state
80
PRESENCE_STATUS_AVAILABLE = 0,
81
PRESENCE_STATUS_INVISIBLE,
84
("Automatic configuration"));
86
- if (response->state == IPP_ERROR)
87
+ if (ippGetState (response) == IPP_ERROR)
88
g_warning ("An error has occured during automatic configuration of new printer.");