--- a/patches/gtk+-19-printing-papi-backend.diff Fri Feb 16 18:34:53 2007 +0000
+++ b/patches/gtk+-19-printing-papi-backend.diff Fri Feb 23 16:03:30 2007 +0000
@@ -1,4 +1,4 @@
-diff -urN gtk+-2.10.6/acconfig.h ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/acconfig.h
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/acconfig.h ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/acconfig.h
--- gtk+-2.10.6/acconfig.h 2006-10-17 17:41:23.942649000 +0000
+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/acconfig.h 2006-10-17 17:36:45.652039000 +0000
@@ -70,6 +70,7 @@
@@ -9,9 +9,9 @@
/* #undef PACKAGE */
/* #undef VERSION */
-diff -urN gtk+-2.10.6/configure.in ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/configure.in
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/configure.in ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/configure.in
--- gtk+-2.10.6/configure.in 2006-10-17 17:41:23.956254000 +0000
-+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/configure.in 2006-10-17 17:36:45.654264000 +0000
++++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/configure.in 2007-02-23 15:18:37.747809000 +0000
@@ -1578,6 +1578,18 @@
fi
AM_CONDITIONAL(HAVE_CUPS, test "x$CUPS_CONFIG" != "xno")
@@ -19,7 +19,7 @@
+# Checks to see if we should compile with PAPI backend for GTK+
+#
+AC_MSG_CHECKING(libpapi)
-+# Check for a mediaLib 2.2 function since that is what the GTK+ mediaLib
++# Check for a libpapi function since that is what the GTK+ papi backend
+# patch requires.
+AC_CHECK_LIB(papi, papiServiceCreate, have_papi=yes, have_papi=no)
+if test $have_papi = yes; then
@@ -39,7 +39,7 @@
perf/Makefile
contrib/Makefile
contrib/gdk-pixbuf-xlib/Makefile
-diff -urN gtk+-2.10.6/gtk/Makefile.am ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/gtk/Makefile.am
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/gtk/Makefile.am ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/gtk/Makefile.am
--- gtk+-2.10.6/gtk/Makefile.am 2006-10-02 17:27:53.000000000 +0000
+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/gtk/Makefile.am 2006-10-17 17:36:45.655507000 +0000
@@ -12,8 +12,12 @@
@@ -55,14 +55,10 @@
INCLUDES = \
-DG_LOG_DOMAIN=\"Gtk\" \
-diff -urN gtk+-2.10.6/modules/printbackends/Makefile.am ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/Makefile.am
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/Makefile.am ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/Makefile.am
--- gtk+-2.10.6/modules/printbackends/Makefile.am 2006-06-21 18:16:56.000000000 +0000
-+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/Makefile.am 2006-10-17 17:36:45.656005000 +0000
-@@ -1,7 +1,12 @@
--SUBDIRS = file lpr
-+SUBDIRS = file lpr
-
- if HAVE_CUPS
++++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/Makefile.am 2007-02-23 15:20:18.151888000 +0000
+@@ -4,4 +4,9 @@
SUBDIRS += cups
endif
@@ -73,18 +69,7 @@
+
+
+DIST_SUBDIRS=cups file lpr papi
-diff -urN gtk+-2.10.6/modules/printbackends/Makefile.in ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/Makefile.in
---- gtk+-2.10.6/modules/printbackends/Makefile.in 2006-10-03 17:05:54.000000000 +0000
-+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/Makefile.in 2006-10-17 17:36:45.656814000 +0000
-@@ -37,6 +37,7 @@
- POST_UNINSTALL = :
- host_triplet = @host@
- @HAVE_CUPS_TRUE@am__append_1 = cups
-+@HAVE_PAPI_TRUE@am__append_1 = papi
- ACLOCAL = @ACLOCAL@
- AMDEP_FALSE = @AMDEP_FALSE@
- AMDEP_TRUE = @AMDEP_TRUE@
-diff -urN gtk+-2.10.6/modules/printbackends/lpr/gtkprintbackendlpr.c ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/lpr/gtkprintbackendlpr.c
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/lpr/gtkprintbackendlpr.c ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/lpr/gtkprintbackendlpr.c
--- gtk+-2.10.6/modules/printbackends/lpr/gtkprintbackendlpr.c 2006-06-21 18:16:58.000000000 +0000
+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/lpr/gtkprintbackendlpr.c 2006-10-17 17:36:45.657724000 +0000
@@ -400,7 +400,6 @@
@@ -95,7 +80,7 @@
gtk_print_backend_add_printer (GTK_PRINT_BACKEND (backend), printer);
g_object_unref (printer);
-diff -urN gtk+-2.10.6/modules/printbackends/papi/Makefile.am ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/Makefile.am
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/papi/Makefile.am ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/Makefile.am
--- gtk+-2.10.6/modules/printbackends/papi/Makefile.am 1970-01-01 00:00:00.000000000 +0000
+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/Makefile.am 2006-10-17 17:36:45.658522000 +0000
@@ -0,0 +1,32 @@
@@ -131,10 +116,10 @@
+
+libprintbackend_papi_la_LDFLAGS = -avoid-version -module $(no_undefined)
+libprintbackend_papi_la_LIBADD = $(LDADDS) -lpapi
-diff -urN gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c
--- gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c 1970-01-01 00:00:00.000000000 +0000
-+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c 2006-11-16 16:12:11.026828000 +0000
-@@ -0,0 +1,805 @@
++++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.c 2007-02-23 15:11:05.366324000 +0000
+@@ -0,0 +1,859 @@
+/* GTK - The GIMP Toolkit
+ * gtkprintbackendpapi.c: Default implementation of GtkPrintBackend
+ * for printing to papi
@@ -612,6 +597,63 @@
+ backend_parent_class->dispose (object);
+}
+
++char **
++get_all_list(papi_service_t svc)
++{
++ papi_status_t status;
++ papi_printer_t printer = NULL;
++ char *attr[] = { "member-names", NULL };
++ char **names = NULL;
++
++ status = papiPrinterQuery(svc, "_all", attr, NULL, &printer);
++ if ((status == PAPI_OK) && (printer != NULL)) {
++ papi_attribute_t **attributes =
++ papiPrinterGetAttributeList(printer);
++ if (attributes != NULL) {
++ void *iter = NULL;
++ char *member = NULL;
++
++ for (status = papiAttributeListGetString(attributes,
++ &iter, "member-names", &member);
++ status == PAPI_OK;
++ status = papiAttributeListGetString(attributes,
++ &iter, NULL, &member))
++ list_append(&names, strdup(member));
++ }
++ papiPrinterFree(printer);
++ }
++
++ return (names);
++}
++
++static char **
++get_printers_list(papi_service_t svc)
++{
++ papi_status_t status;
++ papi_printer_t *printers = NULL;
++ char *keys[] = { "printer-name", "printer-uri-supported", NULL };
++ char **names = NULL;
++
++ status = papiPrintersList(svc, keys, NULL, &printers);
++ if ((status == PAPI_OK) && (printers != NULL)) {
++ int i;
++
++ for (i = 0; printers[i] != NULL; i++) {
++ papi_attribute_t **attributes =
++ papiPrinterGetAttributeList(printers[i]);
++ char *name = NULL;
++
++ (void) papiAttributeListGetString(attributes, NULL,
++ "printer-name", &name);
++ if ((name != NULL) && (strcmp(name, "_default") != 0))
++ list_append(&names, strdup(name));
++ }
++ papiPrinterListFree(printers);
++ }
++
++ return (names);
++}
++
+static void
+papi_request_printer_list (GtkPrintBackend *backend)
+{
@@ -635,7 +677,7 @@
+ };
+ papi_status_t status, status2;
+ papi_service_t service = NULL;
-+ papi_printer_t *printers = NULL;
++ char **printers = NULL;
+ GtkPrinter *printer;
+ GtkPrinterPapi *papi_printer;
+ GList *current_printer_list;
@@ -645,10 +687,9 @@
+ PAPI_ENCRYPT_NEVER, NULL)) != PAPI_OK)
+ return FALSE;
+
-+ if (papiPrintersList (service, attributes, NULL, &printers) != PAPI_OK)
++ if ((printers = get_all_list (service)) == NULL)
+ {
-+ papiServiceDestroy (service);
-+ return FALSE;
++ printers = get_printers_list (service);
+ }
+
+ if (printers == NULL)
@@ -663,31 +704,30 @@
+ char *name = NULL, *url = NULL;
+ papi_attribute_t **attrs = NULL;
+
-+ attrs = papiPrinterGetAttributeList (printers[i]);
-+ status = papiAttributeListGetString (attrs, NULL, "printer-name", &name);
-+ status2 = papiAttributeListGetString (attrs, NULL, "printer-uri", &url);
-+
-+ if (status == PAPI_OK && status2 == PAPI_OK)
-+ {
-+ printer = gtk_print_backend_find_printer (backend, name);
++ printer = gtk_print_backend_find_printer (backend, printers[i]);
+
+ if (!printer)
+ {
++ /* skip null printer name just in case */
++ if (printers[i] == NULL)
++ continue;
++
+ /* skip the alias _default and _all printers */
-+ if (strcmp(name, "_default")==0 || strcmp(name, "_all")==0)
++ if (strcmp(printers[i], "_default")==0 || strcmp(printers[i], "_all")==0)
+ continue;
+
-+ papi_printer = gtk_printer_papi_new (name, backend);
++ papi_printer = gtk_printer_papi_new (printers[i], backend);
+ printer = GTK_PRINTER (papi_printer);
+
+ /* Only marked default printer to not have details so that
+ the request_details method will be called at start up
+ */
+
-+ if (strcmp (name, papi_backend->default_printer)==0)
-+ {
-+ gtk_printer_set_is_default (printer, TRUE);
-+ }
++ if (papi_backend->default_printer != NULL)
++ if (strcmp (printers[i], papi_backend->default_printer)==0)
++ {
++ gtk_printer_set_is_default (printer, TRUE);
++ }
+
+ gtk_printer_set_icon_name (printer, "gtk-print");
+ gtk_print_backend_add_printer (backend, printer);
@@ -697,7 +737,6 @@
+ }
+ else
+ g_object_ref (printer);
-+ }
+
+ if (!gtk_printer_is_active (printer))
+ {
@@ -714,7 +753,7 @@
+ g_object_unref (printer);
+ }
+
-+ papiPrinterListFree (printers);
++ free (printers);
+ papiServiceDestroy (service);
+
+ /* To set that the list of printers added is complete */
@@ -940,9 +979,9 @@
+ return GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_PAGE_SET ;
+}
+
-diff -urN gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h
--- gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h 1970-01-01 00:00:00.000000000 +0000
-+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h 2006-10-17 17:36:45.661991000 +0000
++++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprintbackendpapi.h 2007-02-23 15:24:13.203688000 +0000
@@ -0,0 +1,44 @@
+/* GTK - The GIMP Toolkit
+ * gtkprintbackendpapi.h: Default implementation of GtkPrintBackend
@@ -988,11 +1027,11 @@
+#endif /* __GTK_PRINT_BACKEND_PAPI_H__ */
+
+
-diff -urN gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c
--- gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c 1970-01-01 00:00:00.000000000 +0000
-+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c 2006-11-16 16:15:00.738262000 +0000
++++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.c 2007-02-23 15:13:52.414150000 +0000
@@ -0,0 +1,131 @@
-+/* GtkPrinterPapiPapi
++/* GtkPrinterPapi
+ * Copyright (C) 2006 John (J5) Palmieri <[email protected]>
+ * Copyright (C) 2006 Ghee Teo <[email protected]>
+ *
@@ -1123,7 +1162,7 @@
+ return (GtkPrinterPapi *) pp;
+}
+
-diff -urN gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.h ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.h
+diff -urN -x'*~' -x'*Makefile.in' gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.h ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.h
--- gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.h 1970-01-01 00:00:00.000000000 +0000
+++ ../SUNWgnome-base-libs-2.16.1.hacked/gtk+-2.10.6/modules/printbackends/papi/gtkprinterpapi.h 2006-11-16 16:14:49.940813000 +0000
@@ -0,0 +1,74 @@