diff --git a/src/Application.vala b/src/Application.vala index 8335cd1e..e57be5a0 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -41,10 +41,10 @@ Constants is because i am lazy public class Jorts.Application : Gtk.Application { // Needed by all windows - public static GLib.Settings gsettings; + public static GLib.Settings settings; public static Gtk.Settings gtk_settings; - public Jorts.NoteManager note_manager; + public static Jorts.NoteManager note_manager; public static Jorts.PreferenceWindow? preferences; // Used for commandline option handling @@ -80,7 +80,7 @@ public class Jorts.Application : Gtk.Application { /*************************************************/ static construct { - gsettings = new GLib.Settings (APP_ID); + settings = new GLib.Settings (APP_ID); } /*************************************************/ @@ -202,14 +202,14 @@ Please wait while the app remembers all the things… private void action_toggle_scribbly () { debug ("Toggling scribbly"); - var current = Application.gsettings.get_boolean (KEY_SCRIBBLY); - gsettings.set_boolean (KEY_SCRIBBLY, !current); + var current = Application.settings.get_boolean (KEY_SCRIBBLY); + settings.set_boolean (KEY_SCRIBBLY, !current); } private void action_toggle_actionbar () { debug ("Toggling actionbar"); - var current = Application.gsettings.get_boolean (KEY_HIDEBAR); - gsettings.set_boolean (KEY_HIDEBAR, !current); + var current = Application.settings.get_boolean (KEY_HIDEBAR); + settings.set_boolean (KEY_HIDEBAR, !current); } private void nm_new_note () { diff --git a/src/Objects/NoteData.vala b/src/Objects/NoteData.vala index 6a8a27ce..f8f8377b 100644 --- a/src/Objects/NoteData.vala +++ b/src/Objects/NoteData.vala @@ -11,7 +11,7 @@ /** * An object used to package all data conveniently as needed. */ -public class Jorts.NoteData : Object { +public class Jorts.NoteData { // Will determine properties (or lack thereof) for any new note public static Jorts.Themes latest_theme = DEFAULT_THEME; diff --git a/src/Services/ScribblyController.vala b/src/Services/ScribblyController.vala index c329761f..8d365cba 100644 --- a/src/Services/ScribblyController.vala +++ b/src/Services/ScribblyController.vala @@ -30,7 +30,7 @@ public class Jorts.ScribblyController : Object { window.set_state_flags (Gtk.StateFlags.BACKDROP, false); - Application.gsettings.bind ( + Application.settings.bind ( KEY_SCRIBBLY, this, "scribble", SettingsBindFlags.DEFAULT); diff --git a/src/Views/NoteView.vala b/src/Views/NoteView.vala index 0c62dcf9..dd15e122 100644 --- a/src/Views/NoteView.vala +++ b/src/Views/NoteView.vala @@ -109,10 +109,10 @@ emojichooser_popover.show.connect (randomize_emote_button); emojichooser_popover.emoji_picked.connect (on_emoji_picked); - //Application.gsettings.bind ("hide-bar", actionbar, "revealed", SettingsBindFlags.INVERT_BOOLEAN); + //Application.settings.bind ("hide-bar", actionbar, "revealed", SettingsBindFlags.INVERT_BOOLEAN); //textview.bind_property ("on_list_item", actionbar.list_button, "active", GLib.BindingFlags.DEFAULT); - Application.gsettings.bind (KEY_LIST, + Application.settings.bind (KEY_LIST, textview, "listprefix", GLib.SettingsBindFlags.DEFAULT); } diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index a61922ba..326fc093 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -50,9 +50,9 @@ valign = Gtk.Align.CENTER }; - list_dropdown.selected = Application.gsettings.get_enum (KEY_LIST); + list_dropdown.selected = Application.settings.get_enum (KEY_LIST); list_dropdown.notify["selected"].connect (() => { - Application.gsettings.set_enum (KEY_LIST, (int)list_dropdown.selected); + Application.settings.set_enum (KEY_LIST, (int)list_dropdown.selected); }); var lists_box = new SettingsBox ( @@ -69,7 +69,7 @@ var scribbly_toggle = new Gtk.Switch (); - Application.gsettings.bind (KEY_SCRIBBLY, + Application.settings.bind (KEY_SCRIBBLY, scribbly_toggle, "active", GLib.SettingsBindFlags.DEFAULT); @@ -86,7 +86,7 @@ /*************************************************/ var hidebar_toggle = new Gtk.Switch (); - Application.gsettings.bind (KEY_HIDEBAR, + Application.settings.bind (KEY_HIDEBAR, hidebar_toggle, "active", GLib.SettingsBindFlags.DEFAULT); @@ -131,7 +131,7 @@ #if !WINDOWS autostart_toggle = new Gtk.Switch (); - Application.gsettings.bind (KEY_AUTOSTART, + Application.settings.bind (KEY_AUTOSTART, autostart_toggle, "active", GLib.SettingsBindFlags.DEFAULT); diff --git a/src/Widgets/ActionBar.vala b/src/Widgets/ActionBar.vala index db0bb78a..74bbe910 100644 --- a/src/Widgets/ActionBar.vala +++ b/src/Widgets/ActionBar.vala @@ -116,7 +116,7 @@ // Hide the list button if user has specified no list item symbol on_prefix_changed (); - Application.gsettings.changed[KEY_LIST].connect (on_prefix_changed); + Application.settings.changed[KEY_LIST].connect (on_prefix_changed); } /** @@ -124,7 +124,7 @@ * StickyNoteWindow will decide itself whether to show immediately or not */ public void reveal_bind () { - Application.gsettings.bind (KEY_HIDEBAR, + Application.settings.bind (KEY_HIDEBAR, actionbar, "revealed", SettingsBindFlags.INVERT_BOOLEAN); } @@ -144,7 +144,7 @@ * If user leaves list prefix blank, then they dont need the button. */ private void on_prefix_changed () { - var is_disabled = Application.gsettings.get_enum (KEY_LIST) == ListPrefix.DISABLED; + var is_disabled = Application.settings.get_enum (KEY_LIST) == ListPrefix.DISABLED; list_button.visible = !is_disabled; } } diff --git a/src/Windows/PreferenceWindow.vala b/src/Windows/PreferenceWindow.vala index 9167a211..51217c9b 100644 --- a/src/Windows/PreferenceWindow.vala +++ b/src/Windows/PreferenceWindow.vala @@ -73,13 +73,5 @@ public class Jorts.PreferenceWindow : Gtk.Window { this.child = handle; set_focus (prefview.close_button); - - // Since each sticky note adopts a different accent color - // we have to revert to default when this one is focused - this.notify["is-active"].connect (() => { - if (this.is_active) { - Application.gtk_settings.gtk_theme_name = DEFAULT_STYLESHEET; - } - }); } } diff --git a/src/Windows/StickyNoteWindow.vala b/src/Windows/StickyNoteWindow.vala index 257c4f7d..2f7f38d7 100644 --- a/src/Windows/StickyNoteWindow.vala +++ b/src/Windows/StickyNoteWindow.vala @@ -74,7 +74,7 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow { insert_action_group ("textview", textview.actions); insert_action_group ("zoom_controller", zoom_controller.actions); - // Have shortcuts keep working with the popover open. + // Have shortcuts keep working this.destroy ()with the popover open. popover = view.popover; view.popover.scroll_controller.scroll.connect (zoom_controller.on_scroll); view.popover.keypress_controller.key_pressed.connect (zoom_controller.on_key_press_event); @@ -111,7 +111,7 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow { popover.theme_changed.connect (color_controller.on_color_changed); // Respect animation settings for showing ui elements - if (Application.gtk_settings.gtk_enable_animations && (!Application.gsettings.get_boolean (KEY_HIDEBAR))) { + if (Application.gtk_settings.gtk_enable_animations && (!Application.settings.get_boolean (KEY_HIDEBAR))) { show.connect_after (delayed_show); } else { @@ -133,7 +133,7 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow { } private void bind_hidebar () { - Application.gsettings.bind ( + Application.settings.bind ( KEY_HIDEBAR, view.actionbar.actionbar, "revealed", @@ -203,5 +203,12 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow { public void has_changed () { application.activate_action (Application.ACTION_SAVE, null); } - private void action_delete () {((Jorts.Application)this.application).note_manager.delete_note (this); this.destroy ();} + + private void action_delete () { + Application.note_manager.delete_note (this); + } + + ~StickyNoteWindow () { + print ("\nDestroying %s", view.title); + } }