Quantcast

Don't restore deleted widgets

Scott Sibley [09-21-10 - 22:55]
Don't restore deleted widgets
Filename
Modules/Bars.lua
Modules/Histograms.lua
Modules/Text.lua
diff --git a/Modules/Bars.lua b/Modules/Bars.lua
index 939e4e0..2251029 100644
--- a/Modules/Bars.lua
+++ b/Modules/Bars.lua
@@ -304,9 +304,16 @@ function mod:ReInit()
 					end
 				end
 				v.tagged = true
+				v.deleted = vv.deleted
 			end
 		end
 	end
+
+	for k, v in pairs(defaultWidgets) do
+		if not v.tagged and not v.deleted then
+			self.db.profile.bars[k] = copy(v)
+		end
+	end
 end

 function mod:OnInitialize()
@@ -314,12 +321,6 @@ function mod:OnInitialize()

 	self:ReInit()

-	for k, v in pairs(defaultWidgets) do
-		if not v.tagged and not v.deleted then
-			self.db.profile.bars[k] = copy(v)
-		end
-	end
-
 	self.core = LibCore:New(mod, environment, "StarTip.Bars", {["StarTip.Bars"] = {}}, nil, StarTip.db.profile.errorLevel)

 	StarTip:SetOptionsDisabled(options, true)
diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua
index 9333dd6..a8782c0 100644
--- a/Modules/Histograms.lua
+++ b/Modules/Histograms.lua
@@ -342,13 +342,6 @@ function mod:ReInit()
 		self.db.profile.histograms = {}
 	end

-	for k in pairs(self.db.profile.histograms) do
-		if type(k) == "string" then
-			wipe(self.db.profile.histograms)
-			break
-		end
-	end
-
 	for i, v in ipairs(defaultWidgets) do
 		for j, vv in ipairs(self.db.profile.histograms) do
 			if v.name == vv.name and not vv.custom then
@@ -358,6 +351,7 @@ function mod:ReInit()
 					end
 				end
 				v.tagged = true
+				v.deleted = vv.deleted
 			end
 		end
 	end
@@ -372,7 +366,7 @@ end
 function mod:OnInitialize()
 	self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults)

-	--self:ReInit()
+	self:ReInit()

 	self.core = LibCore:New(mod, environment, "StarTip.Histograms", {["StarTip.Histograms"] = {}}, nil, StarTip.db.profile.errorLevel)

diff --git a/Modules/Text.lua b/Modules/Text.lua
index 9bad1e3..6f5e370 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -443,6 +443,7 @@ function mod:ReInit()
 					end
 				end
 				v.tagged = true
+				v.deleted = vv.deleted
 			end
 		end
 	end