View Bug Report
Duplicate entryies of Addons Settings
Bug #: 842
File: LibAddonMenu-2.0
Date: 06/13/14 03:44 PM
By: Garkin
Status: Fixed
it seems that you can have more than one Addon Settings in the settings menu:


It was reported by Enigma in comments to my LoreBooks addon. http://www.esoui.com/downloads/fileinfo.php?id=288#comments
I will try to find out more, but tomorrow. You know, its friday night...

RSS 2.0 Feed for Bug CommentsNotes Sort Options
By: Garkin - 06/13/14 05:48 PM
I was able to reproduce this issue if I use addon with LAM-2.0 r2 - for example install Lost Treasure v1.10.

I'm not sure if you really want to fix it or if author should update library...
By: Seerah - 06/13/14 10:24 PM
No, it needed to be fixed. Thanks!
By: Garkin - 06/14/14 06:47 AM
The fix does not work for me:

As you can see, there are still two "Addons Settings" entries. Zgoo shows which version of LAM is loaded.
By: Garkin - 06/14/14 08:29 AM
This works:

lua Code:
  1. --INTERNAL FUNCTION
  2. --creates LAM's Addon Settings panel
  3. local function CreateAddonSettingsPanel()
  4.    local controlPanelID = "LAM_ADDON_SETTINGS_PANEL"
  5.    local controlPanelNames = {en = "Addon Settings", fr = "Réglages d'Extension", de = "Erweiterungseinstellungen"}
  6.    local controlPanelName = controlPanelNames[GetCVar("Language.2")]
  7.  
  8.    --new installation, oldminor does not exists
  9.    if oldminor == nil then
  10.       ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelName)
  11.       lam.panelID = _G[controlPanelID]
  12.       ZO_PreHook("ZO_OptionsWindow_ChangePanels", HandlePanelSwitching)
  13.    --library update, checks if updated library was older then 7. Newer versions won't need any hooks.
  14.    elseif oldminor < 7 then
  15.       local counter
  16.       ZO_PreHook(ZO_GameMenuManager, "SubmitLists", function() counter = 0 end)
  17.       ZO_PreHook(ZO_GameMenuManager, "AddEntry",
  18.          function(self, data, ...)
  19.             --skip headers
  20.             if not (data.categoryName and self.headerControls[data.categoryName]) then return end
  21.             counter = counter + 1
  22.             --versions r1-5 had entry name in english
  23.             if data.name == controlPanelNames.en then
  24.                --skip duplicate entries (return true means that hook does not call original function)
  25.                if lam.panelID ~= counter then
  26.                   return true        
  27.                else
  28.                   --change entry name to the localized name  
  29.                   data.name = controlPanelName
  30.                end
  31.             end
  32.          end)
  33.    end
  34. end
By: Seerah - 06/14/14 09:39 PM
Bah - what is wrong with me lately? Of course it doesn't work. The old versions don't have that check. /sigh...

Anyway, I don't want all that hackish code in there - I'd rather authors just update LAM now.

So it was both - it needed to be fixed, *and* authors need to update.