[parted-devel] Patch to add undo/redo functionality to libparted

Vanni Brutto partedml at gmail.com
Tue Nov 7 15:37:00 CET 2006


Hi,

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...

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! ;)

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.

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)...

You can play with rm and mkpart, undo and the changes will be committed only
when you give "apply" command in parted...


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...

That's all,

regards,

Vanni Brutto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20061107/9052a7d9/attachment.html


More information about the parted-devel mailing list