diff options
| author | Andreas Grois <andi@grois.info> | 2021-05-01 22:16:54 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2021-05-01 22:16:54 +0200 |
| commit | 18a96163d730b7e44270603a4c6de071b725db5f (patch) | |
| tree | e91e9d23eec5031d9be7f1422b147c05d44a25d7 /pulse/src/communication.rs | |
| parent | 00a3332d9a986f650283416dccf25aa9f2d32aa6 (diff) | |
First draft of pulse architecture.
Diffstat (limited to 'pulse/src/communication.rs')
| -rw-r--r-- | pulse/src/communication.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pulse/src/communication.rs b/pulse/src/communication.rs new file mode 100644 index 0000000..c8578b7 --- /dev/null +++ b/pulse/src/communication.rs @@ -0,0 +1,37 @@ +use std::sync::mpsc::*; +use crate::runnable::*; +use swaystatus_plugin::*; + +pub enum MessagesFromMain { + Quit, + Refresh +} + +pub struct SenderForMain { + sender : Sender<MessagesFromMain>, + pulse_loop : std::sync::Arc<PulseMainLoop> +} + +impl<'p> SenderForMain { + pub fn new(sender : Sender<MessagesFromMain>, pulse_loop : std::sync::Arc<PulseMainLoop>) -> Self { + SenderForMain{ + sender, + pulse_loop + } + } + + fn send(&self, message : MessagesFromMain) -> Result<(), PluginCommunicationError> + { + //TODO!!!! + Ok(()) + } +} + +impl MsgMainToModule for SenderForMain { + fn send_quit(&self) -> Result<(), PluginCommunicationError> { + self.send(MessagesFromMain::Quit) + } + fn send_refresh(&self) -> Result<(), PluginCommunicationError> { + self.send(MessagesFromMain::Refresh) + } +} |
