Skip to content
Commit 9876f295 authored by Sébastien Wilmet's avatar Sébastien Wilmet
Browse files

Revert "FileLoader: call gtk_text_buffer_set_modified()"

This reverts commit db7a028d.

To follow the least surprise principle, it's better to always do the
same thing, that is, set the modified bit to FALSE after a file loading.
The FileLoader thus resets the buffer with a certain (unmodified)
content.

The rationale behind the commit was to have good defaults for the most
common cases. That is, when loading from a GFile, the contents is
usually stored on disk and we can mark the buffer in a "saved/safe"
state (i.e. not modified). On the other hand when loading from a
GInputStream, the common case is for stdin, in which case the app
doesn't know if the contents is stored on disk or not, so it's better to
set the buffer as modified to avoid data loss (when closing the buffer
the user will typically get a dialog window asking for saving the
content). So the idea was to explain in the docs that when loading from
a GInputStream, the app must explicitly acknowledge that the buffer is
in a saved state, while loading from a GFile the reverse must be done if
the GFile is a temporary file. So the idea was to make the good way the
easy way, by default the app would have nothing to do, it would just
work.

Anyway, even if it was not documented that
gtk_text_buffer_set_modified(false) was called, changing that can be
seen as an API break. The set_modified() was not part of the "interface"
(the I in API), it was an implementation detail, so that's why the
change can also be seen as acceptable. In an API, everything that is not
documented can be considered as "undefined behavior".
parent 2163ae57
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment