As you said here, you want to make two lists:

Just to be clear about something, the document is the in memory object, the file is the thing on disk.

For open documents where the file has changed on disk, you want a list where the document has unsaved changes, and a list where it does not, lets call them unsaved list and unchanged list.

AFAICT the algorithm to do that is simply:

for d in all open documents
    if document_check_disk_status(d) 
         if d->changed add d to the unsaved list
        else add d to unchanged list

You MUST call document_check_disk_status() for all open documents to get up to date status, do not try to use existing monitoring states, they are created by a timer, so you have no idea how old they are and they may not reflect the current file state. But doc->changed is the correct thing to indicate the document has been modified.

Then if the either list is not empty go to the GUI and show the lists, its fine if one is empty, but do not go to the GUI if there is nothing to reload. If the response is cancel then do nothing, if the response is reload only unchanged then iterate the unchanged list only and reload those documents, if the response is reload all then iterate both lists and reload those documents, if the response is overwrite all then iterate both lists and save the buffers (I guess thats what you meant by "overwrite", maybe that needs more discussion if its a good idea).


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/issues/3711/1848379349@github.com>