Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
[refactoring] More _private names where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
futpib committed Feb 1, 2015
1 parent 4085007 commit 6115550
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
30 changes: 15 additions & 15 deletions src/lib/ui/popup.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1120,18 +1120,18 @@ prefs.define AUTORELOAD_PREF = 'ui.popup.autoReloadPageOnHiding',
exports.popup = popup =
id: 'policeman-popup'

styleURI: Services.io.newURI 'chrome://policeman/skin/popup.css', null, null
_styleURI: 'chrome://policeman/skin/popup.css'

init: ->
@addUI(w) for w in windows.list
windows.onOpen.add @addUI.bind @
windows.onClose.add @removeUI.bind @
onShutdown.add => @removeUI(w) for w in windows.list
@_addUI(w) for w in windows.list
windows.onOpen.add @_addUI.bind @
windows.onClose.add @_removeUI.bind @
onShutdown.add => @_removeUI(w) for w in windows.list

tabs.onSelect.add (t) =>
if @_visible
@cleanupUI t.ownerDocument
@updateUI t.ownerDocument
@_cleanupUI t.ownerDocument
@_updateUI t.ownerDocument

originSelection.onSelection.add (btn) ->
destinationSelection.update btn.ownerDocument
Expand Down Expand Up @@ -1161,17 +1161,17 @@ exports.popup = popup =
onShowing: (e) ->
doc = e.currentTarget.ownerDocument
@autoreload.onShowing doc
@updateUI doc
@_updateUI doc
@_visible = true

onHiding: (e) ->
doc = e.currentTarget.ownerDocument
@cleanupUI doc
@_cleanupUI doc
if @autoreload.enabled() and @autoreload.required()
tabs.reload tabs.getCurrent()
@_visible = false

addUI: (win) ->
_addUI: (win) ->
doc = win.document
loadOverlay doc, 'chrome://policeman/content/popup.xul', =>
panel = doc.getElementById @id
Expand All @@ -1180,21 +1180,21 @@ exports.popup = popup =
# just after it's hidden
panel.addEventListener 'popuphidden', @onHiding.bind @

loadSheet doc.defaultView, @styleURI
loadSheet doc.defaultView, @_styleURI

removeUI: (win) ->
_removeUI: (win) ->
doc = win.document
removeNode doc.getElementById @id
removeSheet doc.defaultView, @styleURI
removeSheet doc.defaultView, @_styleURI

updateUI: (doc) ->
_updateUI: (doc) ->
originSelection.update doc
footerCheckButtons.update doc
footerLinkButtons.update doc

statusIndicator.updateFinished doc

cleanupUI: (doc) ->
_cleanupUI: (doc) ->
destinationSelection.purge doc
rejectedFilter.purge doc
allowedFilter.purge doc
Expand Down
22 changes: 11 additions & 11 deletions src/lib/ui/toolbarbutton.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@
exports.toolbarbutton = toolbarbutton = new class
id: 'policeman-toolbarbutton'

styleURI: Services.io.newURI 'chrome://policeman/skin/toolbar.css', null, null
_styleURI: 'chrome://policeman/skin/toolbar.css'

constructor: ->
@wrapper = CustomizableUI.createWidget
id: @id
type: 'custom'
defaultArea: CustomizableUI.AREA_NAVBAR
onBuild: @onBuild.bind @
onBuild: @_onBuild.bind @
onShutdown.add => CustomizableUI.destroyWidget @id

@addUI(w) for w in windows.list
windows.onOpen.add @addUI.bind @
windows.onClose.add @removeUI.bind @
onShutdown.add => @removeUI(w) for w in windows.list
@_addUI(w) for w in windows.list
windows.onOpen.add @_addUI.bind @
windows.onClose.add @_removeUI.bind @
onShutdown.add => @_removeUI(w) for w in windows.list

_getAreaTypeSpecificWidget: (areaType=@wrapper.areaType) ->
if areaType == CustomizableUI.TYPE_MENU_PANEL
Expand All @@ -50,7 +50,7 @@ exports.toolbarbutton = toolbarbutton = new class
BUTTON_LEFT = 0
BUTTON_MIDDLE = 1
BUTTON_RIGHT = 2
onBuild: (doc) ->
_onBuild: (doc) ->
btn = createElement doc, 'toolbarbutton',
id: @id
class: 'toolbarbutton-1 chromeclass-toolbar-additional'
Expand All @@ -70,11 +70,11 @@ exports.toolbarbutton = toolbarbutton = new class

return btn

addUI: (win) ->
loadSheet win, @styleURI
_addUI: (win) ->
loadSheet win, @_styleURI

removeUI: (win) ->
removeSheet win, @styleURI
_removeUI: (win) ->
removeSheet win, @_styleURI

indicator: new class
constructor: ->
Expand Down

0 comments on commit 6115550

Please sign in to comment.