diff --git a/data/Application.css b/data/Application.css index c3526ebe..2ae2cb89 100644 --- a/data/Application.css +++ b/data/Application.css @@ -156,6 +156,25 @@ window.animated actionbar image { transition: color 750ms cubic-bezier(0.4, 0, 0.2, 1); } +@media (prefers-reduced-motion: reduce) { + window.animated, + window.animated overshoot, + window.animated undershoot { + transition: none; + } + + window.animated textview, + window.animated textview text, + window.animated headertitle, + window.animated actionbar, + window.animated actionbar .themedbutton:hover, + window.animated actionbar .themedbutton:focus, + window.animated editablelabel, + window.animated actionbar image { + transition: none; + } +} + /* Devel builds get these. Libadwaita has that too, but we do not use it. */ window.devel { diff --git a/io.github.elly_code.jorts.devel.yml b/io.github.elly_code.jorts.devel.yml index 658bc759..a0a7db82 100644 --- a/io.github.elly_code.jorts.devel.yml +++ b/io.github.elly_code.jorts.devel.yml @@ -6,7 +6,7 @@ id: io.github.elly_code.jorts.devel base: io.elementary.BaseApp base-version: 'circe-25.08' runtime: org.gnome.Platform -runtime-version: '49' +runtime-version: 'master' sdk: org.gnome.Sdk command: io.github.elly_code.jorts.devel diff --git a/src/Services/NoteManager.vala b/src/Services/NoteManager.vala index 5e62d6cf..d2e62ef5 100644 --- a/src/Services/NoteManager.vala +++ b/src/Services/NoteManager.vala @@ -74,8 +74,6 @@ public class Jorts.NoteManager : Object { } saving_lock = false; - on_reduceanimation_changed (); - Gtk.Settings.get_default ().notify["enable-animations"].connect (on_reduceanimation_changed); } /*************************************************/ @@ -156,28 +154,6 @@ public class Jorts.NoteManager : Object { storage.save (array); } - /*************************************************/ - /** - * Handler to add or remove CSS animations from all active notes - */ - public void on_reduceanimation_changed () { - debug ("Reduce animation changed!"); - - if (Gtk.Settings.get_default ().gtk_enable_animations) { - foreach (var window in open_notes) { - window.add_css_class ("animated"); - } - - } else { - foreach (var window in open_notes) { - // If we remove without checking we get a critical - if ("animated" in window.css_classes) { - window.remove_css_class ("animated"); - } - } - } - } - public void action_new () { debug ("New Note"); create_note (); diff --git a/src/Windows/StickyNoteWindow.vala b/src/Windows/StickyNoteWindow.vala index 8e7dcb2f..8e30b90c 100644 --- a/src/Windows/StickyNoteWindow.vala +++ b/src/Windows/StickyNoteWindow.vala @@ -83,6 +83,8 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow { add_css_class (STYLE_DEVEL); #endif + save_state.connect (on_save_state); + restore_state.connect (on_restore_state); /***************************************************/ /* CONNECTS AND BINDS */ @@ -194,4 +196,23 @@ public class Jorts.StickyNoteWindow : Gtk.ApplicationWindow { application.activate_action (NoteManager.ACTION_SAVE, null); } private void action_delete () {((Jorts.Application)this.application).note_manager.delete_note (this); this.destroy ();} + + private bool on_save_state (VariantDict state) { + state.insert_value ("title", new GLib.Variant ("s", data.title)); + state.insert_value ("content", new GLib.Variant ("s", data.content)); + state.insert_value ("color", new GLib.Variant ("s", data.theme.to_string ())); + state.insert_value ("mono", new GLib.Variant ("s", data.monospace.to_string ())); + state.insert_value ("zoom", new GLib.Variant ("s", data.zoom.to_string ())); + return false; + } + + // Check what we can save + private bool on_restore_state (VariantDict state) { + var title_v = state.lookup_value ("title", GLib.VariantType.STRING); + print ("\n" + title_v.get_string ()); + + return true; + } + + } diff --git a/src/meson.build b/src/meson.build index 7e5e2547..2fc9632b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -10,11 +10,11 @@ config_file = configure_file( #================================ dependencies = [ - dependency('gtk4'), + dependency('gtk4', version: '>=4.23'), dependency('granite-7', version: '>=7.6.0'), dependency('gee-0.8'), dependency('gobject-2.0'), - dependency('json-glib-1.0'), + dependency('json-glib-1.0') ] #================================