diff gui.lua @ 87:9fea75b0927b

If deleting a history entry results in an empty player table, remove that as well. Change g_uniques to store player's name rather than index as the history field, and indirect through the byname table.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 22 Jun 2012 00:58:59 +0000
parents 703bbe61d12d
children c9f955f9a285
line wrap: on
line diff
--- a/gui.lua	Thu Jun 21 21:14:24 2012 +0000
+++ b/gui.lua	Fri Jun 22 00:58:59 2012 +0000
@@ -395,7 +395,6 @@
 		for pi,player in ipairs(self.history) do
 			local col1 = new()
 			col1.OLi   = pi
-			col1.OLn   = #player
 			col1.value = player.name   -- may spiffy this up in future
 
 			for li,unique in ipairs(player.unique) do
@@ -1503,18 +1502,23 @@
 end
 
 hist_dropdownfuncs = dropdownfuncs{
-	["Delete this loot event from history"] = function(rowi)
+	["Delete this loot event from history"] = function()--rowi
 		local h = _d:GetUserData("DD history entry")
-		local okay,err = addon:_delHistoryEntry (h.cols[2].OLu, h.itemlink)
-		if okay then
+		local numleft,err = addon:_delHistoryEntry (h.cols[2].OLu, h.itemlink)
+		if numleft then
 			addon:Print("Removed history entry %s from %s.",
 				h.itemlink, addon:colorize(h.OLwho,h.OLclass))
+			if numleft < 1 then
+				history_filter_who = nil
+				_d:GetUserData("histST"):SetFilter(history_filter_by_recent)
+				setstatus(hist_normal_status)
+			end
 		else
 			addon:Print(err)
 		end
 	end,
 
-	["Delete this player's entire loot history"] = function(rowi)
+	["Delete this player's entire loot history"] = function()--rowi
 		local h = _d:GetUserData("DD history entry")
 		local name = h.OLwho
 		local player_i = addon.history.byname[name]