wok diff xfprint/stuff/xfprint-4.6.1-cups-1.6.patch @ rev 18900
Up: Correct link to author homepage and better appearance file description in Tazpanel.
author | Leonardo Laporte <hackdorte@sapo.pt> |
---|---|
date | Thu Feb 18 16:11:22 2016 -0200 (2016-02-18) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xfprint/stuff/xfprint-4.6.1-cups-1.6.patch Thu Feb 18 16:11:22 2016 -0200 1.3 @@ -0,0 +1,136 @@ 1.4 +>From 2b5b2efdf2ce8233933c1304dc00c271303a4d92 Mon Sep 17 00:00:00 2001 1.5 +From: Matt Philips <matt.philips@timesys.com> 1.6 +Date: Fri, 19 Apr 2013 14:31:37 -0400 1.7 +Subject: [PATCH] Use CUPS-1.6 IPP API getter/setter functions 1.8 + 1.9 +CUPS 1.6 makes various structures private and introduces these ippGet 1.10 +and ippSet functions for all of the fields in these structures. 1.11 +http://www.cups.org/str.php?L3928 1.12 + 1.13 +We define our own accessors when building against CUPS < 1.6. 1.14 + 1.15 +Based on work by Jiri Popelka <jpopelka@redhat.com> at 1.16 +https://bugzilla.gnome.org/show_bug.cgi?id=679759 1.17 +--- 1.18 + printing-systems/cups/cups.c | 64 +++++++++++++++++----------- 1.19 + 1 file changed, 38 insertions(+), 26 deletions(-) 1.20 + 1.21 +diff --git a/printing-systems/cups/cups.c b/xfprint-4.6.1/printing-systems/cups/cups.c 1.22 +index 96b30d1..9d5df01 100644 1.23 +--- a/printing-systems/cups/cups.c 1.24 ++++ b/printing-systems/cups/cups.c 1.25 +@@ -44,6 +44,37 @@ G_MODULE_EXPORT const gchar version[] = VERSION; 1.26 + G_MODULE_EXPORT const gchar author[] = "Jean-François Wauthy"; 1.27 + G_MODULE_EXPORT const gchar homepage[] = "http://www.xfce.org"; 1.28 + 1.29 ++/* fix for cups 1.6 incompatibility */ 1.30 ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) 1.31 ++#define HAVE_CUPS_1_6 1 1.32 ++#endif 1.33 ++ 1.34 ++#ifndef HAVE_CUPS_1_6 1.35 ++#define ippGetState(request) request->state 1.36 ++#define ippGetInteger(attr, element) attr->values[element].integer 1.37 ++#define ippGetString(attr, element, language) attr->values[element].string.text 1.38 ++#define ippNewRequest(operation_id) cups_request_new(operation_id) 1.39 ++ 1.40 ++static ipp_t * 1.41 ++cups_request_new (int operation_id) 1.42 ++{ 1.43 ++ ipp_t *request; 1.44 ++ cups_lang_t *language; 1.45 ++ 1.46 ++ language = cupsLangDefault (); 1.47 ++ request = ippNew (); 1.48 ++ request->request.op.operation_id = operation_id; 1.49 ++ request->request.op.request_id = 1; 1.50 ++ 1.51 ++ ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, "utf-8"); 1.52 ++ 1.53 ++ ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); 1.54 ++ cupsLangFree (language); 1.55 ++ 1.56 ++ return request; 1.57 ++} 1.58 ++#endif 1.59 ++ 1.60 + static GtkActionEntry printer_list_action_entries[] = { 1.61 + {"set-default-printer", GTK_STOCK_PRINT, N_("Set as default printer"), NULL, 1.62 + N_("Set as default CUPS printer"), G_CALLBACK (action_set_default_printer_cb),}, 1.63 +@@ -126,25 +157,6 @@ cups_password_cb (const char *prompt) 1.64 + } 1.65 + 1.66 + static ipp_t * 1.67 +-cups_request_new (int operation_id) 1.68 +-{ 1.69 +- ipp_t *request; 1.70 +- cups_lang_t *language; 1.71 +- 1.72 +- language = cupsLangDefault (); 1.73 +- request = ippNew (); 1.74 +- request->request.op.operation_id = operation_id; 1.75 +- request->request.op.request_id = 1; 1.76 +- 1.77 +- ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, "utf-8"); 1.78 +- 1.79 +- ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); 1.80 +- cupsLangFree (language); 1.81 +- 1.82 +- return request; 1.83 +-} 1.84 +- 1.85 +-static ipp_t * 1.86 + cups_request_new_for_printer (int operation_id, const gchar * printer) 1.87 + { 1.88 + ipp_t *request; 1.89 +@@ -160,7 +172,7 @@ cups_request_new_for_printer (int operation_id, const gchar * printer) 1.90 + } 1.91 + 1.92 + printer_uri = g_strdup_printf ("ipp://%s/printers/%s", server, printer); 1.93 +- request = cups_request_new (operation_id); 1.94 ++ request = ippNewRequest (operation_id); 1.95 + 1.96 + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer_uri); 1.97 + 1.98 +@@ -242,24 +254,24 @@ get_printers () 1.99 + 1.100 + if (!request) 1.101 + continue; 1.102 +- if (request->state == IPP_ERROR || request->state == IPP_IDLE) { 1.103 ++ if (ippGetState (request) == IPP_ERROR || ippGetState (request) == IPP_IDLE) { 1.104 + ippDelete (request); 1.105 + continue; 1.106 + } 1.107 + 1.108 + attr = ippFindAttribute (request, "printer-info", IPP_TAG_TEXT); 1.109 +- if (!attr || strlen (attr->values[0].string.text) == 0) { 1.110 ++ if (!attr || strlen (ippGetString (attr, 0, NULL)) == 0) { 1.111 + attr = ippFindAttribute (request, "printer-make-and-model", IPP_TAG_TEXT); 1.112 + if (attr) 1.113 +- printer->alias = g_strdup (attr->values[0].string.text); 1.114 ++ printer->alias = g_strdup (ippGetString (attr, 0, NULL)); 1.115 + else 1.116 + printer->alias = g_strdup (""); 1.117 + } 1.118 + else 1.119 +- printer->alias = g_strdup (attr->values[0].string.text); 1.120 ++ printer->alias = g_strdup (ippGetString (attr, 0, NULL)); 1.121 + 1.122 + attr = ippFindAttribute (request, "printer-type", IPP_TAG_ENUM); 1.123 +- if (attr && (attr->values[0].integer & CUPS_PRINTER_CLASS)) 1.124 ++ if (attr && (ippGetInteger (attr, 0) & CUPS_PRINTER_CLASS)) 1.125 + printer->type = PRINTER_TYPE_CLASS; 1.126 + else 1.127 + printer->type = PRINTER_TYPE_PRINTER; 1.128 +@@ -309,7 +321,7 @@ get_printer_state (const gchar * printer) 1.129 + ipp_attribute_t *attr = ippFindAttribute (request, "printer-state", 1.130 + IPP_TAG_ENUM); 1.131 + if (attr) 1.132 +- switch (attr->values[0].integer) { 1.133 ++ switch (ippGetInteger (attr, 0)) { 1.134 + case IPP_PRINTER_IDLE: 1.135 + state = PRINTER_STATE_IDLE; 1.136 + break; 1.137 +-- 1.138 +1.7.9.5 1.139 +