bleachbit / wishlist

Wishlist enhancements related to BleachBit
GNU General Public License v3.0
7 stars 1 forks source link

Trimmer for WinApp2.ini #36

Open Tobias-B-Besemer opened 5 years ago

Tobias-B-Besemer commented 5 years ago

I see different reasons to trim the WinApp2.ini file on a users PC... Now, to shorten it, lets talk about a possible solution... ;-)

I thought a lot about it and came to the conclusion, that it would be best, if each CleanerML file includes the information about which part should be trimmed on the users PC... Explained in short: Different users can have different CleanerML files and so one use (still) want to have the WinApp2.ini entries - the other no more.

First about how the BleachBit Management Part of the trimmer should look like (IMHO)... As BB already recognize when a CleanerML file gets changed, it should be possible that BB also recognize, when a file gets removed... So the WinApp2.ini should get trimmed with all rules from all "registered" CleanerML files after each update of WinApp2.ini... But, as maybe a CleanerML file can get removed again, BB should first make a backup of the complete WinApp2.ini file that gets restored when a cleaner gets missing. Then BB have to trim the restored file again with the left files. If a new cleaner gets recognized, BB have just to trim with the data from this file... ...but if a cleaner change (rules can get added and removed), BB have to restore again and trim all again... Yes, bit complicated, but this should solve all cases and all should work well in practice...

Now, the cleaner part: I stared to add to my cleaners a "Trimmer Block" at the end of the file... Basically a comment in XML... I add it at the end, but maybe others think it's better to have this blocks in the code, where the rules are written in CleanerML...

How does my "Trimmer Block" looks like, ATM: My block always starts with a line including just <!-- and ends with a line including just -->. This is for better readability, if multiple Trimmer Blocks come after each other. Beside this to lines, the keywords for BB would be at the beginning in one line Start "Trimmer Block"... and at the end, also in one line, with the keywords ...end "Trimmer Block".. The part in the middle is basically a c&p of the section and the parameters, BB should trim. One section per block. Just some parameters of a section, or all. At the top of the section in the Trimmer Block I added two more lines. One line starts with @trimmercheckedversion: followed by the version of WinApp2.ini the rules where copied from, the other line starts with @trimmercheckedby followed from the person who checked/updated last the cleaner with the rules from WA2.ini. So this two lines are for editors to know when the rules get checked last and by whom.

What BB should do with this lines by trimming: BB should now read this lines and remove from the section in WA2.ini the parameters. By this BB should ignore the numbering of the rules (FileKey1, FileKey2, FileKey3,...) because they can change. So BB should compare the value and, if it fits, remove it from WA2.ini. As maybe sections get spitted into multiple CleanerML files, BB should also check, if all usable rules get already removed from the section and if BB removes the last ones, BB should remove the rest of the section, too.

So, that was the idea I worked out in last time when I was thinking about how to get ride of this st*pid WA2.ini file... ;-)

What I already do: I copy - where it makes IMHO sense - the rules from WA2.ini into the CleanerML file, re-write the rules in CleanerML and add the Trimmer Block at the end. So over time there should have more and more cleaners this Trimmer Block...

@az0, now it's up to yours, if you like the idea and plan to implement it at any point... If you have a better idea, or a suggestion to improve my idea, I will do that! If you don't like my "Trimmer Block" and the idea of trimming WA2.ini at all, I will remove this parts from the cleaners, again!

Now I'm really interested in the feedback I get from you... ;-)

Btw.: This makes my idea #13 obsolete, so I closing this issue!

Tobias-B-Besemer commented 5 years ago

Oh! An example you can e.g. see in my latest pushes of the Google Chrome Cleaner... This was also the reason, why I come now with this wish and not later, because I started already with the Trimmer Blocks, to make development (what have I done and how) easier for me...