Giter Site home page Giter Site logo

Safer backend about sticky HOT 9 CLOSED

sonnyp avatar sonnyp commented on May 26, 2024
Safer backend

from sticky.

Comments (9)

vixalien avatar vixalien commented on May 26, 2024

thanks for the suggestions. I'll implement saving in multiple files.

I'm not sure about saving on every keystroke as it may not be desirable for SSDs (limited writes), but the limitations are too high so I'll implement it anyways...

from sticky.

sonnyp avatar sonnyp commented on May 26, 2024

It doesn't have to be on every keystroke. It could be when focus is lost. Or debounced.

from sticky.

vixalien avatar vixalien commented on May 26, 2024

how to i detect when focus is lost?

from sticky.

sonnyp avatar sonnyp commented on May 26, 2024

I would use this https://docs.gtk.org/gtk4/method.TextBuffer.set_modified.html

This is what Workbench uses in case you're looking for an example.

from sticky.

vixalien avatar vixalien commented on May 26, 2024

oh okay!

so in short, when I save the note, I'll set the modified bit to false, then when it's changed it'll emit the modified-changed signal?

from sticky.

sonnyp avatar sonnyp commented on May 26, 2024

yes! this will save on every change but wait for the async save operation to be done before calling the next one

This is what Text Editor and Builder are doing too IIRC

from sticky.

sonnyp avatar sonnyp commented on May 26, 2024

there is also a way to make Gio use a backup file before replacing

If you assign me to a PR I can have a quick look / review if you like

from sticky.

vixalien avatar vixalien commented on May 26, 2024

well I can definitely put up something like tomorrow. but if you want/can, you can create a PR

from sticky.

idoric avatar idoric commented on May 26, 2024

The app saves data on quit. This is problematic because if it crashes or if it is terminated unexpected (by user or system) - notes/changes won't be saved. My suggestion is to save changes as they happen.

Thank you for this analysis, now at least I know why I lost everything from my first day of use: I shut down my computer without manually quitting the application. Since I have a lot of applications open, the system probably terminated it.

from sticky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.