readerui(chore): rename _running_instance

pull/2004/head
Qingping Hou 8 years ago
parent 068cefe8fc
commit 2cf4e77ae5

@ -356,12 +356,12 @@ function ReaderUI:showReader(file)
end) end)
end end
local running_instance = nil local _running_instance = nil
function ReaderUI:doShowReader(file) function ReaderUI:doShowReader(file)
dbg("opening file", file) dbg("opening file", file)
-- keep only one instance running -- keep only one instance running
if running_instance then if _running_instance then
running_instance:onClose() _running_instance:onClose()
end end
local document = DocumentRegistry:openDocument(file) local document = DocumentRegistry:openDocument(file)
if not document then if not document then
@ -388,11 +388,11 @@ function ReaderUI:doShowReader(file)
document = document, document = document,
} }
UIManager:show(reader) UIManager:show(reader)
running_instance = reader _running_instance = reader
end end
function ReaderUI:_getRunningInstance() function ReaderUI:_getRunningInstance()
return running_instance return _running_instance
end end
function ReaderUI:unlockDocumentWithPassword(document, try_again) function ReaderUI:unlockDocumentWithPassword(document, try_again)
@ -493,8 +493,8 @@ function ReaderUI:onClose()
UIManager:close(self.dialog, "full") UIManager:close(self.dialog, "full")
-- serialize last used items for later launch -- serialize last used items for later launch
Cache:serialize() Cache:serialize()
if running_instance == self then if _running_instance == self then
running_instance = nil _running_instance = nil
end end
return true return true
end end

Loading…
Cancel
Save