Changeset 228
- Timestamp:
- 06/12/06 17:10:08 (2 years ago)
- Files:
-
- 1 modified
-
trunk/src/PrintPter.cxx (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PrintPter.cxx
r222 r228 163 163 164 164 gchar *printerName = view.getSelectedPrinterName (); 165 165 166 if ( NULL != printerName ) 166 167 { 168 cups_dest_t *destinations; 169 guint numDestinations = cupsGetDests (&destinations); 170 if ( NULL == destinations ) 171 { 172 g_free (printerName); 173 return; 174 } 175 cups_dest_t *destination = cupsGetDest (printerName, NULL, 176 numDestinations, destinations); 177 if ( NULL == destinations ) 178 { 179 g_free (printerName); 180 cupsFreeDests (numDestinations, destinations); 181 return; 182 } 183 167 184 const gchar *printerPPDName = cupsGetPPD (printerName); 168 185 if ( NULL != printerPPDName ) … … 171 188 if ( NULL != printerPPD ) 172 189 { 190 ppdMarkDefaults (printerPPD); 191 cupsMarkOptions (printerPPD, destination->num_options, 192 destination->options); 193 194 // Get the default page size. 195 ppd_option_t *pageSizeOption = ppdFindOption (printerPPD, 196 "PageSize"); 197 gchar *defaultPageSize = NULL; 198 if ( NULL != pageSizeOption ) 199 { 200 defaultPageSize = pageSizeOption->defchoice; 201 } 202 173 203 view.clearPageSizeList (); 174 int pageSizeToSelect = 1;204 int pageSizeToSelect = 0; 175 205 for ( int currentSize = 0 ; 176 206 currentSize < printerPPD->num_sizes ; … … 179 209 const gchar *sizeName = printerPPD->sizes[currentSize].name; 180 210 view.addPageSize (_(sizeName), sizeName); 211 if ( NULL != defaultPageSize && 212 0 == g_ascii_strcasecmp (defaultPageSize, sizeName) ) 213 { 214 pageSizeToSelect = currentSize; 215 } 181 216 } 182 217 view.selectPageSize (pageSizeToSelect); … … 184 219 } 185 220 } 221 cupsFreeDests (numDestinations, destinations); 186 222 g_free (printerName); 187 223 }
