Re: [gedit-list] File loading and saving in GtkSourceView



On Sat, Dec 14, 2013 at 02:37:17PM +0100, Sébastien Wilmet wrote:
With the GIO conventions, there is by nature more flexibility than the 
signals system in GeditDocument. With the async functions, it is 
possible to call the save or load function while a previous call is not 
finished. For example the user clicks two times on the save button (if 
the sensitivity is not updated). The desirable flexibility: parallel 
loading into several buffers, from one or several files; parallel saving 
into several files, from one or several buffers. The desirable 
restrictions: (1) at most one load at a time per buffer, (2) at most one 
save at a time per file.

The GIO conventions allow the two restrictions. For the first one, it is 
possible to cancel the operation. If load_async() is called two times, 
the second cancels the first one. I think it is better to cancel the 
first one because the reason for calling load_async() a second time may 
be to fix a property (encoding, newline-type, etc). The second call has 
more chances to be the correct one.

Well, GeditDocument also allows to call save(), save_as() or load() 
while a same operation is still running. But gedit cancels the second:

In gedit_document_save_real() (the default handler of the save signal), 
there is:
g_return_if_fail (doc->priv->saver == NULL);

Anyway cancelling the first one or the second one is something we can 
change easily.

Cheers,
Sébastien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]