From 16ca2df0c4a55421c0568049b509c6c15ec74be3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 16 May 2021 00:46:27 +0200 Subject: [PATCH] Refactor return code in wxGtkPrinter::Print() No real changes, just make it simpler to do other things before returning successfully by handling error returns separately. This is also more consistent with PrintDialog() method of the same class. No real changes. --- src/gtk/print.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 1e758eac43..f3376a6fb5 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -977,19 +977,23 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) // doesn't necessarily show int ret = dialog.ShowModal(); - if (ret == wxID_CANCEL) - { - sm_lastError = wxPRINTER_CANCELLED; - } - if (ret == wxID_NO) - { - sm_lastError = wxPRINTER_ERROR; - } printout->SetDC(NULL); wxDELETE(m_dc); - return (sm_lastError == wxPRINTER_NO_ERROR); + if (ret == wxID_CANCEL) + { + sm_lastError = wxPRINTER_CANCELLED; + return false; + } + if (ret == wxID_NO) + { + sm_lastError = wxPRINTER_ERROR; + return false; + } + + sm_lastError = wxPRINTER_NO_ERROR; + return true; } void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context)