Commit 1e89e000 authored by Guillaume Desmottes's avatar Guillaume Desmottes 🐐

karapulse: create player itself

parent 01e578a6
......@@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <https://www.gnu.org/licenses/>.
use failure::Error;
use glib::Receiver;
use glib::{Receiver, Sender};
use serde::Serialize;
use std::cell::{Cell, RefCell};
use std::convert::TryInto;
......@@ -258,7 +258,8 @@ impl ops::Deref for Karapulse {
}
impl Karapulse {
pub fn new(player: player::Player, rx: Receiver<Message>, db: DB) -> Self {
pub fn new(window: gtk::Window, tx: Sender<Message>, rx: Receiver<Message>, db: DB) -> Self {
let player = player::Player::new(window, tx).unwrap();
let inner = KarapulseInner::new(player, db);
let inner = Rc::new(inner);
......@@ -310,10 +311,9 @@ mod tests {
let (tx, rx) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
let window = gtk::Window::new(gtk::WindowType::Toplevel);
let player = player::Player::new(window, tx.clone()).unwrap();
let db = DB::new_memory().unwrap();
let karapulse = Karapulse::new(player, rx, db);
let karapulse = Karapulse::new(window, tx.clone(), rx, db);
Test { karapulse, tx }
}
......
......@@ -107,8 +107,7 @@ fn main() -> Result<(), Error> {
);
let window = window.upcast::<gtk::Window>();
let player = player::Player::new(window, tx.clone()).unwrap();
let karapulse = Karapulse::new(player, rx, db);
let karapulse = Karapulse::new(window, tx.clone(), rx, db);
let db = DB::new(&opt.path).unwrap();
if opt.restore {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment