| 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) | |
| 304 g_list_free_full(gtk_paper_sizes, | 303 g_list_free_full(gtk_paper_sizes, |
| 305 reinterpret_cast<GDestroyNotify>(gtk_paper_size_free)); | 304 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 | |
| 311 } | 305 } |
| 312 } else { | 306 } else { |
| 313 VLOG(1) << "Using default paper size"; | 307 VLOG(1) << "Using default paper size"; |
| 314 } | 308 } |
| 315 } | 309 } |
| 316 | 310 |
| 317 gtk_print_settings_set_orientation( | 311 gtk_print_settings_set_orientation( |
| 318 gtk_settings_, | 312 gtk_settings_, |
| 319 settings->landscape() ? GTK_PAGE_ORIENTATION_LANDSCAPE : | 313 settings->landscape() ? GTK_PAGE_ORIENTATION_LANDSCAPE : |
| 320 GTK_PAGE_ORIENTATION_PORTRAIT); | 314 GTK_PAGE_ORIENTATION_PORTRAIT); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 context_->InitWithSettings(*settings); | 533 context_->InitWithSettings(*settings); |
| 540 } | 534 } |
| 541 | 535 |
| 542 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { | 536 void PrintDialogGtk2::OnWindowDestroying(aura::Window* window) { |
| 543 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); | 537 DCHECK_EQ(libgtk2ui::GetAuraTransientParent(dialog_), window); |
| 544 | 538 |
| 545 libgtk2ui::ClearAuraTransientParent(dialog_); | 539 libgtk2ui::ClearAuraTransientParent(dialog_); |
| 546 window->RemoveObserver(this); | 540 window->RemoveObserver(this); |
| 547 Release(); | 541 Release(); |
| 548 } | 542 } |
| OLD | NEW |