rename ReaderMenu:addToMainMenuCallback to registerToMainMenu

since we are actully inserting widgets, not callbacks
This commit is contained in:
Qingping Hou
2012-12-15 09:30:48 +08:00
parent 5b6558383d
commit dbd27cd600
4 changed files with 11 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ function ReaderFont:init()
})
face_list[k] = {text = v}
end
self.ui.menu:addToMainMenuCallback(self)
self.ui.menu:registerToMainMenu(self)
end
function ReaderFont:onSetDimensions(dimen)

View File

@@ -107,7 +107,7 @@ end
function ReaderMenu:onCloseDocument()
end
function ReaderMenu:addToMainMenuCallback(widget)
function ReaderMenu:registerToMainMenu(widget)
table.insert(self.registered_widgets, widget)
end

View File

@@ -49,6 +49,10 @@ ReaderZooming = InputContainer:new{
rotation = 0
}
function ReaderZooming:init()
self.ui.menu:registerToMainMenu(self)
end
function ReaderZooming:onReadSettings(config)
-- @TODO config file from old code base uses globalzoom_mode
-- instead of zoom_mode, we need to handle this imcompatibility

View File

@@ -67,6 +67,8 @@ function ReaderUI:init()
view = self[1],
ui = self
}
self.menu = self[4] -- hold reference to menu widget
if self.document.info.has_pages then
-- for page specific controller
@@ -126,9 +128,10 @@ function ReaderUI:onClose()
DEBUG("closing reader")
self:handleEvent(Event:new("CloseDocument"))
self.doc_settings:flush()
if self.document then
if self.document ~= nil then
self.document:close()
self.document = false
self.document = nil
self.start_pos = nil
end
UIManager:close(self.dialog)
return true