Index: modules/printbackends/cups/gtkprintbackendcups.c
===================================================================
--- modules/printbackends/cups/gtkprintbackendcups.c	(revision 17711)
+++ modules/printbackends/cups/gtkprintbackendcups.c	(working copy)
@@ -660,128 +660,6 @@
   g_source_unref ((GSource *) dispatch);
 }
 
-static void
-cups_request_printer_info_cb (GtkPrintBackendCups *backend,
-                              GtkCupsResult       *result,
-                              gpointer             user_data)
-{
-  ipp_attribute_t *attr;
-  ipp_t *response;
-  gchar *printer_name;
-  GtkPrinterCups *cups_printer;
-  GtkPrinter *printer;
-  gchar *loc;
-  gchar *desc;
-  gchar *state_msg;
-  int job_count;
-  gboolean status_changed;  
-
-  g_assert (GTK_IS_PRINT_BACKEND_CUPS (backend));
-
-  printer_name = (gchar *)user_data;
-  printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (backend),
-					    printer_name);
-
-  GTK_NOTE (PRINTING,
-            g_print ("CUPS Backend: %s - Got printer info for printer '%s'\n", G_STRFUNC, printer_name));
-
-  if (!printer)
-    {
-      GTK_NOTE (PRINTING,
-            g_print ("CUPS Backend: Could not find printer called '%s'\n", printer_name));
-      return;
-    }
-
-  cups_printer = GTK_PRINTER_CUPS (printer);
-  
-  if (gtk_cups_result_is_error (result))
-    {
-      if (gtk_printer_is_new (printer))
-	{
-	  gtk_print_backend_remove_printer (GTK_PRINT_BACKEND (backend),
-					    printer);
-	  return;
-	}
-      else
-	return; /* TODO: mark as inactive printer */
-    }
-
-  response = gtk_cups_result_get_response (result);
-
-  /* TODO: determine printer type and use correct icon */
-  gtk_printer_set_icon_name (printer, "gtk-print");
- 
-  state_msg = "";
-  loc = "";
-  desc = "";
-  job_count = 0;
-  for (attr = response->attrs; attr != NULL; attr = attr->next) 
-    {
-      if (!attr->name)
-        continue;
-
-      _CUPS_MAP_ATTR_STR (attr, loc, "printer-location");
-      _CUPS_MAP_ATTR_STR (attr, desc, "printer-info");
-      _CUPS_MAP_ATTR_STR (attr, state_msg, "printer-state-message");
-      _CUPS_MAP_ATTR_INT (attr, cups_printer->state, "printer-state");
-      _CUPS_MAP_ATTR_INT (attr, job_count, "queued-job-count");
-    }
-
-  status_changed = gtk_printer_set_job_count (printer, job_count);
-  
-  status_changed |= gtk_printer_set_location (printer, loc);
-  status_changed |= gtk_printer_set_description (printer, desc);
-  status_changed |= gtk_printer_set_state_message (printer, state_msg);
-
-  if (status_changed)
-    g_signal_emit_by_name (GTK_PRINT_BACKEND (backend),
-			   "printer-status-changed", printer); 
-}
-
-static void
-cups_request_printer_info (GtkPrintBackendCups *print_backend,
-                           const gchar         *printer_name)
-{
-  GtkCupsRequest *request;
-  gchar *printer_uri;
-  static const char * const pattrs[] =	/* Attributes we're interested in */
-    {
-      "printer-location",
-      "printer-info",
-      "printer-state-message",
-      "printer-state",
-      "queued-job-count"
-    };
-
-  request = gtk_cups_request_new (NULL,
-                                  GTK_CUPS_POST,
-                                  IPP_GET_PRINTER_ATTRIBUTES,
-				  NULL,
-				  NULL,
-				  NULL);
-
-  printer_uri = g_strdup_printf ("ipp://localhost/printers/%s",
-                                  printer_name);
-  gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_URI,
-                                   "printer-uri", NULL, printer_uri);
-
-  GTK_NOTE (PRINTING,
-            g_print ("CUPS Backend: %s - Requesting printer info for URI '%s'\n", G_STRFUNC, printer_uri));
-
-  g_free (printer_uri);
-
-  gtk_cups_request_ipp_add_strings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-				    "requested-attributes", G_N_ELEMENTS (pattrs),
-				    NULL, pattrs);
- 
-  cups_request_execute (print_backend,
-                        request,
-                        (GtkPrintCupsResponseCallbackFunc) cups_request_printer_info_cb,
-                        g_strdup (printer_name),
-                        (GDestroyNotify) g_free);
-}
-
-
 typedef struct {
   GtkPrintBackendCups *print_backend;
   GtkPrintJob *job;
@@ -993,9 +871,15 @@
   for (attr = response->attrs; attr != NULL; attr = attr->next)
     {
       GtkPrinter *printer;
-      const gchar *printer_name;
-      const gchar *printer_uri;
-      const gchar *member_uris;
+      const gchar *printer_name = NULL;
+      const gchar *printer_uri = NULL;
+      const gchar *member_uris = NULL;
+      const gchar *location = NULL;
+      const gchar *description = NULL;
+      const gchar *state_msg = NULL;
+      gint state = 0;
+      gint job_count = 0;
+      gboolean status_changed = FALSE;
       GList *node;
       
       /* Skip leading attributes until we hit a printer...
@@ -1006,9 +890,6 @@
       if (attr == NULL)
         break;
 
-      printer_name = NULL;
-      printer_uri = NULL;
-      member_uris = NULL;
       while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
       {
         if (strcmp (attr->name, "printer-name") == 0 &&
@@ -1020,6 +901,16 @@
 	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") == 0)
+          state = attr->values[0].integer;
+        else if (strcmp (attr->name, "queued-job-count") == 0)
+          job_count = attr->values[0].integer;
         else
 	  {
 	    GTK_NOTE (PRINTING,
@@ -1130,8 +1021,16 @@
 	  gtk_printer_set_is_new (printer, FALSE);
         }
 
-      cups_request_printer_info (cups_backend, gtk_printer_get_name (printer));
+      GTK_PRINTER_CUPS (printer)->state = state;
+      status_changed = gtk_printer_set_job_count (printer, job_count);
+      status_changed |= gtk_printer_set_location (printer, location);
+      status_changed |= gtk_printer_set_description (printer, description);
+      status_changed |= gtk_printer_set_state_message (printer, state_msg);
 
+      if (status_changed)
+        g_signal_emit_by_name (GTK_PRINT_BACKEND (backend),
+                               "printer-status-changed", printer);
+
       /* The ref is held by GtkPrintBackend, in add_printer() */
       g_object_unref (printer);
       
@@ -1163,7 +1062,12 @@
     {
       "printer-name",
       "printer-uri-supported",
-      "member-uris"
+      "member-uris",
+      "printer-location",
+      "printer-info",
+      "printer-state-message",
+      "printer-state",
+      "queued-job-count"
     };
  
   if (cups_backend->list_printers_pending ||
