@@ -44,7 +44,7 @@ public class Jorts.Application : Gtk.Application {
4444 public static GLib . Settings gsettings;
4545 public static Gtk . Settings gtk_settings;
4646
47- public Jorts . NoteManager manager ;
47+ public Jorts . NoteManager note_manager ;
4848 public static Jorts . PreferenceWindow ? preferences;
4949
5050 // Used for commandline option handling
@@ -53,7 +53,6 @@ public class Jorts.Application : Gtk.Application {
5353
5454 public const string ACTION_PREFIX = " app." ;
5555 public const string ACTION_QUIT = " action_quit" ;
56- public const string ACTION_NEW = " action_new" ;
5756 public const string ACTION_TOGGLE_SCRIBBLY = " action_toggle_scribbly" ;
5857 public const string ACTION_TOGGLE_ACTIONBAR = " action_toggle_actionbar" ;
5958 public const string ACTION_SHOW_PREFERENCES = " action_show_preferences" ;
@@ -63,18 +62,33 @@ public class Jorts.Application : Gtk.Application {
6362
6463 private const GLib . ActionEntry [] ACTION_ENTRIES = {
6564 { ACTION_QUIT , quit},
66- { ACTION_NEW , action_new },
6765 { ACTION_TOGGLE_SCRIBBLY , action_toggle_scribbly},
6866 { ACTION_TOGGLE_ACTIONBAR , action_toggle_actionbar},
6967 { ACTION_SHOW_PREFERENCES , action_show_preferences},
70- { ACTION_SAVE , action_save},
7168 };
7269
7370 public Application () {
7471 Object (flags: ApplicationFlags . HANDLES_COMMAND_LINE ,
7572 application_id: APP_ID );
7673 }
7774
75+
76+ /* ************************************************/
77+ static construct {
78+ gsettings = new GLib .Settings (APP_ID );
79+ }
80+
81+ /* ************************************************/
82+ construct {
83+ // The localization thingamabob
84+ Intl . setlocale (LocaleCategory . ALL , " " );
85+ Intl . bindtextdomain (GETTEXT_PACKAGE , LOCALEDIR );
86+ Intl . bind_textdomain_codeset (GETTEXT_PACKAGE , " UTF-8" );
87+ Intl . textdomain (GETTEXT_PACKAGE );
88+ }
89+
90+
91+
7892 /* ************************************************/
7993 public override void startup () {
8094 debug (" Jorts Startup…" );
@@ -84,31 +98,18 @@ public class Jorts.Application : Gtk.Application {
8498
8599 add_action_entries (ACTION_ENTRIES , this );
86100 set_accels_for_action (" app.action_quit" , {" <Control>Q" });
87- set_accels_for_action (" app.action_new" , {" <Control>N" });
88- set_accels_for_action (" app.action_save" , {" <Control>S" });
89101 set_accels_for_action (" app.action_toggle_actionbar" , {" <Control>T" });
90102 set_accels_for_action (" app.action_show_preferences" , {" <Control>P" });
91103 set_accels_for_action (" app.action_toggle_scribbly" , {" <Control>H" });
92104
93- set_accels_for_action (" win.action_delete" , {" <Control>W" });
94- set_accels_for_action (" win.action_zoom_out" , {" <Control>minus" , " <Control>KP_Subtract" });
95- set_accels_for_action (" win.action_zoom_default" , {" <Control>equal" , " <Control>0" , " <Control>KP_0" });
96- set_accels_for_action (" win.action_zoom_in" , {" <Control>plus" , " <Control>KP_Add" });
97- set_accels_for_action (" win.action_toggle_mono" , {" <Control>m" });
98- set_accels_for_action (" win.action_focus_title" , {" <Control>L" });
99- set_accels_for_action (" win.action_show_emoji" , {" <Control>period" });
100- set_accels_for_action (" win.action_toggle_list" , {" <Shift>F12" });
101- set_accels_for_action (" win.action_show_menu" , {" <Control>G" , " <Control>O" });
102-
103- set_accels_for_action (" textview.action_toggle_list" , {" <Shift>F12" });
104-
105-
105+ note_manager = new Jorts .NoteManager (this );
106+ add_action_entries (NoteManager . ACTION_ENTRIES , note_manager);
106107
107108 // Force the eOS icon theme, and set the blueberry as fallback, if for some reason it fails for individual notes
108109 var granite_settings = Granite . Settings . get_default ();
109110 gtk_settings = Gtk . Settings . get_default ();
110111 gtk_settings. gtk_icon_theme_name = " elementary" ;
111- gtk_settings. gtk_theme_name = " io.elementary.stylesheet." + Jorts . Constants . DEFAULT_THEME. to_string (). ascii_down ();
112+ gtk_settings. gtk_theme_name = " io.elementary.stylesheet." + DEFAULT_THEME . to_string (). ascii_down ();
112113
113114 // Also follow dark if system is dark lIke mY sOul.
114115 gtk_settings. gtk_application_prefer_dark_theme = (
@@ -153,23 +154,6 @@ Please wait while the app remembers all the things...
153154 );
154155 }
155156
156- /* ************************************************/
157- static construct {
158- gsettings = new GLib .Settings (APP_ID );
159- }
160-
161- /* ************************************************/
162- construct {
163- // The localization thingamabob
164- Intl . setlocale (LocaleCategory . ALL , " " );
165- Intl . bindtextdomain (GETTEXT_PACKAGE , LOCALEDIR );
166- Intl . bind_textdomain_codeset (GETTEXT_PACKAGE , " UTF-8" );
167- Intl . textdomain (GETTEXT_PACKAGE );
168-
169- // add_main_option_entries (CMD_OPTION_ENTRIES);
170- manager = new Jorts .NoteManager (this );
171- }
172-
173157 // Clicked: Either show all windows, or rebuild from storage
174158 protected override void activate () {
175159 debug (" [JORTS] Jorts, activate!" );
@@ -178,27 +162,22 @@ Please wait while the app remembers all the things...
178162 // GLib.Environment.set_variable ("LANGUAGE", "pt_br", true);
179163
180164 /* Either we show all sticky notes, or we load everything lol */
181- if (manager . open_notes. size > 0 ) {
182- foreach (var window in manager . open_notes) {
165+ if (note_manager . open_notes. size > 0 ) {
166+ foreach (var window in note_manager . open_notes) {
183167 if (window. visible) {window. present ();}
184168 }
185169 } else {
186- manager . init ();
170+ note_manager . init ();
187171 }
188172
189- if (new_note) {manager . create_note (); new_note = false ;}
173+ if (new_note) {note_manager . create_note (); new_note = false ;}
190174 if (show_pref) {action_show_preferences (); show_pref = false ;}
191175 }
192176
193177 public static int main (string [] args ) {
194178 return new Application (). run (args);
195179 }
196180
197- private void action_new () {
198- debug (" New Note" );
199- manager. create_note ();
200- }
201-
202181 private void action_show_preferences () {
203182 debug (" Showing preferences!" );
204183
@@ -223,11 +202,6 @@ Please wait while the app remembers all the things...
223202 gsettings. set_boolean (" hide-bar" , ! current);
224203 }
225204
226- private void action_save () {
227- debug (" Saving..." );
228- manager. save_all ();
229- }
230-
231205 // checked upon window closing to make sure we do not linger in the background
232206 public void check_if_quit () {
233207 debug (" Windows open: %s " . printf (get_windows (). length (). to_string ()));
0 commit comments