Skip to content

search-engines-listbox: Move from in-code UI to UI files

Currently all this listbox and child search engine rows are built using code packed in an enormous function. This makes it hard to make any adjustment, and will make it harder to migrate to GTK4 later on.

So this commit separates the list box handling and UI from the rows one, migrating both to UI files and enabling greater simplification of the code.


There's currently a limitation in terms of performance when typing some text in the row entries because it now saves into the search engines manager on each typed character (which means disk write synchronously, freezing the UI). This is because the previous approach of only saving when the entry loses focus had some serious race conditions when you changed the text of a field and tried straight away (with the cursor in the entry just before) to click the remove button, to change the default engine, or to close the preferences window. It also needlessly complicated the code because I had to check if X entry was invalid/valid, mixing saved name and latest valid name everywhere… a real mess. So there's multiple possible solutions:

  • only save after a timeout when you stop typing, which has the same problems as the lose focus solution in terms of complexity
  • wrap the disk saving into g_idle_add so it doesn't freeze the UI anymore (because gsettings doesn't provide async IO functions, only synchronous IO)
  • something else ?

Merge request reports