What an eventful month! Lots of code have been read, produced, reviewed and refused, several code designs have been proposed, but as everything was work in progress, I didn’t fell it was exciting enough to blog about it at that time.
But here it is! The blog post that explains it all.
Multiple displays per machine
I mostly spent the third week trying to have multiple displays for a SPICE machine, which implied reading a lot virt-manager’s code and some of spice-gtk’s code.
I achieved to get the maximum number of displays available for a machine and, with Christophe Fergeau’s help, to get some good results: we were able to have multiple displays each in its own window, but we were not able to open them up from Boxes yet (the session had to have them already opened).
Jakub Steiner proposed a design focusing mainly on having multiple machines running side by side in different windows:
It settled what idea would be implemented, and a new bug report have been created to reflect that.
The window singleton
The main problem that have been encountered is that Boxes uses a static window instance that is accessed directly by a huge number of classes.
It is very problematic, as if you summon a second instance of this window’s class, any action in the second window will have its reactions produced not on itself but on the static window instance, which is conceivably problematic who you want to implement a multi window feature.
Zeeshan proposed not to change the app’s design to allow having multiple windows but to have multiple one window instances communicating via D-Bus. It have its pros, as it would make Boxes more resistant to crashes, to slowdowns and to be be naturally more parallelized, but the design would most certainly have ended up being a gigantic mishmash.
This idea have been abandoned in favor of a code refactoring.
Getting rid of the window singleton
In Boxes’ design, the app’s controller is scattered over all the classes. In my opinion it is problematic:
- you can’t use a class in any different way without changing the class’ code
- changing a simple behaviour may require modifying lots of classes
- you can’t have a good overview of the application’s behaviour which may confuse newcomers I spent several weeks refactoring the app, trying to move the controller closer to the root of the composition tree by using signals to make the leaf classes dumber but more modular. It worked pretty well and Lasse, which reviewed my patches, and I were pretty proud of the newly produced code and design.
At the time when the code started to take shape, unfortunately, Zeeshan had harware failures which made him not able to check out our work. Because of that, we knew quite lately that he preferred the code to stay as close as possible from the actual design, changing as less code as possible in the process. It is pretty wise, as he haves to maintain the application, and so I started over with these considerations.
So far the last set of refactoring patches are well received, all they need is a little bit of polish to fully shine!
It’s now the time of GUADEC, here I’ll be able to chat with my colleagues and to meet other gnomes! If everything go as planned, the patches will be merged during this period, and I’ll be able to actually implement the multi window feature after that!