Update to gtklp-1.2.9 and fix build with cups >= 1.6.0.

This commit is contained in:
ajacoutot 2012-08-15 13:22:29 +00:00
parent e4000a8de2
commit 44dc58e842
7 changed files with 338 additions and 38 deletions

View File

@ -1,12 +1,10 @@
# $OpenBSD: Makefile,v 1.16 2012/04/11 15:59:56 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.17 2012/08/15 13:22:29 ajacoutot Exp $
COMMENT= GTK+2 frontend to CUPS
DISTNAME= gtklp-1.2.8
DISTNAME= gtklp-1.2.9
CATEGORIES= print sysutils x11
REVISION= 2
EXTRACT_SUFX= .src.tar.gz
HOMEPAGE= http://gtklp.sirtobi.com/
@ -19,19 +17,22 @@ PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB += X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes
WANTLIB += Xi Xinerama Xrandr Xrender asn1 atk-1.0 c cairo crypto cups>=3
WANTLIB += expat fontconfig freetype gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0
WANTLIB += glib-2.0 gmodule-2.0 gobject-2.0 gssapi gthread-2.0 z
WANTLIB += gtk-x11-2.0 krb5 m pango-1.0 pangocairo-1.0 pangoft2-1.0 pixman-1
WANTLIB += png pthread pthread-stubs ssl xcb xcb-render GL Xxf86vm drm xcb-shm
WANTLIB += GL X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
WANTLIB += Xrandr Xrender asn1 atk-1.0 c cairo crypto cups expat
WANTLIB += fontconfig freetype gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0
WANTLIB += glib-2.0 gobject-2.0 gssapi gtk-x11-2.0 krb5 m pango-1.0
WANTLIB += pangocairo-1.0 pangoft2-1.0 pixman-1 png pthread pthread-stubs
WANTLIB += ssl xcb xcb-render xcb-shm z
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=gtklp/}
MODULES= devel/gettext
LIB_DEPENDS= x11/gtk+2 \
print/cups>=1.5.0
print/cups,-libs
# package is only useful if cups is installed
RUN_DEPENDS += print/cups
USE_LIBTOOL= Yes
USE_GMAKE= Yes

View File

@ -1,5 +1,2 @@
MD5 (gtklp-1.2.8.src.tar.gz) = ZccIkUC1+OKgsoKzCDt4rg==
RMD160 (gtklp-1.2.8.src.tar.gz) = T2h+Ti8Me9ekmr7vfGNgm3ewSMY=
SHA1 (gtklp-1.2.8.src.tar.gz) = qIHMhwXcyWu6gGkpZ5tTkvsgxy0=
SHA256 (gtklp-1.2.8.src.tar.gz) = x2X/QHKDQqBTGsP47VlC+68UPO6aZqcwCgFBramWbIY=
SIZE (gtklp-1.2.8.src.tar.gz) = 743764
SHA256 (gtklp-1.2.9.src.tar.gz) = Ddn/vwvv9e/8BahFakM1Yi8uHYZPi+N4iT6a9sp6w1g=
SIZE (gtklp-1.2.9.src.tar.gz) = 1149729

View File

@ -0,0 +1,55 @@
$OpenBSD: patch-gtklp_gtklp_functions_c,v 1.1 2012/08/15 13:22:29 ajacoutot Exp $
Fix build with cups >= 1.6.0
--- gtklp/gtklp_functions.c.orig Wed Aug 15 14:47:22 2012
+++ gtklp/gtklp_functions.c Wed Aug 15 14:47:04 2012
@@ -173,8 +173,8 @@ void getBannerList(char *printername)
*z1='/';
request=ippNew();
- request->request.op.operation_id=IPP_GET_PRINTER_ATTRIBUTES;
- request->request.op.request_id=1;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
+ ippSetRequestId(request, 1);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(cupsLanguage));
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,cupsLanguage->language);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,URI);
@@ -194,7 +194,7 @@ void getBannerList(char *printername)
}
else
{
- bannerAnz=attr->num_values;
+ bannerAnz=ippGetCount(attr);
if(bannerAnz > MAX_BANNER)
{
if(DEBUG)
@@ -206,8 +206,8 @@ void getBannerList(char *printername)
for(i1=0;i1<bannerAnz;i1++)
{
if(DEBUG)
- printf(" %s\n",attr->values[i1].string.text);
- strncpy(Banners[i1],(char *)attr->values[i1].string.text,(size_t)MAXLINE);
+ printf(" %s\n",ippGetString (attr, 1, NULL));
+ strncpy(Banners[i1],(char *)ippGetString (attr, 1, NULL),(size_t)MAXLINE);
bannerList=g_list_append(bannerList,(gchar *)str2str(Banners[i1]));
}
}
@@ -1890,7 +1890,7 @@ void PrintFunc( GtkWidget *widget,gpointer data )
cups_option_t **optionsptr;
const char *files[MAXPRINTFILES];
char tmpprn[DEF_PRN_LEN+1];
- char *spoolfile;
+ char *spoolfile;
for(i1=0;i1<=filesToPrintAnz;i1++)
files[i1]=filesToPrint[i1];
@@ -1952,7 +1952,7 @@ void PrintFunc( GtkWidget *widget,gpointer data )
{
if(DEBUG) printf("NumOpts-final(printing from stdin): %i\n",num_options);
- spoolfile=cupsTempFile2(tmppath,sizeof(tmppath));
+ spoolfile=(char*)cupsTempFile2(tmppath,sizeof(tmppath));
if(spoolfile == (uintptr_t)NULL)
{

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-gtklp_gtklp_h,v 1.2 2011/09/08 10:34:25 ajacoutot Exp $
Fix build fix cups >=1.5.
--- gtklp/gtklp.h.orig Thu Feb 11 20:38:17 2010
+++ gtklp/gtklp.h Thu Sep 8 10:28:45 2011
@@ -24,9 +24,11 @@
#ifndef GTKLP_H
#define GTKLP_H
+#include <stdint.h>
#include <gtk/gtk.h>
#include <cups/cups.h>
#include <cups/http.h>
+#include <cups/ppd.h>
#include <defaults.h>

View File

@ -0,0 +1,213 @@
$OpenBSD: patch-gtklpq_printer_c,v 1.1 2012/08/15 13:22:29 ajacoutot Exp $
Fix build with cups >= 1.6.0
--- gtklpq/printer.c.orig Wed Aug 15 14:53:06 2012
+++ gtklpq/printer.c Wed Aug 15 15:10:27 2012
@@ -345,8 +345,8 @@ void printerStatus (char *URI)
}
request = ippNew ();
- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
- request->request.op.request_id = 1;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
+ ippSetRequestId(request, 1);
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding (cupsLanguage));
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
@@ -360,7 +360,7 @@ void printerStatus (char *URI)
!= NULL)
{
aktPrinterHold=0;
- switch (attr->values[0].integer)
+ switch (ippGetInteger (attr, 0))
{
case IPP_PRINTER_IDLE:
strncpy (toolstring, str2str(_("Printer Idle")),(size_t)MAXLINE);
@@ -373,17 +373,17 @@ void printerStatus (char *URI)
aktPrinterHold=1;
break;
default:
- snprintf (toolstring, (size_t)MAXLINE, "%i", attr->values[0].integer);
+ snprintf (toolstring, (size_t)MAXLINE, "%i", ippGetInteger (attr, 0));
break;
}
jobsRejected=0;
attr = ippFindAttribute (response, "printer-is-accepting-jobs", IPP_TAG_ZERO);
if(attr != NULL) {
- if(attr->values[0].integer == 0)
+ if(ippGetInteger (attr, 0) == 0)
jobsRejected=1;
if(DEBUG)
- printf("Attr=%s: %i\n",attr->name,attr->values[0].integer);
+ printf("Attr=%s: %i\n",ippGetInteger (attr, 0));
}
if(nox == 0) {
@@ -429,8 +429,8 @@ void printerStatus (char *URI)
if ( (attr = ippFindAttribute (response, "printer-state-message", IPP_TAG_ZERO)) != NULL)
{
- if ((strlen (toolstring) + strlen (attr->values[0].string.text)) < MAXLINE)
- snprintf (toolstring, (size_t)MAXLINE, "%s - %s", toolstring, attr->values[0].string.text);
+ if ((strlen (toolstring) + strlen (ippGetString (attr, 0, NULL))) < MAXLINE)
+ snprintf (toolstring, (size_t)MAXLINE, "%s - %s", toolstring, ippGetString (attr, 0, NULL));
}
if(nox == 0)
m_id_state = gtk_statusbar_push ((GtkStatusbar *) statbar, c_id_state, (const char *) str2str(toolstring));
@@ -522,7 +522,7 @@ int printQueueUpdate (GtkWidget * widget, gpointer dat
//request = ippNew ();
//request->request.op.operation_id = IPP_GET_JOBS;
request = ippNewRequest(IPP_GET_JOBS);
- request->request.op.request_id = 1;
+ ippSetRequestId(request, 1);
language = cupsLangDefault ();
@@ -568,12 +568,12 @@ int printQueueUpdate (GtkWidget * widget, gpointer dat
if ((response = cupsDoRequest (cupsHttp, request, "/")) != NULL)
{
- if (response->request.status.status_code > IPP_OK_CONFLICT)
+ if (ippGetStatusCode(response) > IPP_OK_CONFLICT)
{
if(nox == 0)
- m_id_upd = gtk_statusbar_push ((GtkStatusbar *) statbar, c_id_upd, str2str((char *)ippErrorString(response->request.status.status_code)));
+ m_id_upd = gtk_statusbar_push ((GtkStatusbar *) statbar, c_id_upd, str2str((char *)ippErrorString(ippGetStatusCode(response))));
else
- g_print("[%s] %s: %s\n\n",PrinterNames[PrinterChoice], str2str(_("Error")),ippErrorString (response->request.status.status_code));
+ g_print("[%s] %s: %s\n\n",PrinterNames[PrinterChoice], str2str(_("Error")),ippErrorString (ippGetStatusCode(response)));
ippDelete (response);
return(FALSE);
}
@@ -642,10 +642,10 @@ int printQueueUpdate (GtkWidget * widget, gpointer dat
}
rank = 1;
- for (attr = response->attrs; attr != NULL; attr = attr->next)
+ for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response))
{
- while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
- attr = attr->next;
+ while (attr != NULL && ippGetGroupTag (attr) != IPP_TAG_JOB)
+ ippNextAttribute (response);
if (attr == NULL)
break;
@@ -658,39 +658,39 @@ int printQueueUpdate (GtkWidget * widget, gpointer dat
jobdest = NULL;
jobcopies = 1;
- while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
+ while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_JOB)
{
- if (strcmp (attr->name, "job-id") == 0 &&
- attr->value_tag == IPP_TAG_INTEGER)
- jobid = attr->values[0].integer;
+ if (strcmp (ippGetName (attr), "job-id") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_INTEGER)
+ jobid = ippGetInteger (attr, 0);
- if (strcmp (attr->name, "job-k-octets") == 0 &&
- attr->value_tag == IPP_TAG_INTEGER)
- jobsize = attr->values[0].integer * 1024;
+ if (strcmp (ippGetName (attr), "job-k-octets") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_INTEGER)
+ jobsize = ippGetInteger (attr, 0) * 1024;
- if (strcmp (attr->name, "job-state") == 0 &&
- attr->value_tag == IPP_TAG_ENUM)
- jobstate = (ipp_jstate_t) attr->values[0].integer;
+ if (strcmp (ippGetName (attr), "job-state") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_ENUM)
+ jobstate = (ipp_jstate_t) ippGetInteger (attr, 0);
- if (strcmp (attr->name, "job-printer-uri") == 0 &&
- attr->value_tag == IPP_TAG_URI)
- if ((jobdest = strrchr (attr->values[0].string.text, '/')) !=
+ if (strcmp (ippGetName (attr), "job-printer-uri") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_URI)
+ if ((jobdest = strrchr (ippGetString (attr, 0, NULL), '/')) !=
NULL)
jobdest++;
- if (strcmp (attr->name, "job-originating-user-name") == 0 &&
- attr->value_tag == IPP_TAG_NAME)
- jobuser = attr->values[0].string.text;
+ if (strcmp (ippGetName (attr), "job-originating-user-name") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_NAME)
+ jobuser = ippGetString (attr, 0, NULL);
- if (strcmp (attr->name, "job-name") == 0 &&
- attr->value_tag == IPP_TAG_NAME)
- jobname = attr->values[0].string.text;
+ if (strcmp (ippGetName (attr), "job-name") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_NAME)
+ jobname = ippGetString (attr, 0, NULL);
- if (strcmp (attr->name, "copies") == 0 &&
- attr->value_tag == IPP_TAG_INTEGER)
- jobcopies = attr->values[0].integer;
+ if (strcmp (ippGetName (attr), "copies") == 0 &&
+ ippGetValueTag (attr) == IPP_TAG_INTEGER)
+ jobcopies = ippGetInteger (attr, 0);
- attr = attr->next;
+ attr = ippNextAttribute (response);
}
if (jobdest == NULL || jobid == 0)
@@ -1098,8 +1098,8 @@ int jobAttr(int job_id, int num_options, cups_option_t
cups_lang_t *language;
request = ippNew();
- request->request.op.operation_id = IPP_SET_JOB_ATTRIBUTES;
- request->request.op.request_id = 1;
+ ippSetOperation(request, IPP_SET_JOB_ATTRIBUTES);
+ ippSetRequestId(request, 1);
language = cupsLangDefault ();
@@ -1129,10 +1129,10 @@ int jobAttr(int job_id, int num_options, cups_option_t
if ((response = cupsDoRequest(cupsHttp, request, "/jobs")) != NULL)
{
- if (response->request.status.status_code > IPP_OK_CONFLICT)
+ if (ippGetStatusCode (response) > IPP_OK_CONFLICT)
{
if(DEBUG)
- printf("set-job-attributes failed(1): %s\n",ippErrorString(response->request.status.status_code));
+ printf("set-job-attributes failed(1): %s\n",ippErrorString(ippGetStatusCode (response)));
quick_message(str2str(_("Unable to change priority!")),2);
ippDelete(response);
return (1);
@@ -1254,8 +1254,8 @@ void cancelJob (GtkWidget * dialog)
gtk_widget_destroy (dialog);
request = ippNew ();
- request->request.op.operation_id = op;
- request->request.op.request_id = 1;
+ ippSetOperation(request, op);
+ ippSetRequestId(request, 1);
language = cupsLangDefault ();
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL,
@@ -1329,7 +1329,7 @@ void cancelJob (GtkWidget * dialog)
if (response != NULL)
{
- switch (response->request.status.status_code)
+ switch (ippGetStatusCode (response))
{
case IPP_NOT_FOUND:
quick_message(str2str(_("Job or printer not found!")),2);
@@ -1341,7 +1341,7 @@ void cancelJob (GtkWidget * dialog)
quick_message(str2str(_("You don't own this job!")),2);
break;
default:
- if (response->request.status.status_code > IPP_OK_CONFLICT)
+ if (ippGetStatusCode (response) > IPP_OK_CONFLICT)
quick_message(str2str(_("Unable to do so!")),2);
break;
}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-include_defaults_h,v 1.2 2009/06/22 08:20:48 ajacoutot Exp $
--- include/defaults.h.orig Sun Jun 21 14:25:37 2009
+++ include/defaults.h Mon Jun 22 10:17:28 2009
$OpenBSD: patch-include_defaults_h,v 1.3 2012/08/15 13:22:29 ajacoutot Exp $
--- include/defaults.h.orig Wed May 16 21:36:44 2012
+++ include/defaults.h Wed Aug 15 12:01:55 2012
@@ -22,6 +22,8 @@
#ifndef CONFIG_H
#define CONFIG_H
@ -9,7 +9,7 @@ $OpenBSD: patch-include_defaults_h,v 1.2 2009/06/22 08:20:48 ajacoutot Exp $
+
#define PROGNAME "GtkLP"
#define MY_MAIL "gtklp@sirtobi.com"
#define MY_HOME "http://gtklp.sourceforge.net/"
#define MY_HOME "http://gtklp.sirtobi.com/"
@@ -40,6 +42,7 @@
#define INFRAME_SPACING_V 2
#define BUTTON_SPACING_H 10

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-libgtklp_libgtklp_c,v 1.1 2012/08/15 13:22:29 ajacoutot Exp $
Fix build with cups >= 1.6.0
--- libgtklp/libgtklp.c.orig Wed Aug 15 14:48:25 2012
+++ libgtklp/libgtklp.c Wed Aug 15 14:51:01 2012
@@ -345,8 +345,8 @@ void getPrinters(int loop)
}
snprintf(URI,(size_t)MAX_URI,"ipp://%s/printers/%s",ServerName,dests[i1].name);
request=ippNew();
- request->request.op.operation_id=IPP_GET_PRINTER_ATTRIBUTES;
- request->request.op.request_id=1;
+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
+ ippSetRequestId(request, 1);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(cupsLanguage));
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,cupsLanguage->language);
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,URI);
@@ -359,9 +359,9 @@ void getPrinters(int loop)
if((attr=ippFindAttribute(response,"job-sheets-default",IPP_TAG_ZERO)) != NULL)
{
if(DEBUG)
- printf("Job-Sheets-Default for %s\n Start: %s\n Stop: %s\n",dests[i1].name,attr->values[0].string.text,attr->values[1].string.text);
- strncpy(PrinterBannerStart[i1-droppedPrinters],attr->values[0].string.text,(size_t)MAXLINE);
- strncpy(PrinterBannerEnd[i1-droppedPrinters],attr->values[1].string.text,(size_t)MAXLINE);
+ printf("Job-Sheets-Default for %s\n Start: %s\n Stop: %s\n",dests[i1].name,ippGetString (attr, 0, NULL),ippGetString (attr, 1, NULL));
+ strncpy(PrinterBannerStart[i1-droppedPrinters],ippGetString (attr, 0, NULL),(size_t)MAXLINE);
+ strncpy(PrinterBannerEnd[i1-droppedPrinters],ippGetString (attr, 1, NULL),(size_t)MAXLINE);
}
else
{
@@ -373,8 +373,8 @@ void getPrinters(int loop)
if((attr=ippFindAttribute(response,"printer-location",IPP_TAG_ZERO)) != NULL)
{
if(DEBUG)
- printf("Location: %s\n",attr->values[0].string.text);
- strncpy(PrinterLocations[i1-droppedPrinters],attr->values[0].string.text,(size_t)MAXLINE);
+ printf("Location: %s\n",ippGetString (attr, 0, NULL));
+ strncpy(PrinterLocations[i1-droppedPrinters],ippGetString (attr, 0, NULL),(size_t)MAXLINE);
}
else
{
@@ -384,8 +384,8 @@ void getPrinters(int loop)
if((attr=ippFindAttribute(response,"printer-info",IPP_TAG_ZERO)) != NULL)
{
if(DEBUG)
- printf("Info: %s\n",attr->values[0].string.text);
- strncpy(PrinterInfos[i1-droppedPrinters],attr->values[0].string.text,(size_t)MAXLINE);
+ printf("Info: %s\n",ippGetString (attr, 0, NULL));
+ strncpy(PrinterInfos[i1-droppedPrinters],ippGetString (attr, 0, NULL),(size_t)MAXLINE);
}
else
{