Hi,<br><br>i'm the author of the (bad ;)) undo/apply patch kindly posted by Leslie. Just few words about that patch... i'm the author of QTParted, inside that software i used the same way for made Undo/Apply, however i think that with Parted
2.0 and the decision of move inside util.[hc] api the "macro partitioning function" it is time to study how to integrate this stuff inside libparted...<br><br>The main reason is that when the "macro function" will be inside util.* it will be much difficult to implement in a GUI all this without rewrite a lot of code of libparted... and this is evil! ;)
<br><br>With this patch i want just show you that with very few code it is possible to port undo/apply inside libparted (of course i'm talking of libparted 2.0, 'cause i will break binary compatibility of some structures like PedDevice)... the trick is to make a "list of PedDisk", after every operation i will made a clone of the Disk... just to save every "state" first and after an operation. When you undo i just delete the last disk... when you apply... i will commit the operation saved in the list.
<br><br>In that patch i wrote the code only for "rm" and "mkpart", inside QTParted i wrote the code also for "resize", "move" and other common operation... but just to show you how it work i
patched only rm and mkpart (so in my patched version the other function of parted are broken)...<br><br>You can play with rm and mkpart, undo and the changes will be committed only when you give "apply" command in parted...
<br><br><br>Of course the list of operation is not well implemented, my implementation was done in a hurry, but if you think that it is interesting i will join your team and i'll start to work about this stuff...<br><br>That's all,
<br><br>regards,<br><br>Vanni Brutto<br>