You're right.. Its not ideal that the document would change while saving, but what's the harm? If we're talking about background saves, you're general concerned with precautionary actions above anything else. If the user gets to a point where he can perform an explicit save, than he can be assured of being completely in-sync at that time.
The document-saver looks okay, but can I use it in isolation from the current document and its state? I think this is what you were referring to by "reusable", but, from what you said, it doesn't sound as if it's currently usable in that capacity.
Dustin
On Sun, Oct 27, 2013 at 08:17:09AM -0400, Dustin Oprea wrote:
> The question is about how to iteratively read lines of text from the
> document. Do you have experience with this?
Line by line is a good choice. But if you don't want to block the UI (by
running the "save as" in an idle loop, chunk by chunk, for example), the
document can be modified during the save. It's simpler to save
synchronously, so the document can not be modified.
If you want to take into account the encoding, the line ending type and
some other flags, you will end up with the gedit document saver:
https://git.gnome.org/browse/gedit/tree/gedit/gedit-document-saver.h
A plan is to make the document loader and saver reusable. For example by
moving the code in GtkSourceView. The API must be a little modified
(e.g. to support your use case).
> As to your particular answer, I am saving through alternate means because I
> am not allowed [in my use-case] to induce any changes or side-effects to
> the current location.
You can save the location before the "save as", and then restore the
location, but I agree it's not fantastic.
Hope this helps,
Sébastien
_______________________________________________
gedit-list mailing list
gedit-list gnome org
https://mail.gnome.org/mailman/listinfo/gedit-list