Changeset 220 for trunk/src/PrintPter.cxx
- Timestamp:
- 06/11/06 09:47:12 (2 years ago)
- Files:
-
- 1 modified
-
trunk/src/PrintPter.cxx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PrintPter.cxx
r219 r220 192 192 PrintPter::listPrinters (void) 193 193 { 194 IPrintView &view = getView (); 195 194 196 cups_dest_t *destinations; 195 197 int numDestinations = cupsGetDests (&destinations); 198 // For now we don't have any printer selected. 199 int printerToSelect = -1; 196 200 197 201 for ( int currentDestination = 0 ; currentDestination < numDestinations ; … … 207 211 printerAttributes *attributes = getPrinterAttributes (printerName); 208 212 // Set all this data to the view. 209 getView ().addPrinter (printerName, numJobs,213 view.addPrinter (printerName, numJobs, 210 214 attributes->state, attributes->location); 211 215 g_free (attributes->location); 212 216 g_free (attributes->state); 213 217 delete attributes; 214 } 215 218 219 // If the printer is the default and we don't have any printer 220 // selected, then we should select it. 221 if ( -1 == printerToSelect && 222 destinations[currentDestination].is_default ) 223 { 224 printerToSelect = currentDestination; 225 } 226 } 216 227 cupsFreeDests (numDestinations, destinations); 217 } 228 229 // If not printer is available, insensitive the print button. 230 if ( 0 == numDestinations ) 231 { 232 view.sensitivePrintButton (FALSE); 233 } 234 // Otherwise select a printer: the previously used, the default or 235 // the first. 236 else 237 { 238 if ( -1 == printerToSelect ) 239 { 240 view.selectPrinter (0); 241 } 242 else 243 { 244 view.selectPrinter (printerToSelect); 245 } 246 } 247 }
