@@ -7,8 +7,11 @@ namespace Notejot {
77 { " quit" , quit },
88 };
99
10+ // Hold a strong reference so the welcome window isn't GC'ed
11+ private WelcomeScreen ? welcome_screen = null ;
12+
1013 public NotejotApp () {
11- Object (application_id: " io.github.lainsce.Notejot" );
14+ Object (application_id : " io.github.lainsce.Notejot" );
1215 }
1316
1417 static construct {
@@ -21,7 +24,40 @@ namespace Notejot {
2124 }
2225
2326 public override void activate () {
24- this . active_window? . present ();
27+ var window = this . active_window;
28+ if (window == null ) {
29+ window = new Window (this );
30+ }
31+ window. present ();
32+
33+ if (WelcomeScreen . should_show (settings)) {
34+ this . welcome_screen = new WelcomeScreen (window);
35+
36+ // Make the Gtk.Application own the welcome window as well
37+ this . add_window (this . welcome_screen);
38+
39+ GLib . Idle . add (() = > {
40+ // It may have been closed quickly; guard against null
41+ if (this . welcome_screen != null ) {
42+ this . welcome_screen. present ();
43+ }
44+ return false ;
45+ });
46+
47+ this . welcome_screen. finished. connect (() = > {
48+ this . welcome_screen. mark_completed ();
49+
50+ // Close the welcome window and drop our reference
51+ this . welcome_screen. close ();
52+ this . welcome_screen = null ;
53+
54+ this . reminder_service = new ReminderService ();
55+ this . reminder_service. start ();
56+ });
57+ } else {
58+ this . reminder_service = new ReminderService ();
59+ this . reminder_service. start ();
60+ }
2561 }
2662
2763 public override void startup () {
@@ -44,19 +80,16 @@ namespace Notejot {
4480 base . startup ();
4581
4682 add_action_entries (APP_ENTRIES , this );
83+ new Window (this );
4784
4885 // React to dark-mode changes
4986 this . app_css_provider = new Gtk .CssProvider ();
50- var settings = Gtk . Settings . get_default ();
51- if (settings != null ) {
52- settings . notify[" gtk-application-prefer-dark-theme" ]. connect (() = > {
87+ var gsettings = Gtk . Settings . get_default ();
88+ if (gsettings != null ) {
89+ gsettings . notify[" gtk-application-prefer-dark-theme" ]. connect (() = > {
5390 load_theme_css ();
5491 });
5592 }
56-
57- new Window (this );
58- this . reminder_service = new ReminderService ();
59- this . reminder_service. start ();
6093 }
6194
6295 private void load_theme_css () {
0 commit comments