Changeset 220
- Timestamp:
- 06/11/06 09:47:12 (2 years ago)
- Location:
- trunk/src
- Files:
-
- 4 modified
-
IPrintView.h (modified) (2 diffs)
-
PrintPter.cxx (modified) (2 diffs)
-
gtk/PrintView.cxx (modified) (2 diffs)
-
gtk/PrintView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/IPrintView.h
r219 r220 93 93 94 94 /// 95 /// @brief Selects a printer from the list. 96 /// 97 /// @param printerIndex The index of the printer to select. 98 /// 99 virtual void selectPrinter (unsigned int printerIndex) = 0; 100 101 /// 95 102 /// @brief Changes the sensitivity of the "Collate" option. 96 103 /// … … 114 121 virtual void sensitivePageRange (gboolean sensitive) = 0; 115 122 123 /// 124 /// @brief Changes the sensitivity of the "Print" button. 125 /// 126 /// The view must change the sensitivity (it's called enabled or 127 /// disabled on some toolkits) of the "Print" button. 128 /// 129 /// @param sensitive Set to TRUE if need to sensitive (enable) the 130 /// button or FALSE to insensitive (disable) it. 131 /// 132 virtual void sensitivePrintButton (gboolean sensitive) = 0; 133 134 116 135 protected: 117 136 /// The presenter that controls the view. -
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 } -
trunk/src/gtk/PrintView.cxx
r219 r220 135 135 136 136 void 137 PrintView::selectPrinter (unsigned int printerIndex) 138 { 139 gchar *pathString = g_strdup_printf ("%d", printerIndex); 140 GtkTreeIter printerIter; 141 if ( gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (m_PrinterList), 142 &printerIter, pathString) ) 143 { 144 GtkTreeSelection *selection = 145 gtk_tree_view_get_selection (GTK_TREE_VIEW (m_PrinterListView)); 146 gtk_tree_selection_select_iter (selection, &printerIter); 147 } 148 g_free (pathString); 149 } 150 151 void 137 152 PrintView::sensitiveCollate (gboolean sensitive) 138 153 { … … 144 159 { 145 160 gtk_widget_set_sensitive (m_PageRange, sensitive); 161 } 162 163 void 164 PrintView::sensitivePrintButton (gboolean sensitive) 165 { 166 gtk_dialog_set_response_sensitive (GTK_DIALOG (m_PrintDialog), 167 GTK_RESPONSE_ACCEPT, sensitive); 146 168 } 147 169 -
trunk/src/gtk/PrintView.h
r219 r220 34 34 virtual unsigned int getNumberOfCopies (void); 35 35 virtual gboolean isSelectedAllPagesRangeOption (void); 36 virtual void selectPrinter (unsigned int printerInde); 36 37 virtual void sensitiveCollate (gboolean sensitive); 37 38 virtual void sensitivePageRange (gboolean sensitive); 39 virtual void sensitivePrintButton (gboolean sensitive); 38 40 39 41 protected:
