From 1a45ab5e5e3daf6e5e7c4022612b0c9bd8910b47 Mon Sep 17 00:00:00 2001 From: Masayuki Yamamoto Date: Sat, 19 Oct 2019 15:20:22 +0900 Subject: [PATCH] Use Gtk::FontChooserDialog instead of Gtk::FileSelectionDialog on GTK3 (#134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GTK3版でGtk::FileSelectionDialogがクラッシュする報告があったので 非推奨のウィジェットのかわりにGtk::FontChooserDialogを使うように修正する。 修正にあたり不具合報告をしていただきありがとうございました。 https://mao.5ch.net/test/read.cgi/linux/1551889442/322 --- src/menuslots.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/menuslots.cpp b/src/menuslots.cpp index 8d229109c..ff9cd996c 100644 --- a/src/menuslots.cpp +++ b/src/menuslots.cpp @@ -48,6 +48,18 @@ using namespace CORE; +namespace { +#if GTKMM_CHECK_VERSION(3,1,16) +struct FontSelectionDialog : public Gtk::FontChooserDialog +{ + Glib::ustring get_font_name() const { return get_font(); } + void set_font_name( const Glib::ustring& name ) { set_font( name ); } +}; +#else +using FontSelectionDialog = Gtk::FontSelectionDialog; +#endif +} // namespace + // // URLを開く @@ -781,7 +793,7 @@ void Core::slot_setup_button() // void Core::slot_changefont_main() { - Gtk::FontSelectionDialog diag; + FontSelectionDialog diag; diag.set_font_name( CONFIG::get_fontname( FONT_MAIN ) ); diag.set_title( "スレビューフォント" ); diag.set_transient_for( *CORE::get_mainwindow() ); @@ -802,7 +814,7 @@ void Core::slot_changefont_main() // void Core::slot_changefont_popup() { - Gtk::FontSelectionDialog diag; + FontSelectionDialog diag; diag.set_font_name( CONFIG::get_fontname( FONT_POPUP ) ); diag.set_title( "ポップアップフォント" ); diag.set_transient_for( *CORE::get_mainwindow() ); @@ -819,7 +831,7 @@ void Core::slot_changefont_popup() // void Core::slot_changefont_tree() { - Gtk::FontSelectionDialog diag; + FontSelectionDialog diag; diag.set_font_name( CONFIG::get_fontname( FONT_BBS ) ); diag.set_title( "板/スレ一覧フォント" ); diag.set_transient_for( *CORE::get_mainwindow() );