@@ -28,7 +28,7 @@ At some point i may move this in its own file
2828
2929namespace Jorts {
3030 public class Application : Gtk .Application {
31- public Gee . ArrayList<StickyNoteWindow > open_notes = new Gee . ArrayList< StickyNoteWindow > () ;
31+ public static Gee . ArrayList<StickyNoteWindow > open_notes;
3232 public static GLib . Settings gsettings;
3333
3434 public Application () {
@@ -67,17 +67,6 @@ namespace Jorts {
6767 );
6868 });
6969
70- // var portal = new Xdp.Portal();
71- // GenericArray<weak string> cmd = new GenericArray<weak string> ();
72- // cmd.add ("io.github.ellie_commons.jorts");
73-
74- // portal.request_background(
75- // null,
76- // "autostart",
77- // cmd,
78- // Xdp.BackgroundFlags.AUTOSTART,
79- // null);
80-
8170 // build all the stylesheets
8271 Jorts . Themer . init_all_themes();
8372 }
@@ -153,15 +142,15 @@ namespace Jorts {
153142 // Create new instances of StickyNoteWindow
154143 // If we have data, nice, just load it into a new instance
155144 // Else we do a lil new note
156- public void create_note (NoteData ? data ) {
145+ public void create_note (NoteData ? data = null ) {
157146 StickyNoteWindow note;
158147 if (data != null ) {
159148 note = new StickyNoteWindow (this , data);
160149 }
161150 else {
162151
163152 // Skip theme from previous window, but use same text zoom
164- StickyNoteWindow last_note = this . open_notes. last ();
153+ StickyNoteWindow last_note = open_notes. last ();
165154 string skip_theme = last_note. theme;
166155 var random_data = Jorts . Utils . random_note(skip_theme);
167156
@@ -171,14 +160,14 @@ namespace Jorts {
171160 random_data. zoom = this . latest_zoom;
172161 note = new StickyNoteWindow (this , random_data);
173162 }
174- this . open_notes. add(note);
163+ open_notes. add(note);
175164 this . save_to_stash ();
176165 }
177166
178167 // Simply remove from the list of things to save, and close
179168 public void remove_note (StickyNoteWindow note ) {
180169 debug (" Removing a note…\n " );
181- this . open_notes. remove (note);
170+ open_notes. remove (note);
182171 this . save_to_stash ();
183172 }
184173
@@ -206,8 +195,6 @@ namespace Jorts {
206195 }
207196 }
208197
209-
210-
211198 public void show_all () {
212199 foreach (var window in open_notes) {
213200 if (window. visible) {
@@ -217,8 +204,6 @@ namespace Jorts {
217204 }
218205
219206
220-
221-
222207 /* ************************************************/
223208 public void init_all_notes () {
224209 Gee . ArrayList<NoteData > loaded_data = Jorts . Stash . load_from_stash();
@@ -234,7 +219,7 @@ namespace Jorts {
234219 print(" Doing a backup! :)" );
235220
236221 Jorts . Stash . check_if_stash ();
237- string json_data = Jorts . Jason . jsonify (this . open_notes);
222+ string json_data = Jorts . Jason . jsonify (open_notes);
238223 Jorts . Stash . overwrite_stash (json_data, Jorts . Constants . FILENAME_BACKUP );
239224
240225 var now = new DateTime .now_utc (). to_string() ;
@@ -243,9 +228,6 @@ namespace Jorts {
243228
244229 }
245230
246-
247-
248-
249231 /* ************************************************/
250232 protected override int command_line (ApplicationCommandLine command_line ) {
251233 PreferenceWindow preferences;
@@ -254,19 +236,16 @@ namespace Jorts {
254236 switch (args[1 ]) {
255237
256238 case " --new-note" :
257- activate ();
258- create_note(null );
239+ activate ();
240+
241+ create_note();
259242 break ;
260243
261244 case " --preferences" :
262245 activate ();
263246 preferences = new Jorts .PreferenceWindow ();
264247 break ;
265248
266- case " --dump" :
267- print(Jorts . Jason . jsonify (open_notes));
268- break ;
269-
270249 default:
271250 activate ();
272251 break ;
0 commit comments