From 35a9f134cc138fbfffa482c5b0086e57eda98af4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 20 Oct 2018 09:58:30 -0700 Subject: [PATCH] Fix build with wxUSE_UNICODE_UTF8 wxString is not implicitly convertible to const char* in that configuration. Also, stock IDs work fine with GTK+3 despite being deprecated, so only avoid them for GTK+4. --- src/gtk/infobar.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/gtk/infobar.cpp b/src/gtk/infobar.cpp index 453e11448d..55859bca32 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -139,7 +139,6 @@ bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid) // finish creation and connect to all the signals we're interested in m_parent->DoAddChild(this); - PostCreation(wxDefaultSize); GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response)); @@ -232,18 +231,13 @@ GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label) // our best size (at least in vertical direction) InvalidateBestSize(); - GtkWidget *button = gtk_info_bar_add_button - ( - GTK_INFO_BAR(m_widget), - label.empty() ? -#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0) - wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(btnid))) + GtkWidget* button = gtk_info_bar_add_button(GTK_INFO_BAR(m_widget), +#ifdef __WXGTK4__ + wxGTK_CONV(label.empty() ? wxConvertMnemonicsToGTK(wxGetStockLabel(btnid)) : label), #else - wxString(wxGetStockGtkID(btnid)) -#endif // GTK >= 3.10 / < 3.10 - : wxGTK_CONV(label), - btnid - ); + label.empty() ? wxGetStockGtkID(btnid) : static_cast(wxGTK_CONV(label)), +#endif + btnid); wxASSERT_MSG( button, "unexpectedly failed to add button to info bar" );