support raw printers
This commit is contained in:
parent
5549dde4a8
commit
ece2242ee4
@ -31,12 +31,12 @@ Patch1: gtk+-2.8.10-set-invisible-char-to-bullet.patch
|
||||
Patch2: gtk+-2.10.8-search.patch
|
||||
# use fam for recent-files
|
||||
Patch3: gtk+-2.10.3-fam.patch
|
||||
|
||||
# backport from HEAD
|
||||
Patch7: gtk+-2.10.7-cursor-blink.patch
|
||||
|
||||
# fixed in upstream cvs
|
||||
Patch10: gtk+-2.10.4-im-reset.patch
|
||||
# fixed in upstream cvs
|
||||
Patch11: raw-printers.patch
|
||||
|
||||
BuildRequires: atk-devel >= %{atk_version}
|
||||
BuildRequires: pango-devel >= %{pango_version}
|
||||
@ -120,9 +120,9 @@ docs for the GTK+ widget toolkit.
|
||||
%patch1 -p1 -b .set-invisible-char-to-bullet
|
||||
%patch2 -p1 -b .search
|
||||
%patch3 -p1 -b .fam
|
||||
|
||||
%patch7 -p1 -b .cursor-blink
|
||||
%patch10 -p1 -b .im-reset
|
||||
%patch11 -p1 -b .raw-printers
|
||||
|
||||
for i in config.guess config.sub ; do
|
||||
test -f %{_datadir}/libtool/$i && cp %{_datadir}/libtool/$i .
|
||||
@ -289,6 +289,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%doc tmpdocs/examples
|
||||
|
||||
%changelog
|
||||
* Wed Mar 28 2007 Matthias Clasen <mclasen@redhat.com> - 1.10.11-2
|
||||
- Support raw printers
|
||||
|
||||
* Tue Mar 20 2007 Florian La Roche <laroche@redhat.com> - 2.10.11-2
|
||||
- fix Conflicts: libgnomeui line
|
||||
|
||||
|
346
raw-printers.patch
Normal file
346
raw-printers.patch
Normal file
@ -0,0 +1,346 @@
|
||||
Index: modules/printbackends/cups/gtkcupsutils.c
|
||||
===================================================================
|
||||
--- modules/printbackends/cups/gtkcupsutils.c (revision 17322)
|
||||
+++ modules/printbackends/cups/gtkcupsutils.c (working copy)
|
||||
@@ -51,7 +51,12 @@
|
||||
{
|
||||
gchar *error_msg;
|
||||
ipp_t *ipp_response;
|
||||
+ GtkCupsErrorType error_type;
|
||||
|
||||
+ /* some error types like HTTP_ERROR have a status and a code */
|
||||
+ int error_status;
|
||||
+ int error_code;
|
||||
+
|
||||
guint is_error : 1;
|
||||
guint is_ipp_response : 1;
|
||||
};
|
||||
@@ -77,15 +82,20 @@
|
||||
};
|
||||
|
||||
static void
|
||||
-gtk_cups_result_set_error (GtkCupsResult *result,
|
||||
- const char *error_msg,
|
||||
+gtk_cups_result_set_error (GtkCupsResult *result,
|
||||
+ GtkCupsErrorType error_type,
|
||||
+ int error_status,
|
||||
+ int error_code,
|
||||
+ const char *error_msg,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
result->is_ipp_response = FALSE;
|
||||
-
|
||||
result->is_error = TRUE;
|
||||
+ result->error_type = error_type;
|
||||
+ result->error_status = error_status;
|
||||
+ result->error_code = error_code;
|
||||
|
||||
va_start (args, error_msg);
|
||||
result->error_msg = g_strdup_vprintf (error_msg, args);
|
||||
@@ -214,7 +224,13 @@
|
||||
if (request->attempts > _GTK_CUPS_MAX_ATTEMPTS &&
|
||||
request->state != GTK_CUPS_REQUEST_DONE)
|
||||
{
|
||||
- gtk_cups_result_set_error (request->result, "Too many failed attempts");
|
||||
+ /* TODO: should add a status or error code for too many failed attempts */
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_GENERAL,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ "Too many failed attempts");
|
||||
+
|
||||
request->state = GTK_CUPS_REQUEST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
}
|
||||
@@ -629,7 +645,12 @@
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
- gtk_cups_result_set_error (request->result, "Failed Post");
|
||||
+ /* TODO: should add a status or error code for failed post */
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_GENERAL,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ "Failed Post");
|
||||
}
|
||||
|
||||
request->attempts++;
|
||||
@@ -656,12 +677,16 @@
|
||||
|
||||
if (ipp_status == IPP_ERROR)
|
||||
{
|
||||
+ int cups_error = cupsLastError ();
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_IPP,
|
||||
+ ipp_status,
|
||||
+ cups_error,
|
||||
"%s",
|
||||
- ippErrorString (cupsLastError ()));
|
||||
+ ippErrorString (cups_error));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -717,7 +742,10 @@
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
- gtk_cups_result_set_error (request->result,
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_IO,
|
||||
+ io_status,
|
||||
+ error->code,
|
||||
"Error reading from cache file: %s",
|
||||
error->message);
|
||||
|
||||
@@ -747,7 +775,10 @@
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
- gtk_cups_result_set_error (request->result,
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_HTTP,
|
||||
+ http_status,
|
||||
+ http_errno,
|
||||
"Error writing to socket in Post %s",
|
||||
g_strerror (http_errno));
|
||||
return;
|
||||
@@ -782,7 +813,12 @@
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
- gtk_cups_result_set_error (request->result, "Can't prompt for authorization");
|
||||
+ /* TODO: create a not implemented error code */
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_GENERAL,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ "Can't prompt for authorization");
|
||||
return;
|
||||
}
|
||||
else if (http_status == HTTP_ERROR)
|
||||
@@ -802,7 +838,12 @@
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
- gtk_cups_result_set_error (request->result, "Unknown HTTP error");
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_HTTP,
|
||||
+ http_status,
|
||||
+ error,
|
||||
+ "Unknown HTTP error");
|
||||
+
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -834,7 +875,10 @@
|
||||
else
|
||||
{
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
- gtk_cups_result_set_error (request->result,
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_HTTP,
|
||||
+ http_status,
|
||||
+ http_errno,
|
||||
"HTTP Error in POST %s",
|
||||
g_strerror (http_errno));
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
@@ -885,8 +929,13 @@
|
||||
|
||||
if (ipp_status == IPP_ERROR)
|
||||
{
|
||||
- gtk_cups_result_set_error (request->result, "%s",
|
||||
- ippErrorString (cupsLastError ()));
|
||||
+ int ipp_error = cupsLastError ();
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_IPP,
|
||||
+ ipp_status,
|
||||
+ ipp_error,
|
||||
+ "%s",
|
||||
+ ippErrorString (ipp_error));
|
||||
|
||||
ippDelete (request->result->ipp_response);
|
||||
request->result->ipp_response = NULL;
|
||||
@@ -911,8 +960,12 @@
|
||||
|
||||
if (request->data_io == NULL)
|
||||
{
|
||||
- gtk_cups_result_set_error (request->result,
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_IO,
|
||||
+ G_IO_STATUS_ERROR,
|
||||
+ G_IO_CHANNEL_ERROR_FAILED,
|
||||
"Get requires an open io channel");
|
||||
+
|
||||
request->state = GTK_CUPS_GET_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
@@ -930,8 +983,13 @@
|
||||
{
|
||||
request->state = GTK_CUPS_GET_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
-
|
||||
- gtk_cups_result_set_error (request->result, "Failed Get");
|
||||
+
|
||||
+ /* TODO: should add a status or error code for failed GET */
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_GENERAL,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ "Failed Get");
|
||||
}
|
||||
|
||||
request->attempts++;
|
||||
@@ -968,8 +1026,13 @@
|
||||
g_warning ("NOT IMPLEMENTED: We need to prompt for authorization in a non blocking manner");
|
||||
request->state = GTK_CUPS_GET_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
-
|
||||
- gtk_cups_result_set_error (request->result, "Can't prompt for authorization");
|
||||
+
|
||||
+ /* TODO: should add a status or error code for not implemented */
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_GENERAL,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ "Can't prompt for authorization");
|
||||
return;
|
||||
}
|
||||
/* TODO: detect ssl in configure.ac */
|
||||
@@ -988,7 +1051,7 @@
|
||||
request->attempts++;
|
||||
goto again;
|
||||
}
|
||||
-#endif
|
||||
+#endif
|
||||
else if (http_status != HTTP_OK)
|
||||
{
|
||||
int http_errno;
|
||||
@@ -1000,7 +1063,10 @@
|
||||
else
|
||||
{
|
||||
request->state = GTK_CUPS_GET_DONE;
|
||||
- gtk_cups_result_set_error (request->result,
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_HTTP,
|
||||
+ http_status,
|
||||
+ http_errno,
|
||||
"HTTP Error in GET %s",
|
||||
g_strerror (http_errno));
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
@@ -1078,7 +1144,11 @@
|
||||
request->state = GTK_CUPS_POST_DONE;
|
||||
request->poll_state = GTK_CUPS_HTTP_IDLE;
|
||||
|
||||
- gtk_cups_result_set_error (request->result, error->message);
|
||||
+ gtk_cups_result_set_error (request->result,
|
||||
+ GTK_CUPS_ERROR_IO,
|
||||
+ io_status,
|
||||
+ error->code,
|
||||
+ error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
@@ -1101,6 +1171,24 @@
|
||||
return result->ipp_response;
|
||||
}
|
||||
|
||||
+GtkCupsErrorType
|
||||
+gtk_cups_result_get_error_type (GtkCupsResult *result)
|
||||
+{
|
||||
+ return result->error_type;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+gtk_cups_result_get_error_status (GtkCupsResult *result)
|
||||
+{
|
||||
+ return result->error_status;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+gtk_cups_result_get_error_code (GtkCupsResult *result)
|
||||
+{
|
||||
+ return result->error_code;
|
||||
+}
|
||||
+
|
||||
const char *
|
||||
gtk_cups_result_get_error_string (GtkCupsResult *result)
|
||||
{
|
||||
Index: modules/printbackends/cups/gtkprintbackendcups.c
|
||||
===================================================================
|
||||
--- modules/printbackends/cups/gtkprintbackendcups.c (revision 17322)
|
||||
+++ modules/printbackends/cups/gtkprintbackendcups.c (working copy)
|
||||
@@ -579,10 +579,17 @@
|
||||
g_print ("CUPS Backend: %s <source %p>\n", G_STRFUNC, source));
|
||||
|
||||
if (gtk_cups_result_is_error (result))
|
||||
- g_warning ("Error result: %s", gtk_cups_result_get_error_string (result));
|
||||
+ {
|
||||
+ GTK_NOTE (PRINTING,
|
||||
+ g_print("Error result: %s (type %i, status %i, code %i)\n",
|
||||
+ gtk_cups_result_get_error_string (result),
|
||||
+ gtk_cups_result_get_error_type (result),
|
||||
+ gtk_cups_result_get_error_status (result),
|
||||
+ gtk_cups_result_get_error_code (result)));
|
||||
+ }
|
||||
|
||||
ep_callback (GTK_PRINT_BACKEND (dispatch->backend), result, user_data);
|
||||
-
|
||||
+
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1237,7 +1244,18 @@
|
||||
|
||||
if (gtk_cups_result_is_error (result))
|
||||
{
|
||||
- g_signal_emit_by_name (printer, "details-acquired", FALSE);
|
||||
+ gboolean success = FALSE;
|
||||
+
|
||||
+ /* if we get a 404 then it is just a raw printer without a ppd
|
||||
+ and not an error */
|
||||
+ if ((gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_HTTP) &&
|
||||
+ (gtk_cups_result_get_error_status (result) == HTTP_NOT_FOUND))
|
||||
+ {
|
||||
+ gtk_printer_set_has_details (printer, TRUE);
|
||||
+ success = TRUE;
|
||||
+ }
|
||||
+
|
||||
+ g_signal_emit_by_name (printer, "details-acquired", success);
|
||||
return;
|
||||
}
|
||||
|
||||
Index: modules/printbackends/cups/gtkcupsutils.h
|
||||
===================================================================
|
||||
--- modules/printbackends/cups/gtkcupsutils.h (revision 17322)
|
||||
+++ modules/printbackends/cups/gtkcupsutils.h (working copy)
|
||||
@@ -33,6 +33,14 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
+ GTK_CUPS_ERROR_HTTP,
|
||||
+ GTK_CUPS_ERROR_IPP,
|
||||
+ GTK_CUPS_ERROR_IO,
|
||||
+ GTK_CUPS_ERROR_GENERAL
|
||||
+} GtkCupsErrorType;
|
||||
+
|
||||
+typedef enum
|
||||
+{
|
||||
GTK_CUPS_POST,
|
||||
GTK_CUPS_GET
|
||||
} GtkCupsRequestType;
|
||||
@@ -126,6 +134,9 @@
|
||||
const gchar *value);
|
||||
gboolean gtk_cups_result_is_error (GtkCupsResult *result);
|
||||
ipp_t * gtk_cups_result_get_response (GtkCupsResult *result);
|
||||
+GtkCupsErrorType gtk_cups_result_get_error_type (GtkCupsResult *result);
|
||||
+int gtk_cups_result_get_error_status (GtkCupsResult *result);
|
||||
+int gtk_cups_result_get_error_code (GtkCupsResult *result);
|
||||
const char * gtk_cups_result_get_error_string (GtkCupsResult *result);
|
||||
|
||||
G_END_DECLS
|
Loading…
Reference in New Issue
Block a user