Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -80,7 +80,7 @@ public class Jorts.Application : Gtk.Application {

/*************************************************/
static construct {
gsettings = new GLib.Settings (APP_ID);
settings = new GLib.Settings (APP_ID);
}

/*************************************************/
Expand Down Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion src/Objects/NoteData.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Services/ScribblyController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Views/NoteView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Views/PreferencesView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/ActionBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@

// 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);
}

/**
* Allow control of when to respect the hide-bar setting
* 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);
}
Expand All @@ -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;
}
}
8 changes: 0 additions & 8 deletions src/Windows/PreferenceWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
}
}
15 changes: 11 additions & 4 deletions src/Windows/StickyNoteWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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",
Expand Down Expand Up @@ -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);
}
}