Browse Source

Fix font preference not persisting when loading w/ dark mode

Previously, the initial dark mode toggle would cause the default
settings to be saved, before font preferences ever loaded.
tags/v1.0.0
Matt Baer 6 years ago
parent
commit
8076cb1c33
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      src/window.vala

+ 7
- 3
src/window.vala View File

@@ -11,6 +11,8 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
private string fontstyle = "serif";
private bool text_changed = false;

private bool is_initializing = true;

construct {
header = new Gtk.HeaderBar();
header.title = "Write.as";
@@ -44,7 +46,8 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
return Source.CONTINUE;
});

adjust_text_style();
adjust_text_style(false);

}

public MainWindow(Gtk.Application app) {
@@ -57,6 +60,7 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
restore_styles();

set_default_size(800, 600);
is_initializing = false;
}

private static void init_folder() {
@@ -101,7 +105,7 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
darkmode_button.toggled.connect(() => {
settings.gtk_application_prefer_dark_theme = darkmode_button.active;
dark_mode = darkmode_button.active;
adjust_text_style();
adjust_text_style(!is_initializing);
});
header.pack_end(darkmode_button);

@@ -127,7 +131,7 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
option.activate.connect(() => {
this.font = families;
this.fontstyle = fontstyle;
adjust_text_style();
adjust_text_style(!is_initializing);
});

var styles = option.get_style_context();


Loading…
Cancel
Save