@@ -20,6 +20,9 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
2020 private Gtk . TextView canvas;
2121 private Gtk . HeaderBar header;
2222 private Granite . ModeSwitch darkmode_switch;
23+ private Gtk . RadioMenuItem font_serif_option;
24+ private Gtk . RadioMenuItem font_sans_option;
25+ private Gtk . RadioMenuItem font_wrap_option;
2326
2427 private static string data_dir = " .writeas" ;
2528 private static string version = " 1.0.1" ;
@@ -162,10 +165,10 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
162165 fonts. popup = new Gtk .Menu ();
163166 header. pack_start(fonts);
164167
165- build_fontoption(fonts. popup, _(" Serif" ), " serif" , font);
166- build_fontoption(fonts. popup, _(" Sans-serif" ), " sans" ,
168+ font_serif_option = build_fontoption(fonts. popup, _(" Serif" ), " serif" , font);
169+ font_sans_option = build_fontoption(fonts. popup, _(" Sans-serif" ), " sans" ,
167170 " 'Open Sans', 'Segoe UI', Tahoma, Arial, sans-serif" );
168- build_fontoption(fonts. popup, _(" Monospace" ), " wrap" , " Hack, consolas," +
171+ font_wrap_option = build_fontoption(fonts. popup, _(" Monospace" ), " wrap" , " Hack, consolas," +
169172 " Menlo-Regular, Menlo, Monaco, 'ubuntu mono', monospace" );
170173 fonts. popup. show_all();
171174 }
@@ -193,6 +196,8 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
193196 }
194197
195198 menu. add(option);
199+
200+ return option;
196201 }
197202
198203 public override void grab_focus () {
@@ -213,6 +218,15 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
213218 font = theme. get_string(" Post" , " font" );
214219 fontstyle = theme. get_string(" Post" , " fontstyle" );
215220
221+ // Select the current font in the menu
222+ if (fontstyle == " serif" ) {
223+ font_serif_option. set_active(true );
224+ } else if (fontstyle == " sans" ) {
225+ font_sans_option. set_active(true );
226+ } else if (fontstyle == " wrap" ) {
227+ font_wrap_option. set_active(true );
228+ }
229+
216230 adjust_text_style(false );
217231 } catch (Error err) {/* No biggy... */ }
218232 }
0 commit comments