| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/libgtk2ui/print_dialog_gtk2.h" | 5 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" |
| 6 | 6 |
| 7 #include <gtk/gtkunixprint.h> | 7 #include <gtk/gtkunixprint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 VLOG(1) << "Using custom paper size"; | 293 VLOG(1) << "Using custom paper size"; |
| 294 GtkPaperSize* custom_size = gtk_paper_size_new_custom( | 294 GtkPaperSize* custom_size = gtk_paper_size_new_custom( |
| 295 requested_media.vendor_id.c_str(), | 295 requested_media.vendor_id.c_str(), |
| 296 requested_media.vendor_id.c_str(), | 296 requested_media.vendor_id.c_str(), |
| 297 requested_media.size_microns.width() / kMicronsInMm, | 297 requested_media.size_microns.width() / kMicronsInMm, |
| 298 requested_media.size_microns.height() / kMicronsInMm, | 298 requested_media.size_microns.height() / kMicronsInMm, |
| 299 GTK_UNIT_MM); | 299 GTK_UNIT_MM); |
| 300 gtk_page_setup_set_paper_size(page_setup_, custom_size); | 300 gtk_page_setup_set_paper_size(page_setup_, custom_size); |
| 301 gtk_paper_size_free(custom_size); | 301 gtk_paper_size_free(custom_size); |
| 302 } | 302 } |
| 303 #if GTK_CHECK_VERSION(2,28,0) |
| 303 g_list_free_full(gtk_paper_sizes, | 304 g_list_free_full(gtk_paper_sizes, |
| 304 reinterpret_cast<GDestroyNotify>(gtk_paper_size_free)); | 305 reinterpret_cast<GDestroyNotify>(gtk_paper_size_free)); |
| 306 #else |
| 307 g_list_foreach(gtk_paper_sizes, |
| 308 reinterpret_cast<GFunc>(gtk_paper_size_free), NULL); |
| 309 g_list_free(gtk_paper_sizes); |
| 310 #endif |
| 305 } | 311 } |
| 306 } else { | 312 } else { |
| 307 VLOG(1) << "Using default paper size"; | 313 VLOG(1) << "Using default paper size"; |
| 308 } | 314 } |
| 309 } | 315 } |
| 310 | 316 |
| 311 gtk_print_settings_set_orientation( | 317 gtk_print_settings_set_orientation( |
| 312 gtk_settings_, | 318 gtk_settings_, |
| 313 settings->landscape() ? GTK_PAGE_ORIENTATION_LANDSCAPE : | 319 settings->landscape() ? GTK_PAGE_ORIENTATION_LANDSCAPE : |
| 314 GTK_PAGE_ORIENTATION_PORTRAIT); | 320 GTK_PAGE_ORIENTATION_PORTRAIT); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 context_->InitWithSettings(*settings); | 539 context_->InitWithSettings(*settings); |
| 534 } | 540 } |
| 535 | 541 |
| 536 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { | 542 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { |
| 537 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); | 543 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); |
| 538 | 544 |
| 539 libgtk2ui::ClearAuraTransientParent(dialog_); | 545 libgtk2ui::ClearAuraTransientParent(dialog_); |
| 540 window->RemoveObserver(this); | 546 window->RemoveObserver(this); |
| 541 Release(); | 547 Release(); |
| 542 } | 548 } |
| OLD | NEW |