Re: files for gtk+-2.18.9 to build with cups enabled

Hanspeter Niederstrasser <[email protected]>
Newsgroups gmane.os.apple.fink.beginners
Organization Snaggled Works
Message-ID <[email protected]>
On 2/3/20 11:23 PM, Tom Liehe via Fink-beginners wrote:
> The two files in the attached archive live in gtk+-2.18.9/modules/printbackends/cups
> 
> With these I can build gtk+2 with cups enabled.
> 
> Any hints on how I could test? Mostly very straightforward but would be nice to test.

Thanks for doing this.

I've converted your modified files into a patch. It worked for me on 
10.13 and 10.15.

Place the two attached files in /opt/sw/fink/dists/local/main/finkinfo, 
then confirm with 'fink list gtk+2' that it shows version 2.18.9-101 as 
available.

Then run `fink -m rebuild gtk+2`. That should finish successfully now.

Hanspeter

_______________________________________________
Fink-beginners mailing list
[email protected]
List archive:
https://sourceforge.net/p/fink/mailman/fink-users/
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-beginners
gtk+2-10.15.info (text/plain, 10.7 KB)
Package: gtk+2
Version: 2.18.9
Revision: 101
Distribution: 10.15
Description: The Gimp Toolkit
License: LGPL
Maintainer: The Gnome Core Team <[email protected]>

Depends: <<
	%N-shlibs (= %v-%r),
	glib2-shlibs (>= 2.22.0-1),
	libgettext8-shlibs,
	x11
<<
BuildDepends: <<
	atk1 (>= 1.32.0-1),
	cairo (>= 1.12.14-1),
	fink (>= 0.24.12-1),
	fink-package-precedence,
	fontconfig2-dev (>= 2.10.0-1),
	freetype219 (>= 2.6-1),
	gettext-bin,
	gettext-tools,
	glib2-dev (>= 2.22.0-1),
	gtk-doc (>= 1.13-5),
	libgettext8-dev,
	libjasper.1 (>= 1.900.1-4),
	libjpeg9,
	libpng16,
	libtiff5,
	pango1-xft2-ft219-dev (>= 1.24.5-4),
	pkgconfig (>= 0.23),
	x11-dev
<<
Conflicts: %N-common
Replaces: %N-common
Source: mirror:gnome:sources/gtk+/2.18/gtk+-%v.tar.bz2
Source-MD5: f680d38c973635365acababacb1730ec
#Source2: mirror:debian:pool/main/g/gtk+2.0/gtk+2.0_2.18.7-1.diff.gz
Source2: https://ftp.gnome.org/mirror/archive/ftp.sunet.se/pub/mac/fink/gtk+2.0_2.18.7-1.diff.gz
Source2-MD5: 4a41c6d2b5d29833759610abe1268686
PatchFile: %n.patch
PatchFile-MD5: ff65044275710a14327d9c813ab2fc4e
PatchFile2: %n-cups.patch
PatchFile2-MD5: ec7cfa11d6f59324d8e5eaafcc8bc1e2
PatchScript: <<
#!/bin/sh -ev
	sed -e 's|@PREFIX@|%p|g' <%{PatchFile} | patch -p1
	patch -p1 < %{PatchFile2}
	gzip -dc ../gtk*.diff.gz | patch -p1
	for file in \
		015_default-fallback-icon-theme.patch \
		042_treeview_single-focus.patch \
		060_ignore-random-icons.patch \
	; do
		echo "applying $file"
		patch -p1 < debian/patches/$file
	done
#	perl -pi -e 's,/usr/bin/env python,/usr/bin/python,' gtk/gtk-builder-convert
	perl -pi -e 's,/usr/share/gtk-doc/html,%p/share/gtk-doc/html,g' docs/reference/*/html/*.html
	perl -pi -e 's/\$\(no_undefined\)/-no-undefined/' `find . -name Makefile.in`
	perl -pi -e 's,libpng12,libpng16,' configure
<<

SetCPPFLAGS: -D_IPP_PRIVATE_STRUCTURES=1
SetCFLAGS: -Os
SetCXXFLAGS: -Os
ConfigureParams: <<
	--mandir=%p/share/man \
	--disable-shm \
	--disable-gtk-doc \
	--enable-dependency-tracking \
	--disable-explicit-deps \
	--enable-cups \
	--disable-papi \
	--with-libjasper \
	--disable-visibility \
	PKG_CONFIG_PATH="%p/lib/glib-2.0/pkgconfig-strict:$PKG_CONFIG_PATH"
<<

CompileScript: <<
	./configure %c
	make
	fink-package-precedence --prohibit-bdep %n-dev .
<<
InfoTest: TestScript: make -C tests || exit 2
InstallScript: <<
	make install DESTDIR=%d
	find %i/lib/gtk-2.0 -name \*.la | xargs perl -pi -e "s/^(dependency_libs|inherited_linker_flags)=.*/\1=''/" 

	install -d -m 755 %i/sbin
	install -c -m 755 update-gdk-pixbuf-loaders %i/sbin/
	install -c -m 755 update-gtk-immodules %i/sbin/

	# libversioned actual placed in %N-shlibs because needed
	# during %N-shlibs PostInst; keep unversioned links in %N for
	# legacy compat for others' PostInst
	mv %i/bin/gdk-pixbuf-query-loaders     %i/bin/gdk-pixbuf-query-loaders-2.0
	ln -s     gdk-pixbuf-query-loaders-2.0 %i/bin/gdk-pixbuf-query-loaders
	perl -pi -e 's/(gdk-pixbuf-query-loaders)/\1-2.0/' %i/sbin/update-gdk-pixbuf-loaders
	mv %i/sbin/update-gdk-pixbuf-loaders     %i/sbin/update-gdk-pixbuf-loaders-2.0
	ln -s      update-gdk-pixbuf-loaders-2.0 %i/sbin/update-gdk-pixbuf-loaders
	mv %i/sbin/update-gtk-immodules     %i/sbin/update-gtk-immodules-2.0
	ln -s      update-gtk-immodules-2.0 %i/sbin/update-gtk-immodules

	install -d -m 755 %i/etc/gtk-2.0
	touch %i/etc/gtk-2.0/gtk.immodules
	touch %i/etc/gtk-2.0/gdk-pixbuf.loaders
<<
DocFiles: <<
	AUTHORS COPYING ChangeLog
	gdk-pixbuf/ChangeLog:ChangeLog.gdk-pixbuf
	modules/engines/pixbuf/ChangeLog:ChangeLog.modules.engines.pixbuf
	modules/other/gail/ChangeLog:ChangeLog.modules.other.gail
	NEWS README
<<
SplitOff: <<
	Package: %N-shlibs
	Depends: <<
		atk1-shlibs (>= 1.32.0-1),
		cairo-shlibs (>= 1.12.14-1),
		dpkg-base-files,
		fontconfig2-shlibs (>= 2.10.0-1),
		freetype219-shlibs (>= 2.6-1),
		glib2-shlibs (>= 2.22.0-1),
		libgettext8-shlibs,
		libjasper.1-shlibs (>= 1.900.1-4),
		libjpeg9-shlibs,
		libpng16-shlibs,
		libtiff5-shlibs,
		pango1-xft2-ft219-shlibs (>= 1.24.5-4),
		pango1-xft2-ft219 (>= 1.24.5-4),
		shared-mime-info (>= 0.70-1),
		x11-shlibs
	<<
	Replaces: <<
		%N (<< 2.14.4-1),
		%N-dev (<< 2.18.7-1),
		gtk2-engines (<< 2.6.3-1),
		gail16, gail17, gail18,
		gail18-shlibs
	<<
	Conflicts: jpilot (<< 0.99.9-12), jpilot-ssl, sylpheed-gpgme (<< 2.3.0-2), sylpheed (<< 2.3.0-2), sylpheed-ssl
	DocFiles: <<
		AUTHORS COPYING ChangeLog
		gdk-pixbuf/ChangeLog:ChangeLog.gdk-pixbuf
		modules/engines/pixbuf/ChangeLog:ChangeLog.modules.engines.pixbuf
		modules/other/gail/ChangeLog:ChangeLog.modules.other.gail
		NEWS README
	<<
	RuntimeVars: GDK_USE_XFT: 1
	Files: <<
		bin/gdk-pixbuf-query-loaders-2.0
		bin/gtk-query-immodules-2.0
		etc/gtk-2.0
		lib/libgailutil.18*.dylib
		lib/lib*-2.0.*.dylib
		lib/gtk-2.0/2.10.0/engines
		lib/gtk-2.0/2.10.0/immodules
		lib/gtk-2.0/2.10.0/loaders
		lib/gtk-2.0/2.10.0/printbackends
		lib/gtk-2.0/modules
		sbin/update-gdk-pixbuf-loaders-2.0
		sbin/update-gtk-immodules-2.0
		share/locale
		share/man/man1/gtk-query-immodules-2.0.1
		share/themes
	<<
	Shlibs: <<
		%p/lib/libgailutil.18.dylib           19.0.0 %n (>= 2.14.3-1)
		%p/lib/libgdk-x11-2.0.0.dylib         1801.0.0 %n (>= 2.18.7-1)
		%p/lib/libgdk_pixbuf-2.0.0.dylib      1801.0.0 %n (>= 2.18.7-1)
		%p/lib/libgdk_pixbuf_xlib-2.0.0.dylib 1801.0.0 %n (>= 2.18.7-1)
		%p/lib/libgtk-x11-2.0.0.dylib         1801.0.0 %n (>= 2.18.7-1)
	<<
	PostInstScript: <<
		case "$1" in
			configure)
				update-gdk-pixbuf-loaders-2.0
				update-gtk-immodules-2.0
				;;
		esac
	<<
<<
SplitOff2: <<
	Package: %N-dev
	Depends: <<
		%N (= %v-%r),
		%N-shlibs (= %v-%r),
		glib2-shlibs (>= 2.22.0-1),
		libgettext8-shlibs,
		x11
	<<
	Conflicts: <<
		gtk+ (<< 1.2.10-12),
		gail16-dev, gail17-dev, gail18-dev
	<<
	Replaces: <<
		%N (<< 2.14.5-1),
		%N-shlibs (<< 2.14.3-1),
		gail16, gail17, gail18,
		gail16-dev, gail17-dev, gail18-dev
	<<
	BuildDependsOnly: True
	DocFiles: <<
		AUTHORS COPYING ChangeLog
		gdk-pixbuf/ChangeLog:ChangeLog.gdk-pixbuf
		modules/engines/pixbuf/ChangeLog:ChangeLog.modules.engines.pixbuf
		modules/other/gail/ChangeLog:ChangeLog.modules.other.gail
		NEWS README
	<<
	Files: <<
		bin/gdk-pixbuf-csource
		bin/gtk-builder-convert
		include
		lib
		share/aclocal
		share/gtk-doc
		share/man/man1/gdk-pixbuf-csource.1
		share/man/man1/gtk-builder-convert.1
	<<
<<

Homepage: http://www.gtk.org
DescDetail: <<
The X libraries originally written for the GIMP, which are now used by
several other programs as well.
<<
DescUsage: <<
Packages which install gdk-pixbuf loader(s) should call update-gdk-
pixbuf-loaders in their PostInstScript and PostRmScript to update the
gdk-pixbuf.loaders file.

Packages which install gtk immodule(s) should call update-gtk-immodules
in their PostInstScript and PostRmScript to update the gtk.immodules file.

Reinstall %N-shlibs to regenerate those index files if they get
damaged or lost.

If you get "Operation not supported" errors when trying to open URLs
in gtk-based apps, try installing gvfs.
<<

DescPackaging: <<
Older versions of gtk2-engines had a pixbuf theme, but now gtk+2 has
that itself (and gtk2-engines has dropped or renamed it).

	Move some .la %N-shlibs -> %N.dev as of 2.14.3-1

	Minimize propagation of InheritedBuildDepends

	The stand-alone gail packages are obsolete as of gtk+2 2.14.3-1,
	at which point gtk+2 starting including gail18.

	Move lib/gtk-2.0/modules/*.so %N -> %N-shlibs as of 2.14.3-2
	(dir is as versioned as pkgname is)

	Move etc/gtk-2.0/im-multipress.conf %N -> %N-shlibs as of 2.14.3-2
	gtk-2.0/2.10.0/immodules/im-multipress.so in %N-shlibs
	(dir is as versioned as pkgname is, could change name in
	modules/input/gtkimcontextmultipress.c if need orthogonal
	filename for new  libversion pkgname)

	Move share/themes %N -> %N-shlibs as of 2.14.3-2
	(dir is as versioned as pkgname is, could split off into
	%N-themes if needed to keep across new libversion pkgname)

	Move gdk-pixbuf-csource %N -> %N-dev as of 2.14.5-1
	(developer tool to generate C code)

	Patch gtk-builder-convert to work with any python version.
	See: http://bugzilla.gnome.org/show_bug.cgi?id=559947

	As of 2.14.7-1, %N-shlibs contains a libversioned form of many
	utility programs that generate files needed by %N-shlibs so
	that users don't need to install %N in order for %N-shlibs to
	have the files. All data being handled is already in
	libversioned directories, so still sane for Shlibs Policy.

	As of 2.14.7-1, there are blank files installed in the .deb
	for the live indexes generated by the update-gtk-immodules and
	update-gdk-pixbuf-loaders scripts (run during PostInst).
	Having these files "owned" allows dpkg to remove them
	automatically when the package that can create them is
	removed, rather than needing to play PostRm purge and hope
	that doesn't interfere with a differently-named package that
	may handle these files in the future.

	Regenerating gtk-doc files The Right Way (--enable-gtk-doc) is
	very slow, so just patch the prefix in the bad URLs in the
	existing generated files.

	Fix install of manpages without regenerating them. See:
	http://bugzilla.gnome.org/show_bug.cgi?id=578765

	Tentatively okay to ignore diagnostics about symbolic color
	names in some themes' gtkrc. See:
	http://bugzilla.gnome.org/show_bug.cgi?id=586711

	Clear dep_libs from modules' .la because some inherit
	-framework flag from apple's cups-config.

	Don't lose early LIBS settings during ./configure. See:
	https://bugzilla.gnome.org/show_bug.cgi?id=608558

	Make sure we look for correct libpng (x11 may supply an older
	one that confuses configure test)

	Import modernization of libpng API jmpbuf calls from
	gdk-pixbuf-2.23.5

	"cups-config --libs" sometimes publishes "-liconv", which is
	not part of the public API of cups, so elide it rather than
	pushing a useless dep

	pango runtime (pango1-xft2-ft129-shlibs) often whines about
	missing fonts, which are in pango1-xft2-ft219. That package
	cannot be made a dep of the -shlibs (would be circular). So we
	have it as a dep here, which has the effect of "any package
	using gtk+2 runtime gets pango's fonts at runtime, so pango's
	runtime is happy"
<<
DescPort: <<
	gtk+2-dev conflicts with gtk+ (<< 1.2.11), because it has
	symbolic link which intercepts include files of the package.

	Import some Debian patches (whichever ones look useful)

	Make sure libgdk-x11 links against Xrender even on 10.4. See:
	http://bugzilla.gnome.org/show_bug.cgi?id=555763

	CUPS backend uses httpGetHostname(), which is only available
	with cups>=1.2, which only comes with OS X >= 10.5. Use
	upstream patch to import local copy of that function for
	platforms where system cups is too old.
	https://bugzilla.gnome.org/show_bug.cgi?id=610176

	Hidden-visibility is only partially supported on non-ELF and
	causes problems on 10.7 due to use of weak aliases. Removed in
	future glib upstream, so scrap it here too. See:
	http://permalink.gmane.org/gmane.os.apple.fink.gnome/2592
<<
gtk+2-cups.patch (text/plain, 13.5 KB)
diff -ruN gtk+-2.18.9-orig/modules/printbackends/cups/gtkcupsutils.c gtk+-2.18.9/modules/printbackends/cups/gtkcupsutils.c
--- gtk+-2.18.9-orig/modules/printbackends/cups/gtkcupsutils.c	2009-12-18 20:54:51.000000000 -0600
+++ gtk+-2.18.9/modules/printbackends/cups/gtkcupsutils.c	2020-02-03 12:26:43.000000000 -0600
@@ -165,8 +165,8 @@
   request->data_io = data_io;
 
   request->ipp_request = ippNew ();
-  request->ipp_request->request.op.operation_id = operation_id;
-  request->ipp_request->request.op.request_id = 1;
+  ippSetOperation(request->ipp_request, operation_id);
+  ippSetRequestId(request->ipp_request, 1);
 
   language = cupsLangDefault ();
 
@@ -343,8 +343,8 @@
                                   name,
                                   tag);
 
-  if (attribute != NULL && attribute->values != NULL)
-    return attribute->values[0].string.text;
+  if (attribute != NULL && ippGetCount(attribute) != NULL)
+    return ippGetString(attribute, 0, NULL);
   else
     return NULL;
 }
@@ -721,7 +721,7 @@
     request->attempts = 0;
 
     request->state = GTK_CUPS_POST_WRITE_REQUEST;
-    request->ipp_request->state = IPP_IDLE;
+    ippSetState(request->ipp_request, IPP_IDLE);
 }
 
 static void 
@@ -1213,7 +1213,8 @@
   request->state = GTK_CUPS_GET_CHECK;
   request->poll_state = GTK_CUPS_HTTP_READ;
   
-  request->ipp_request->state = IPP_IDLE;
+  ippSetState(request->ipp_request, IPP_IDLE);
+
 }
 
 static void 
diff -ruN gtk+-2.18.9-orig/modules/printbackends/cups/gtkprintbackendcups.c gtk+-2.18.9/modules/printbackends/cups/gtkprintbackendcups.c
--- gtk+-2.18.9-orig/modules/printbackends/cups/gtkprintbackendcups.c	2010-03-17 08:31:49.000000000 -0500
+++ gtk+-2.18.9/modules/printbackends/cups/gtkprintbackendcups.c	2020-02-03 12:10:54.000000000 -0600
@@ -67,8 +67,8 @@
 /* define this to see warnings about ignored ppd options */
 #undef PRINT_IGNORED_OPTIONS
 
-#define _CUPS_MAP_ATTR_INT(attr, v, a) {if (!g_ascii_strcasecmp (attr->name, (a))) v = attr->values[0].integer;}
-#define _CUPS_MAP_ATTR_STR(attr, v, a) {if (!g_ascii_strcasecmp (attr->name, (a))) v = attr->values[0].string.text;}
+#define _CUPS_MAP_ATTR_INT(attr, v, a) {if (!g_ascii_strcasecmp (ippGetName(attr), (a))) v = ippGetInteger(attr, 0);}
+#define _CUPS_MAP_ATTR_STR(attr, v, a) {if (!g_ascii_strcasecmp (ippGetName(attr), (a))) v = ippGetString(attr, 0, NULL);};
 
 static GType print_backend_cups_type = 0;
 
@@ -457,7 +457,7 @@
       ipp_t *response = gtk_cups_result_get_response (result);
 
       if ((attr = ippFindAttribute (response, "job-id", IPP_TAG_INTEGER)) != NULL)
-	job_id = attr->values[0].integer;
+	job_id = ippGetInteger(attr, 0);
 
       if (!gtk_print_job_get_track_print_status (ps->job) || job_id == 0)
 	gtk_print_job_set_status (ps->job, GTK_PRINT_STATUS_FINISHED);
@@ -808,7 +808,7 @@
 
       dispatch->backend->authentication_lock = TRUE;
 
-      switch (dispatch->request->ipp_request->request.op.operation_id)
+      switch (ippGetOperation(dispatch->request->ipp_request)) 
         {
           case 0:
             prompt = g_strdup_printf ( _("Authentication is required to get a file from %s"), hostname);
@@ -1295,10 +1295,10 @@
   loc = "";
   desc = "";
   job_count = 0;
-  for (attr = response->attrs; attr != NULL; attr = attr->next) 
+  for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response))
     {
-      if (!attr->name)
-        continue;
+      if (!ippGetName (attr))
+	continue;
 
       _CUPS_MAP_ATTR_STR (attr, loc, "printer-location");
       _CUPS_MAP_ATTR_STR (attr, desc, "printer-info");
@@ -1413,9 +1413,9 @@
   response = gtk_cups_result_get_response (result);
 
   state = 0;
-  for (attr = response->attrs; attr != NULL; attr = attr->next) 
+  for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response))
     {
-      if (!attr->name)
+      if (!ippGetName(attr))
         continue;
       
       _CUPS_MAP_ATTR_INT (attr, state, "job-state");
@@ -1448,7 +1448,7 @@
       done = TRUE;
       break;
     }
-
+  ; /* TOTAL KLUDGE FOR DEBUG */
   if (!done && data->job != NULL)
     {
       guint32 timeout;
@@ -1594,7 +1594,7 @@
 								  
   response = gtk_cups_result_get_response (result);
 
-  for (attr = response->attrs; attr != NULL; attr = attr->next)
+  for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response))
     {
       GtkPrinter *printer;
       const gchar *printer_name = NULL;
@@ -1662,46 +1662,47 @@
       
       /* Skip leading attributes until we hit a printer...
        */
-      while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
-        attr = attr->next;
+      attr = ippFirstAttribute (response);
+      while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_PRINTER)
+	attr = ippNextAttribute (response);
 
       if (attr == NULL)
         break;
 
-      while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
+      while (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_PRINTER)
       {
-        if (strcmp (attr->name, "printer-name") == 0 &&
-	    attr->value_tag == IPP_TAG_NAME)
-	  printer_name = attr->values[0].string.text;
-	else if (strcmp (attr->name, "printer-uri-supported") == 0 &&
-		 attr->value_tag == IPP_TAG_URI)
-	  printer_uri = attr->values[0].string.text;
-	else if (strcmp (attr->name, "member-uris") == 0 &&
-		 attr->value_tag == IPP_TAG_URI)
-	  member_uris = attr->values[0].string.text;
-        else if (strcmp (attr->name, "printer-location") == 0)
-          location = attr->values[0].string.text;
-        else if (strcmp (attr->name, "printer-info") == 0)
-          description = attr->values[0].string.text;
-        else if (strcmp (attr->name, "printer-state-message") == 0)
-          state_msg = attr->values[0].string.text;
-        else if (strcmp (attr->name, "printer-state-reasons") == 0)
+        if (strcmp (ippGetName(attr), "printer-name") == 0 &&
+	    ippGetValueTag(attr) == IPP_TAG_NAME)
+	  printer_name = ippGetString(attr, 0, NULL);
+	else if (strcmp (ippGetName(attr), "printer-uri-supported") == 0 &&
+		 ippGetValueTag(attr) == IPP_TAG_URI)
+	  printer_uri = ippGetString(attr, 0, NULL);
+	else if (strcmp (ippGetName(attr), "member-uris") == 0 &&
+		 ippGetValueTag(attr) == IPP_TAG_URI)
+	  member_uris = ippGetString(attr, 0, NULL);
+        else if (strcmp (ippGetName(attr), "printer-location") == 0)
+          location = ippGetString(attr, 0, NULL);
+        else if (strcmp (ippGetName(attr), "printer-info") == 0)
+          description = ippGetString(attr, 0, NULL);
+        else if (strcmp (ippGetName(attr), "printer-state-message") == 0)
+          state_msg = ippGetString(attr, 0, NULL);
+        else if (strcmp (ippGetName(attr), "printer-state-reasons") == 0)
           /* Store most important reason to reason_msg and set
              its importance at printer_state_reason_level */
           {
-            for (i = 0; i < attr->num_values; i++)
+	    for (i = 0; i < ippGetCount(attr); i++)
               {
-                if (strcmp (attr->values[i].string.text, "none") != 0)
+		if (strcmp (ippGetString(attr, i, NULL), "none") != 0) 
                   {
                     /* Sets is_paused flag for paused printer. */
-                    if (strcmp (attr->values[i].string.text, "paused") == 0)
+                    if (strcmp (ippGetString(attr, i, NULL), "paused") == 0)
                       {
                         is_paused = TRUE;
                       }
 
                     interested_in = FALSE;
                     for (j = 0; j < G_N_ELEMENTS (reasons); j++)
-                        if (strncmp (attr->values[i].string.text, reasons[j], strlen (reasons[j])) == 0)
+                        if (strncmp (ippGetString(attr, i, NULL), reasons[j], strlen (reasons[j])) == 0)
                           {
                             interested_in = TRUE;
                             break;
@@ -1709,90 +1710,90 @@
 
                     if (interested_in)
                       {
-                        if (g_str_has_suffix (attr->values[i].string.text, "-report"))
+                        if (g_str_has_suffix (ippGetString(attr, i, NULL), "-report"))
                           {
                             if (printer_state_reason_level <= 1)
                               {
-                                reason_msg = attr->values[i].string.text;
+                                reason_msg = ippGetString(attr, i, NULL);
                                 printer_state_reason_level = 1;
                               }
                           }
-                        else if (g_str_has_suffix (attr->values[i].string.text, "-warning"))
+                        else if (g_str_has_suffix (ippGetString(attr, i, NULL), "-warning"))
                           {
                             if (printer_state_reason_level <= 2)
                               {
-                                reason_msg = attr->values[i].string.text;
+                                reason_msg = ippGetString(attr, i, NULL);
                                 printer_state_reason_level = 2;
                               }
                           }
                         else  /* It is error in the case of no suffix. */
                           {
-                            reason_msg = attr->values[i].string.text;
+                            reason_msg = ippGetString(attr, i, NULL);
                             printer_state_reason_level = 3;
                           }
                       }
                   }
               }
           }
-        else if (strcmp (attr->name, "printer-state") == 0)
-          state = attr->values[0].integer;
-        else if (strcmp (attr->name, "queued-job-count") == 0)
-          job_count = attr->values[0].integer;
-        else if (strcmp (attr->name, "printer-is-accepting-jobs") == 0)
+        else if (strcmp (ippGetName(attr), "printer-state") == 0)
+          state = ippGetInteger(attr, 0);
+        else if (strcmp (ippGetName(attr), "queued-job-count") == 0)
+          job_count = ippGetInteger(attr, 0);
+        else if (strcmp (ippGetName(attr), "printer-is-accepting-jobs") == 0)
           {
-            if (attr->values[0].boolean == 1)
+            if (ippGetBoolean(attr, 0) == 1)
               is_accepting_jobs = TRUE;
             else
               is_accepting_jobs = FALSE;
           }
-        else if (strcmp (attr->name, "job-sheets-supported") == 0)
+        else if (strcmp (ippGetName(attr), "job-sheets-supported") == 0)
           {
             if (cups_backend->covers == NULL)
               {
-                cups_backend->number_of_covers = attr->num_values;
+                cups_backend->number_of_covers = ippGetCount(attr);
                 cups_backend->covers = g_new (char *, cups_backend->number_of_covers + 1);
                 for (i = 0; i < cups_backend->number_of_covers; i++)
-                  cups_backend->covers[i] = g_strdup (attr->values[i].string.text);
+                  cups_backend->covers[i] = g_strdup (ippGetString(attr, i, NULL));
                 cups_backend->covers[cups_backend->number_of_covers] = NULL;
               }
           }
-        else if (strcmp (attr->name, "job-sheets-default") == 0)
+        else if (strcmp (ippGetName(attr), "job-sheets-default") == 0)
           {
-            if (attr->num_values == 2)
+            if (ippGetCount(attr) == 2)
               {
-                default_cover_before = attr->values[0].string.text;
-                default_cover_after = attr->values[1].string.text;
+                default_cover_before = ippGetString(attr, 0, NULL);
+                default_cover_after = ippGetString(attr, 1, NULL);
               }
           }
-        else if (strcmp (attr->name, "printer-type") == 0)
+        else if (strcmp (ippGetName(attr), "printer-type") == 0)
           {
             got_printer_type = TRUE;
-            if (attr->values[0].integer & 0x00020000)
+            if (ippGetInteger(attr, 0) & 0x00020000)
               default_printer = TRUE;
             else
               default_printer = FALSE;
 
-            if (attr->values[0].integer & 0x00000002)
+            if (ippGetInteger(attr, 0) & 0x00000002)
               remote_printer = TRUE;
             else
               remote_printer = FALSE;
           }
-        else if (strcmp (attr->name, "auth-info-required") == 0)
+        else if (strcmp (ippGetName(attr), "auth-info-required") == 0)
           {
-            if (strcmp (attr->values[0].string.text, "none") != 0)
+            if (strcmp (ippGetString(attr, 0, NULL), "none") != 0)
               {
-                auth_info_required = g_new0 (gchar *, attr->num_values + 1);
-                for (i = 0; i < attr->num_values; i++)
-                  auth_info_required[i] = g_strdup (attr->values[i].string.text);
+                auth_info_required = g_new0 (gchar *, ippGetCount(attr) + 1);
+                for (i = 0; i < ippGetCount(attr); i++)
+                  auth_info_required[i] = g_strdup (ippGetString(attr, i, NULL));
               }
           }
         else
 	  {
 	    GTK_NOTE (PRINTING,
-                      g_print ("CUPS Backend: Attribute %s ignored", attr->name));
+                      g_print ("CUPS Backend: Attribute %s ignored", ippGetName(attr)));
 	  }
 
-        attr = attr->next;
+        attr = ippNextAttribute (response);
       }
 
       if (printer_name == NULL ||
@@ -2600,7 +2601,7 @@
   response = gtk_cups_result_get_response (result);
   
   if ((attr = ippFindAttribute (response, "printer-name", IPP_TAG_NAME)) != NULL)
-    print_backend->default_printer = g_strdup (attr->values[0].string.text);
+    print_backend->default_printer = g_strdup (ippGetString(attr, 0, NULL));
 
   print_backend->got_default_printer = TRUE;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.