Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/printing/print_dialog_gtk.cc

Issue 7791004: linux: delete code that worked around gtk <2.18 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/ui/gtk/global_bookmark_menu.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/printing/print_dialog_gtk.h" 5 #include "chrome/browser/printing/print_dialog_gtk.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <gtk/gtkpagesetupunixdialog.h> 8 #include <gtk/gtkpagesetupunixdialog.h>
9 #include <gtk/gtkprintjob.h> 9 #include <gtk/gtkprintjob.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 // |gtk_settings_| is a new object. 137 // |gtk_settings_| is a new object.
138 gtk_settings_ = gtk_print_settings_new(); 138 gtk_settings_ = gtk_print_settings_new();
139 139
140 scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList); 140 scoped_ptr<GtkPrinterList> printer_list(new GtkPrinterList);
141 printer_ = printer_list->default_printer(); 141 printer_ = printer_list->default_printer();
142 if (printer_) { 142 if (printer_) {
143 g_object_ref(printer_); 143 g_object_ref(printer_);
144 gtk_print_settings_set_printer(gtk_settings_, 144 gtk_print_settings_set_printer(gtk_settings_,
145 gtk_printer_get_name(printer_)); 145 gtk_printer_get_name(printer_));
146 #if GTK_CHECK_VERSION(2, 14, 0)
147 page_setup_ = gtk_printer_get_default_page_size(printer_); 146 page_setup_ = gtk_printer_get_default_page_size(printer_);
148 #endif
149 } 147 }
150 148
151 if (!page_setup_) 149 if (!page_setup_)
152 page_setup_ = gtk_page_setup_new(); 150 page_setup_ = gtk_page_setup_new();
153 151
154 // No page range to initialize for default settings. 152 // No page range to initialize for default settings.
155 PageRanges ranges_vector; 153 PageRanges ranges_vector;
156 InitPrintSettings(ranges_vector); 154 InitPrintSettings(ranges_vector);
157 } 155 }
158 156
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Since we only generate PDF, only show printers that support PDF. 227 // Since we only generate PDF, only show printers that support PDF.
230 // TODO(thestig) Add more capabilities to support? 228 // TODO(thestig) Add more capabilities to support?
231 GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>( 229 GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>(
232 GTK_PRINT_CAPABILITY_GENERATE_PDF | 230 GTK_PRINT_CAPABILITY_GENERATE_PDF |
233 GTK_PRINT_CAPABILITY_PAGE_SET | 231 GTK_PRINT_CAPABILITY_PAGE_SET |
234 GTK_PRINT_CAPABILITY_COPIES | 232 GTK_PRINT_CAPABILITY_COPIES |
235 GTK_PRINT_CAPABILITY_COLLATE | 233 GTK_PRINT_CAPABILITY_COLLATE |
236 GTK_PRINT_CAPABILITY_REVERSE); 234 GTK_PRINT_CAPABILITY_REVERSE);
237 gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(dialog_), 235 gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(dialog_),
238 cap); 236 cap);
239 #if GTK_CHECK_VERSION(2, 18, 0)
240 gtk_print_unix_dialog_set_embed_page_setup(GTK_PRINT_UNIX_DIALOG(dialog_), 237 gtk_print_unix_dialog_set_embed_page_setup(GTK_PRINT_UNIX_DIALOG(dialog_),
241 TRUE); 238 TRUE);
242 #endif
243 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); 239 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
244 gtk_widget_show(dialog_); 240 gtk_widget_show(dialog_);
245 } 241 }
246 242
247 void PrintDialogGtk::PrintDocument(const printing::Metafile* metafile, 243 void PrintDialogGtk::PrintDocument(const printing::Metafile* metafile,
248 const string16& document_name) { 244 const string16& document_name) {
249 // This runs on the print worker thread, does not block the UI thread. 245 // This runs on the print worker thread, does not block the UI thread.
250 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 246 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
251 247
252 // The document printing tasks can outlive the PrintingContext that created 248 // The document printing tasks can outlive the PrintingContext that created
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // Printing finished. Matches AddRef() in PrintDocument(); 380 // Printing finished. Matches AddRef() in PrintDocument();
385 Release(); 381 Release();
386 } 382 }
387 383
388 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges) { 384 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges) {
389 PrintSettings settings; 385 PrintSettings settings;
390 printing::PrintSettingsInitializerGtk::InitPrintSettings( 386 printing::PrintSettingsInitializerGtk::InitPrintSettings(
391 gtk_settings_, page_setup_, page_ranges, false, &settings); 387 gtk_settings_, page_setup_, page_ranges, false, &settings);
392 context_->InitWithSettings(settings); 388 context_->InitWithSettings(settings);
393 } 389 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/ui/gtk/global_bookmark_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698