mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Initialize status
This also fixes an occasional crash seen on quitting the app.
This commit is contained in:
parent
f77141faa0
commit
774312dee0
@ -716,9 +716,9 @@
|
||||
<toolbarItem implicitItemIdentifier="6D294101-04FF-4E2A-98A7-77A48E2296CD" label="" paletteLabel="" sizingBehavior="auto" id="FoD-o2-4f2">
|
||||
<nil key="toolTip"/>
|
||||
<textField key="view" horizontalHuggingPriority="251" verticalHuggingPriority="750" id="KVt-e7-7I5">
|
||||
<rect key="frame" x="0.0" y="14" width="37" height="17"/>
|
||||
<rect key="frame" x="0.0" y="14" width="72" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="bCv-8Z-qfx">
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="stateLabel" id="bCv-8Z-qfx">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@ -50,18 +50,26 @@ class MPDClient {
|
||||
|
||||
self.connection = connection
|
||||
self.status = status
|
||||
self.initializeStatus()
|
||||
idle()
|
||||
}
|
||||
|
||||
func disconnect() {
|
||||
mpd_status_free(status)
|
||||
mpd_connection_free(connection)
|
||||
noIdle()
|
||||
commandQueue.async { [unowned self] in
|
||||
mpd_status_free(self.status)
|
||||
mpd_connection_free(self.connection)
|
||||
}
|
||||
}
|
||||
|
||||
func fetchStatus() {
|
||||
sendCommand(command: .fetchStatus)
|
||||
}
|
||||
|
||||
func initializeStatus() {
|
||||
self.delegate?.didUpdateState(mpdClient: self, state: self.getState())
|
||||
}
|
||||
|
||||
func getState() -> State {
|
||||
let state = mpd_status_get_state(status)
|
||||
return State(rawValue: state.rawValue)!
|
||||
|
||||
Loading…
Reference in New Issue
Block a user