Skip to content
Closed
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
19 changes: 19 additions & 0 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion io.github.elly_code.jorts.devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 0 additions & 24 deletions src/Services/NoteManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*************************************************/
Expand Down Expand Up @@ -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 ();
Expand Down
21 changes: 21 additions & 0 deletions src/Windows/StickyNoteWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}


}
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
]

#================================
Expand Down