Good improvements. And like the new user pref for different icon sets, seems really necessary
Surprised: can KM use "ico" pics in toolbars and menus now? Since which version exactly? (not yet tested myself)
Not quite clear: which of the toggles actually need a restart? Is it possible to enable/disable the adblocking during a session? Or does that only toggle the prefs, checkmarks and button, but not the plugin-function itself? And what if rules are deleted, or filled? Guess it was said something does need a restart (new rules?), but so far users get the impression all would work instantly. Probably some more info texts would help.
Noticed the kmm still contains 2 different macros to do the same: toggle the disabled-pref. 1 for toolbar and 1 for menu, only one writes log and shows statusbar. Not sure if it's intentional not to use the same toggle-macro for button + menu?
stuff - ouff... It has meanwhile gotten so chaotic, had to struggle understanding it roughly at least. For example "buildmenu" ADDs the button, then calls the "toolbar_set" macro which may REMOVE it again, then ADD it again (as dummy button) after checking if it was fired by "IcoChg".. and right afterwards may REMOVE/ADD it yet another time after checking if rules exist...
Couldn't resist to think about simplification and came up with this, just suggestion of course, your taste may vary:
- Only 1 shared and simplified macro "toolbar_set" handles ADDING the button and icon stuff alone (see below)
- "addtoolbar" remains outside, preferably called $OnSetup only
- the calling toggle-macros only change prefs and do "removebutton" then call "toolbar_set"
- The images of both icon sets are named similar (easier code for replacing)
getpref(BOOL,"kmeleon.plugins.adblock.disabled")) ? $_icon="adblockKM_disabled.png" : 0;
getpref(BOOL, "kmeleon.plugins.adblock.rules.cleared")) ? $_icon="adblockKM_dead.png" : 0;
getpref(BOOL, "kmeleon.plugins.adblock.icons.alternate" ) ? $_iconset="2.png" : $_iconset="1.ico";
# button replacement only needed for tooltip-toggle:
$_iconset=="1.ico" ? $_tooltip = "Adblock plugin ON[red]/OFF[green]" : 0;
$_iconset=="2.png" ? $_tooltip = "Adblock plugin ON[green]/OFF[red]" : 0;
getpref(BOOL, "kmeleon.plugins.adblock.rules.cleared")) ? $_tooltip="Adblock plugin INACTIVE \n no rules") : 0;
addbutton("Adblock_plugin", "macros(_Adblockplugin_toggle)", "Adblock Plugin", $_tooltip);
$_icon=""; $_iconset=""; $_tooltip="";
Yes, I've intentionally killed the &Dummy button workaround
On one hand a macro called just "&Dummy" is likely to be multi-used for different macros and toolbars, that can create bugs on toolbars (had such a case just recently again). On the other I'd rather keep the normal toggle-macro anyway, only start it with a "rules.cleared" check. If true, either have it do nothing, or better show an info-alert, or info+question (Disable now? Enable now?), or perhaps run popupmenu("Adblock Plugin")...
And always think it would be very helpful to add in the kmm-headers a link to their forum threads, at least for such more important macros...
Edited 3 time(s). Last edit at 12/26/2015 02:49PM by siria.