Turn struct View into a gtk::Application subclass.

This lets us keep multiple reference-counted copies easier, and lets us emit signals to the controller.
This commit is contained in:
Tom A. Wagner
2021-05-08 13:16:13 +02:00
parent b5071c09a0
commit 2cc684d57c
3 changed files with 83 additions and 53 deletions

View File

@@ -2,10 +2,11 @@ mod controller;
mod pipewire_connection;
mod view;
use std::rc::Rc;
use controller::MediaType;
use gtk::glib::{self, PRIORITY_DEFAULT};
use gtk::{
glib::{self, PRIORITY_DEFAULT},
prelude::*,
};
use pipewire::spa::Direction;
/// Messages used GTK thread to command the pipewire thread.
@@ -55,10 +56,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let pw_thread =
std::thread::spawn(move || pipewire_connection::thread_main(gtk_sender, pw_receiver));
let view = Rc::new(view::View::new());
let view = view::View::new();
let _controller = controller::Controller::new(view.clone(), gtk_receiver);
view.run();
view.run(&std::env::args().collect::<Vec<_>>());
pw_sender
.send(GtkMessage::Terminate)