[Geany-devel] GIO file monitoring

Enrico Tröger enrico.troeger at xxxxx
Thu Oct 2 16:44:55 UTC 2008


I got file monitoring working through a GFileMonitor
(http://library.gnome.org/devel/gio/stable/GFileMonitor.html) and it
seems to work quite fine so far.

The old monitoring was simply to compare a file's mtime (modification
time) and this check was performed whenever you typed somethng in a
document, you clicked in a document or you switched to a document.

With GFileMonitor, we don't need to trigger the check anymore but
instead get informed via a callback. So the question comes up how to
handle a changed file properly.
There are two possibilities:
a) once we received a changed notification for a file, we display the
dialog box asking the user for an action to perform (reload file?).
b) when we receive a changed notification, we store it in a flag
'changed' in the GeanyDocumentPrivate struct and use this flag when
the document is active (by typing, clicking, switching as above)

a) could be get annoying when there are files opened which changes
often for whatever reason and the user is currently editing any other
file and then gets a dialog box asking to reload another opened file.
In other words, this would inform the user also when not the current
document changes but another document.

b) represents the current behaviour just with a different 'backend',
i.e. the user gets informed about a changed file *only* if this file is
the current document.

I'd prefer b) to keep the current behaviour and not getting annoyed by
dialog boxes for 'inactive' files. We would still have the advantage
that the user get the changed notification directly without any delay
for the current active document.

While writing, I'm thinking of a third possibility, or better an
addition to possibility b):
when an inactive document has changed, we change it's tab label colour
to yellow or orange and when the user switches to this document, i.e.
make it active, the dialog box is presented asking to reload.

What do you think?


Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20081002/3921fecb/attachment.pgp>

More information about the Devel mailing list