changeset 98:b5a55c69ef67

Properly switch between profiles.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 27 Jul 2012 19:09:29 +0000
parents ba5ff82dcf19
children 966d06c8d9c9
files core.lua gui.lua options.lua
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core.lua	Fri Jul 27 10:23:12 2012 +0000
+++ b/core.lua	Fri Jul 27 19:09:29 2012 +0000
@@ -698,6 +698,10 @@
 
 
 ------ Ace3 framework stuff
+function addon:DBProfileRefresh()
+	opts = self.db.profile
+end
+
 function addon:OnInitialize()
 	if self.author_debug then
 		_G.OL = self
@@ -728,7 +732,10 @@
 	end
 	self.db = _G.LibStub("AceDB-3.0"):New("OuroLootOptsDB",
 		{ profile = option_defaults } , --[[Default=]]true)
-	opts = self.db.profile
+	self.db.RegisterCallback (self, "OnProfileChanged", "DBProfileRefresh")
+	self.db.RegisterCallback (self, "OnProfileCopied", "DBProfileRefresh")
+	self.db.RegisterCallback (self, "OnProfileReset", "DBProfileRefresh")
+	self:DBProfileRefresh()
 
 	--[[
 	local stored_datarev = opts.datarev or 14
--- a/gui.lua	Fri Jul 27 10:23:12 2012 +0000
+++ b/gui.lua	Fri Jul 27 19:09:29 2012 +0000
@@ -1904,6 +1904,7 @@
 tabs_OnGroupSelected_func = function (tabs,event,group)
 	tabs_OnGroupSelected_func_args[1] = tabs
 	tabs_OnGroupSelected_func_args[3] = group
+	gui.opts = addon.db.profile
 	hide_noobtips_frame()
 	tabs:ReleaseChildren()
 	local spec = tabs:GetUserData("special buttons group")
--- a/options.lua	Fri Jul 27 10:23:12 2012 +0000
+++ b/options.lua	Fri Jul 27 19:09:29 2012 +0000
@@ -703,6 +703,7 @@
 
 -- Clicking an entry on the left tree column.
 local opt_OnGroupSelected_func = function (treeg,event,category)
+	opts = addon.db.profile
 	local catfuncs = controls[category]
 	if not catfuncs then
 		addon:horrible_horrible_error(("Category '%s' has no handler function!"):format(category:gsub('\001','_')))
@@ -730,8 +731,6 @@
 
 -- Clicking the Options tab as a whole (tabs_OnGroupSelected["opt"]).
 local tabs_OGS = function (container, specials)
-	opts = gui.opts
-
 	container:SetLayout("Fill")
 	local left = AceGUI:Create("TreeGroup")
 	left:SetStatusTable(status_for_select)