[Geany-devel] Session Management Interim Solution Proposal
Matthew Brush
mbrush at xxxxx
Sun Jan 1 00:33:59 UTC 2012
On 12/31/2011 03:27 PM, Lex Trotman wrote:
> Hi All,
>
> Seasons greetings to all.
>
> New year new idea.
>
> Since Gnome seems to have irretrievably broken X session management it
> does not seem likely that proper session management will be solved in
> the near term. Sadly this seems to waste all the good work that the
> guys put into the SM branch, thanks for the effort.
>
> I am going to suggest an interim change to Geany that will at least
> mean that it will re-start with the same main settings and
> preferences. Actually two options.
>
> 1. Although I have argued against it in the past, having all settings
> save on change would at least ensure that a Geany killed by logout or
> shutdown will still restart with preference/session changes intact, or
>
It's not too bad actually, I've done it before, just keep a callback
handler that runs when the machine is idle, then you'll just get a
little blip here and there of activity on the disk and CPU. Something like:
static void on_idle_save(gpointer user_data)
{
/* Write out to disk here */
g_file_replace_contents[_async] (...);
}
/* Call this whenever settings change */
void queue_config_save(void)
{
static guint id = 0;
if (id > 0)
g_source_remove(id);
id = g_idle_add_full(on_idle_save, G_PRIORITY_LOW, NULL, NULL);
}
I don't think you'd notice any performance hit unless your config files
were on another computer or floppy disk or something. If the GIO async
functions are used, I don't think even that would matter since it'd run
in another non-GUI thread.
> 2. add a user action to save preferences/session.
>
Meh, this shouldn't be something a user should have to care about IMO.
> My problems with 1. are the performance impact of writing the session
> file list every time a file is opened, closed or tabs re-ordered and
> the risk of corruption that that increase in file activity causes
> (especially with multiple instances).
>
It'd definitively need to be tested, maybe doing something to ensure the
file access is particularly slow (like on a samba share or something)
while testing. I think the GLib/GIO file saving functions are "atomic"
so there shouldn't be too much issue with multiple instances writing to
the same file.
I guess all this trouble is why GNOME applications are heading towards
GSettings and such.
Cheers,
Matthew Brush
> My problem with 2. is I will forget to do it.
>
> Perhaps a mixed solution of preferences always saved, but session only
> when the user asks is the way to go.
>
> Any thoughts and suggestions?
>
> Cheers
> Lex
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
More information about the Devel
mailing list