rpms/gtk2/F-7 gtk+-2.10.8-search.patch, 1.5, 1.6 raw-printers.patch, 1.3, 1.4

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Thu May 24 17:21:17 UTC 2007


Author: mclasen

Update of /cvs/extras/rpms/gtk2/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6121

Added Files:
	gtk+-2.10.8-search.patch raw-printers.patch 
Log Message:
re-add patches that were already cleaned up


gtk+-2.10.8-search.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.5 -r 1.6 gtk+-2.10.8-search.patch
Index: gtk+-2.10.8-search.patch
===================================================================
RCS file: gtk+-2.10.8-search.patch
diff -N gtk+-2.10.8-search.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gtk+-2.10.8-search.patch	24 May 2007 17:20:42 -0000	1.6
@@ -0,0 +1,4434 @@
+--- /dev/null	2007-05-14 19:53:51.012713345 -0400
++++ gtk+-2.10.11/gtk/gtksearchenginetracker.h	2007-05-15 01:04:07.000000000 -0400
+@@ -0,0 +1,59 @@
++/*
++ * Copyright (C) 2005 Mr Jamie McCracken
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ *
++ * Author: Jamie McCracken (jamiemcc at gnome.org)
++ *
++ * Based on nautilus-search-engine-tracker.h
++ */
++
++#ifndef __GTK_SEARCH_ENGINE_TRACKER_H__
++#define __GTK_SEARCH_ENGINE_TRACKER_H__
++
++#include "gtksearchengine.h"
++
++G_BEGIN_DECLS
++
++#define GTK_TYPE_SEARCH_ENGINE_TRACKER		(_gtk_search_engine_tracker_get_type ())
++#define GTK_SEARCH_ENGINE_TRACKER(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTracker))
++#define GTK_SEARCH_ENGINE_TRACKER_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTrackerClass))
++#define GTK_IS_SEARCH_ENGINE_TRACKER(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEARCH_ENGINE_TRACKER))
++#define GTK_IS_SEARCH_ENGINE_TRACKER_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SEARCH_ENGINE_TRACKER))
++#define GTK_SEARCH_ENGINE_TRACKER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTrackerClass))
++
++typedef struct _GtkSearchEngineTracker GtkSearchEngineTracker;
++typedef struct _GtkSearchEngineTrackerClass GtkSearchEngineTrackerClass;
++typedef struct _GtkSearchEngineTrackerPrivate GtkSearchEngineTrackerPrivate;
++
++struct _GtkSearchEngineTracker 
++{
++  GtkSearchEngine parent;
++
++  GtkSearchEngineTrackerPrivate *priv;
++};
++
++struct _GtkSearchEngineTrackerClass 
++{
++  GtkSearchEngineClass parent_class;
++};
++
++GType            _gtk_search_engine_tracker_get_type (void);
++
++GtkSearchEngine* _gtk_search_engine_tracker_new      (void);
++
++G_END_DECLS
++
++#endif /* __GTK_SEARCH_ENGINE_TRACKER_H__ */
+--- /dev/null	2007-05-14 19:53:51.012713345 -0400
++++ gtk+-2.10.11/gtk/gtksearchengine.h	2007-05-15 01:04:07.000000000 -0400
+@@ -0,0 +1,91 @@
++/*
++ * Copyright (C) 2005 Novell, Inc.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ *
++ * Author: Anders Carlsson <andersca at imendio.com> 
++ *
++ * Based on nautilus-search-engine.h
++ */
++
++#ifndef __GTK_SEARCH_ENGINE_H__
++#define __GTK_SEARCH_ENGINE_H__
++
++#include <glib-object.h>
++#include "gtkquery.h"
++
++G_BEGIN_DECLS
++
++#define GTK_TYPE_SEARCH_ENGINE		(_gtk_search_engine_get_type ())
++#define GTK_SEARCH_ENGINE(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEARCH_ENGINE, GtkSearchEngine))
++#define GTK_SEARCH_ENGINE_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SEARCH_ENGINE, GtkSearchEngineClass))
++#define GTK_IS_SEARCH_ENGINE(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEARCH_ENGINE))
++#define GTK_IS_SEARCH_ENGINE_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SEARCH_ENGINE))
++#define GTK_SEARCH_ENGINE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SEARCH_ENGINE, GtkSearchEngineClass))
++
++typedef struct _GtkSearchEngine GtkSearchEngine;
++typedef struct _GtkSearchEngineClass GtkSearchEngineClass;
++typedef struct _GtkSearchEnginePrivate GtkSearchEnginePrivate;
++
++struct _GtkSearchEngine 
++{
++  GObject parent;
++
++  GtkSearchEnginePrivate *priv;
++};
++
++struct _GtkSearchEngineClass 
++{
++  GObjectClass parent_class;
++  
++  /* VTable */
++  void     (*set_query)       (GtkSearchEngine *engine, 
++			       GtkQuery        *query);
++  void     (*start)           (GtkSearchEngine *engine);
++  void     (*stop)            (GtkSearchEngine *engine);
++  gboolean (*is_indexed)      (GtkSearchEngine *engine);
++  
++  /* Signals */
++  void     (*hits_added)      (GtkSearchEngine *engine, 
++			       GList           *hits);
++  void     (*hits_subtracted) (GtkSearchEngine *engine, 
++			       GList           *hits);
++  void     (*finished)        (GtkSearchEngine *engine);
++  void     (*error)           (GtkSearchEngine *engine, 
++			       const gchar     *error_message);
++};
++
++GType            _gtk_search_engine_get_type        (void);
++gboolean         _gtk_search_engine_enabled         (void);
++
++GtkSearchEngine* _gtk_search_engine_new             (void);
++
++void             _gtk_search_engine_set_query       (GtkSearchEngine *engine, 
++                                                     GtkQuery        *query);
++void	         _gtk_search_engine_start           (GtkSearchEngine *engine);
++void	         _gtk_search_engine_stop            (GtkSearchEngine *engine);
++gboolean         _gtk_search_engine_is_indexed      (GtkSearchEngine *engine);
++
++void	         _gtk_search_engine_hits_added      (GtkSearchEngine *engine, 
++						     GList           *hits);
++void	         _gtk_search_engine_hits_subtracted (GtkSearchEngine *engine, 
++						     GList           *hits);
++void	         _gtk_search_engine_finished        (GtkSearchEngine *engine);
++void	         _gtk_search_engine_error           (GtkSearchEngine *engine, 
++						     const gchar     *error_message);
++
++G_END_DECLS
++
++#endif /* __GTK_SEARCH_ENGINE_H__ */
+--- /dev/null	2007-05-14 19:53:51.012713345 -0400
++++ gtk+-2.10.11/gtk/gtksearchenginebeagle.h	2007-05-15 01:04:07.000000000 -0400
+@@ -0,0 +1,59 @@
++/*
++ * Copyright (C) 2005 Novell, Inc.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ *
++ * Author: Anders Carlsson <andersca at imendio.com>
++ *
++ * Based on nautilus-search-engine-beagle.h
++ */
++
++#ifndef __GTK_SEARCH_ENGINE_BEAGLE_H__
++#define __GTK_SEARCH_ENGINE_BEAGLE_H__
++
++#include "gtksearchengine.h"
++
++G_BEGIN_DECLS
++
++#define GTK_TYPE_SEARCH_ENGINE_BEAGLE		(_gtk_search_engine_beagle_get_type ())
++#define GTK_SEARCH_ENGINE_BEAGLE(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEARCH_ENGINE_BEAGLE, GtkSearchEngineBeagle))
++#define GTK_SEARCH_ENGINE_BEAGLE_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SEARCH_ENGINE_BEAGLE, GtkSearchEngineBeagleClass))
++#define GTK_IS_SEARCH_ENGINE_BEAGLE(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEARCH_ENGINE_BEAGLE))
++#define GTK_IS_SEARCH_ENGINE_BEAGLE_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SEARCH_ENGINE_BEAGLE))
[...4041 lines suppressed...]
++ * Based on nautilus-query.c
++ */
++
++#include <config.h>
++#include <string.h>
++
++#include "gtkquery.h"
++
++struct _GtkQueryPrivate 
++{
++  gchar *text;
++  gchar *location_uri;
++  GList *mime_types;
++};
++
++G_DEFINE_TYPE (GtkQuery, _gtk_query, G_TYPE_OBJECT);
++
++static void
++finalize (GObject *object)
++{
++  GtkQuery *query;
++  
++  query = GTK_QUERY (object);
++  
++  g_free (query->priv->text);
++
++  G_OBJECT_CLASS (_gtk_query_parent_class)->finalize (object);
++}
++
++static void
++_gtk_query_class_init (GtkQueryClass *class)
++{
++  GObjectClass *gobject_class;
++  
++  gobject_class = G_OBJECT_CLASS (class);
++  gobject_class->finalize = finalize;
++
++  g_type_class_add_private (gobject_class, sizeof (GtkQueryPrivate));  
++}
++
++static void
++_gtk_query_init (GtkQuery *query)
++{
++  query->priv = G_TYPE_INSTANCE_GET_PRIVATE (query, GTK_TYPE_QUERY, GtkQueryPrivate);
++}
++
++GtkQuery *
++_gtk_query_new (void)
++{
++  return g_object_new (GTK_TYPE_QUERY,  NULL);
++}
++
++
++gchar *
++_gtk_query_get_text (GtkQuery *query)
++{
++  return g_strdup (query->priv->text);
++}
++
++void 
++_gtk_query_set_text (GtkQuery    *query, 
++		    const gchar *text)
++{
++  g_free (query->priv->text);
++  query->priv->text = g_strdup (text);
++}
++
++gchar *
++_gtk_query_get_location (GtkQuery *query)
++{
++  return g_strdup (query->priv->location_uri);
++}
++	
++void
++_gtk_query_set_location (GtkQuery    *query, 
++			const gchar *uri)
++{
++  g_free (query->priv->location_uri);
++  query->priv->location_uri = g_strdup (uri);
++}
++
++GList *
++_gtk_query_get_mime_types (GtkQuery *query)
++{
++  GList *list, *l;
++  gchar *mime_type;
++
++  list = NULL;
++  for (l = query->priv->mime_types; l; l = l->next)
++    {
++      mime_type = (gchar*)l->data;
++      list = g_list_prepend (list, g_strdup (mime_type));
++    }
++
++  return list;
++}
++
++void
++_gtk_query_set_mime_types (GtkQuery *query, 
++			   GList    *mime_types)
++{
++  GList *l;
++  gchar *mime_type;
++
++  g_list_foreach (query->priv->mime_types, (GFunc)g_free, NULL);
++  g_list_free (query->priv->mime_types);
++  query->priv->mime_types = NULL;
++
++  for (l = mime_types; l; l = l->next)
++    {
++      mime_type = (gchar*)l->data;
++      query->priv->mime_types = g_list_prepend (query->priv->mime_types, g_strdup (mime_type));
++    }
++}
++
++void
++_gtk_query_add_mime_type (GtkQuery    *query, 
++			  const gchar *mime_type)
++{
++  query->priv->mime_types = g_list_prepend (query->priv->mime_types,
++					    g_strdup (mime_type));
++}
++
+--- /dev/null	2007-05-14 19:53:51.012713345 -0400
++++ gtk+-2.10.11/gtk/gtkquery.h	2007-05-15 01:04:07.000000000 -0400
+@@ -0,0 +1,74 @@
++/*
++ * Copyright (C) 2005 Novell, Inc.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ *
++ * Author: Anders Carlsson <andersca at imendio.com>
++ *
++ * Based on nautilus-query.h
++ */
++
++#ifndef __GTK_QUERY_H__
++#define __GTK_QUERY_H__
++
++#include <glib-object.h>
++
++G_BEGIN_DECLS
++
++#define GTK_TYPE_QUERY		(_gtk_query_get_type ())
++#define GTK_QUERY(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_QUERY, GtkQuery))
++#define GTK_QUERY_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_QUERY, GtkQueryClass))
++#define GTK_IS_QUERY(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_QUERY))
++#define GTK_IS_QUERY_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_QUERY))
++#define GTK_QUERY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_QUERY, GtkQueryClass))
++
++typedef struct _GtkQuery GtkQuery;
++typedef struct _GtkQueryClass GtkQueryClass;
++typedef struct _GtkQueryPrivate GtkQueryPrivate;
++
++struct _GtkQuery 
++{
++  GObject parent;
++
++  GtkQueryPrivate *priv;
++};
++
++struct _GtkQueryClass
++{
++  GObjectClass parent_class;
++};
++
++GType     _gtk_query_get_type       (void);
++gboolean  _gtk_query_enabled        (void);
++
++GtkQuery* _gtk_query_new            (void);
++
++gchar*    _gtk_query_get_text       (GtkQuery    *query);
++void      _gtk_query_set_text       (GtkQuery    *query, 
++				     const gchar *text);
++
++gchar*    _gtk_query_get_location   (GtkQuery    *query);
++void      _gtk_query_set_location   (GtkQuery    *query, 
++				     const gchar *uri);
++
++GList*    _gtk_query_get_mime_types (GtkQuery    *query);
++void      _gtk_query_set_mime_types (GtkQuery    *query, 
++				     GList       *mime_types);
++void      _gtk_query_add_mime_type  (GtkQuery    *query, 
++				     const gchar *mime_type);
++
++G_END_DECLS
++
++#endif /* __GTK_QUERY_H__ */

raw-printers.patch:

Index: raw-printers.patch
===================================================================
RCS file: raw-printers.patch
diff -N raw-printers.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ raw-printers.patch	24 May 2007 17:20:42 -0000	1.4
@@ -0,0 +1,353 @@
+--- gtk+-2.10.8/modules/printbackends/cups/gtkcupsutils.h.raw-printers	2007-01-16 22:15:15.000000000 -0500
++++ gtk+-2.10.8/modules/printbackends/cups/gtkcupsutils.h	2007-03-28 12:22:59.000000000 -0400
+@@ -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
+--- gtk+-2.10.8/modules/printbackends/cups/gtkprintbackendcups.c.raw-printers	2007-01-16 22:15:15.000000000 -0500
++++ gtk+-2.10.8/modules/printbackends/cups/gtkprintbackendcups.c	2007-03-28 12:22:59.000000000 -0400
+@@ -572,10 +572,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;
+ }
+ 
+@@ -1223,7 +1230,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;
+     }
+ 
+--- gtk+-2.10.8/modules/printbackends/cups/gtkcupsutils.c.raw-printers	2007-01-16 22:15:15.000000000 -0500
++++ gtk+-2.10.8/modules/printbackends/cups/gtkcupsutils.c	2007-03-28 12:23:37.000000000 -0400
+@@ -51,6 +51,11 @@
+ {
+   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;
+@@ -73,15 +78,20 @@
+                                         _get_read_data};
+ 
+ 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);
+@@ -206,7 +216,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;
+     }
+@@ -622,7 +638,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++;
+@@ -649,10 +670,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, "%s",ippErrorString (cupsLastError ()));
++      gtk_cups_result_set_error (request->result, 
++                                 GTK_CUPS_ERROR_IPP,
++                                 ipp_status,
++                                 cups_error,
++                                 "%s", 
++                                 ippErrorString (cups_error));
+       return;
+     }
+ 
+@@ -708,7 +735,12 @@
+           request->state = GTK_CUPS_POST_DONE;
+ 	  request->poll_state = GTK_CUPS_HTTP_IDLE;
+      
+-          gtk_cups_result_set_error (request->result, "Error reading from cache file: %s", error->message);
++          gtk_cups_result_set_error (request->result,
++                                     GTK_CUPS_ERROR_IO,
++                                     io_status,
++                                     error->code, 
++                                     "Error reading from cache file: %s",
++                                     error->message);
+ 
+ 	  g_error_free (error);
+           return;
+@@ -729,10 +761,19 @@
+       if (httpWrite(request->http, buffer, (int) bytes) < bytes)
+ #endif /* HAVE_CUPS_API_1_2 */
+         {
++          int http_errno;
++
++          http_errno = httpError (request->http);
++
+           request->state = GTK_CUPS_POST_DONE;
+ 	  request->poll_state = GTK_CUPS_HTTP_IDLE;
+      
+-          gtk_cups_result_set_error (request->result, "Error writting to socket in Post %s", strerror (httpError (request->http)));
++          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;
+         }
+     }
+@@ -765,7 +806,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)
+@@ -785,7 +831,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;
+         }
+     }
+@@ -817,7 +868,12 @@
+       else
+         {
+           request->state = GTK_CUPS_POST_DONE;
+-          gtk_cups_result_set_error (request->result, "HTTP Error in POST %s", strerror (http_errno));
++          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;
+  
+           httpFlush(request->http); 
+@@ -866,7 +922,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;
+@@ -891,7 +953,12 @@
+ 
+   if (request->data_io == NULL)
+     {
+-      gtk_cups_result_set_error (request->result, "Get requires an open io channel");
++      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;
+ 
+@@ -909,8 +976,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++;
+@@ -947,8 +1019,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 */
+@@ -967,7 +1044,7 @@
+       request->attempts++;
+       goto again;
+     }
+-#endif 
++#endif
+   else if (http_status != HTTP_OK)
+     {
+       int http_errno;
+@@ -979,7 +1056,12 @@
+       else
+         {
+           request->state = GTK_CUPS_GET_DONE;
+-          gtk_cups_result_set_error (request->result, "HTTP Error in GET %s", strerror (http_errno));
++          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;
+           httpFlush(request->http);
+ 
+@@ -1055,7 +1137,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);
+     }
+ }
+@@ -1078,6 +1164,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)
+ {




More information about the fedora-extras-commits mailing list