[Geany-devel] Multiple instances of Geany issues

Eugene Arshinov earshinov at xxxxx
Mon May 31 09:35:26 UTC 2010


Just to mention, I ported to my SM branch the patches posted earlier in
this thread.

Also, I've changed the code to write changed recent files and projects
lists to geany.conf as soon as possible instead of writing them on
exit.  It is a good addition to "dialog_prefs" and "filetypes" patches
and allows several instances to combine their recent lists.  If someone
is interested in porting these changes to master, I'll extract the
corresponding patches and post them here.  Details of implementation
are given below.

After this one problem remains: handling of a project opened in several
instances.  It could be easy to apply "immediate save" technique for
them too if we hadn't to maintain list of project's files.  How should
lists of files from several instances be combined?

--- Details about recent lists ---

Basically, each instance maintains its own recent lists and displays
them in menus.  When a recent list is updated, corresponding items are
appended to menus and (as soon as possible) updates are written to
geany.conf.  In geany.conf the updates are combined with files which
are already there (but those files aren't appended to menus).
According to this scheme, in a menu user sees which files he previously
opened/reloaded/etc. *in this instance*, while in geany.conf we have
files previously opened/reloaded/etc. *globally*.

In order to implement it I changed the way how `ui_prefs.recent_queue'
and `ui_prefs.recent_projects_queue' are used.  To combine updates in
geany.conf properly it's necessary to remember which elements of the
queues were already written and which weren't.  I chose to simply clear
the queue after an update, i.e. now the queues store file names which
weren't yet written to geany.conf.  Other option could be to use two
queues instead of each one, or to use a special marker (say, NULL) to
split a queue into two parts.  I preferred the accepted way because
files already written to geany.conf are stored in menus and there is
basically no point in keeping them in a queue too.

There is one trouble with recent lists.  In contrast to dialog
preferences or filetypes, they can change frequently, so it can be
tricky to do necessary updates of geany.conf as rarely as possible.  To
support it, there is a boolean argument of ui_add_recent_file() and
configuration_save_recent_files() function which are used, for
example, when lots of files are opened in cycle.

On my way, I introduced a separate queue for recently closed file.  Now
"Open last closed tab" works more reliably.

Best regards,

More information about the Devel mailing list