Changeset 243 for trunk/src/PrintPter.cxx
- Timestamp:
- 06/18/06 09:31:40 (2 years ago)
- Files:
-
- 1 modified
-
trunk/src/PrintPter.cxx (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PrintPter.cxx
r239 r243 105 105 IPrintView &view = getView (); 106 106 // Get the printer's name. 107 char *printerName = view.getSelectedPrinterName (); 108 if ( NULL != printerName ) 109 { 107 char *printerAndInstanceNames = view.getSelectedPrinterName (); 108 if ( NULL != printerAndInstanceNames ) 109 { 110 gchar *slashPosition = g_strrstr (printerAndInstanceNames, "/"); 111 *slashPosition = '\0'; 112 gchar *printerName = g_strdup (printerAndInstanceNames); 113 *slashPosition = '/'; 114 110 115 float pageWidth; 111 116 float pageHeight; … … 158 163 IJob::enqueue (job); 159 164 165 g_free (printerAndInstanceNames); 160 166 g_free (printerName); 161 167 } … … 169 175 IPrintView &view = getView (); 170 176 171 gchar *printer Name= view.getSelectedPrinterName ();172 173 if ( NULL != printer Name)177 gchar *printerAndInstanceNames = view.getSelectedPrinterName (); 178 179 if ( NULL != printerAndInstanceNames ) 174 180 { 175 181 cups_dest_t *destinations; … … 177 183 if ( NULL == destinations ) 178 184 { 179 g_free (printer Name);185 g_free (printerAndInstanceNames); 180 186 return; 181 187 } 182 cups_dest_t *destination = cupsGetDest (printerName, NULL, 188 gchar *slashPosition = g_strrstr (printerAndInstanceNames, "/"); 189 gchar *printerName = NULL; 190 gchar *instanceName = NULL; 191 if ( slashPosition != NULL ) 192 { 193 *slashPosition = '\0'; 194 printerName = g_strdup (printerAndInstanceNames); 195 instanceName = g_strdup (slashPosition + 1); 196 *slashPosition = '/'; 197 } 198 else 199 { 200 printerName = g_strdup (printerAndInstanceNames); 201 } 202 cups_dest_t *destination = cupsGetDest (printerName, instanceName, 183 203 numDestinations, destinations); 184 204 if ( NULL == destinations ) … … 273 293 cupsFreeDests (numDestinations, destinations); 274 294 g_free (printerName); 295 g_free (instanceName); 296 g_free (printerAndInstanceNames); 275 297 } 276 298 } … … 411 433 ++currentDestination ) 412 434 { 413 // Get the printer name .435 // Get the printer name and the local instance, if it has any. 414 436 gchar *printerName = destinations[currentDestination].name; 437 gchar *printerAndInstanceNames = NULL; 438 if ( NULL != destinations[currentDestination].instance ) 439 { 440 printerAndInstanceNames = g_strdup_printf ("%s/%s", 441 destinations[currentDestination].name, 442 destinations[currentDestination].instance ); 443 } 444 else 445 { 446 printerAndInstanceNames = 447 g_strdup (destinations[currentDestination].name); 448 } 415 449 // Get the number of jobs the printer currently has. 416 450 cups_job_t *destinationJobs; … … 420 454 printerAttributes *attributes = getPrinterAttributes (printerName); 421 455 // Set all this data to the view. 422 view.addPrinter (printer Name, numJobs,456 view.addPrinter (printerAndInstanceNames, numJobs, 423 457 attributes->state, attributes->location); 458 g_free (printerAndInstanceNames); 424 459 g_free (attributes->location); 425 460 g_free (attributes->state);
