Compare commits
No commits in common. "7f70ad44de2258c09b4ec532fc9938d3b2c919c0" and "859e1ca5274b00050cc1aaa030841bbf3d8f6596" have entirely different histories.
7f70ad44de
...
859e1ca527
9 changed files with 1 additions and 72 deletions
|
@ -6,7 +6,6 @@ mod imp {
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Application {
|
pub struct Application {
|
||||||
// FIXME: move somewhere else
|
|
||||||
mpv: Rc<mpv::Handle>,
|
mpv: Rc<mpv::Handle>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,13 +91,6 @@ mod imp {
|
||||||
impl AdwApplicationImpl for Application {}
|
impl AdwApplicationImpl for Application {}
|
||||||
|
|
||||||
impl Application {}
|
impl Application {}
|
||||||
|
|
||||||
impl Drop for Application {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping AudreyApplication");
|
|
||||||
self.mpv.command(["quit"]).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use gtk::{gio, glib};
|
use gtk::{gio, glib};
|
||||||
|
|
|
@ -93,9 +93,3 @@ impl Mpris {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Mpris {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping Mpris");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -504,9 +504,3 @@ impl Player {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Player {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping MprisPlayer");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
23
src/mpv.rs
23
src/mpv.rs
|
@ -1,6 +1,6 @@
|
||||||
mod ffi;
|
mod ffi;
|
||||||
|
|
||||||
use std::ffi::{c_char, c_int, c_void, CStr, CString};
|
use std::ffi::{c_int, c_void, CStr, CString};
|
||||||
|
|
||||||
#[link(name = "mpv")]
|
#[link(name = "mpv")]
|
||||||
extern "C" {}
|
extern "C" {}
|
||||||
|
@ -114,25 +114,6 @@ impl Handle {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn command<'a>(&self, args: impl IntoIterator<Item = &'a str>) -> Result<(), Error> {
|
|
||||||
// add zero terminators to Everything
|
|
||||||
let args: Vec<CString> = args
|
|
||||||
.into_iter()
|
|
||||||
.map(CString::new)
|
|
||||||
.map(Result::unwrap)
|
|
||||||
.collect();
|
|
||||||
let mut args: Vec<*const c_char> = args
|
|
||||||
.iter()
|
|
||||||
.map(CString::as_c_str)
|
|
||||||
.map(CStr::as_ptr)
|
|
||||||
.collect();
|
|
||||||
// must be null terminated
|
|
||||||
args.push(std::ptr::null_mut());
|
|
||||||
let args: *mut *const c_char = args.as_mut_ptr();
|
|
||||||
|
|
||||||
Error::from_return_code(unsafe { ffi::mpv_command(self.inner.as_ptr(), args) })
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: return None on SHUTDOWN possibly?
|
// TODO: return None on SHUTDOWN possibly?
|
||||||
pub fn tick(&self) -> Option<EventListener> {
|
pub fn tick(&self) -> Option<EventListener> {
|
||||||
// take listener before we drain the event queue, so we don't miss any notifications
|
// take listener before we drain the event queue, so we don't miss any notifications
|
||||||
|
@ -170,8 +151,6 @@ impl Handle {
|
||||||
|
|
||||||
impl Drop for Handle {
|
impl Drop for Handle {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
println!("dropping MpvHandle");
|
|
||||||
|
|
||||||
// let any executor ticking tasks know we're ded
|
// let any executor ticking tasks know we're ded
|
||||||
self.wakeup.notify(u32::MAX.relaxed());
|
self.wakeup.notify(u32::MAX.relaxed());
|
||||||
|
|
||||||
|
|
|
@ -171,9 +171,3 @@ impl Client {
|
||||||
.map(|response| response.random_songs.song)
|
.map(|response| response.random_songs.song)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Client {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping SubsonicClient");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -84,12 +84,6 @@ mod imp {
|
||||||
self.obj().playbin().unwrap().select_track(position);
|
self.obj().playbin().unwrap().select_track(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for PlayQueue {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping AudreyUiPlayQueue");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use gtk::glib;
|
use gtk::glib;
|
||||||
|
|
|
@ -161,12 +161,6 @@ mod imp {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Song {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping AudreyUiPlayQueueSong");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
|
|
|
@ -160,12 +160,6 @@ mod imp {
|
||||||
playbin.set_mute(!playbin.mute());
|
playbin.set_mute(!playbin.mute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Playbar {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping AudreyUiPlaybar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use gtk::glib;
|
use gtk::glib;
|
||||||
|
|
|
@ -147,12 +147,6 @@ mod imp {
|
||||||
self.obj().emit_by_name::<()>("connected", &[&vala_api]);
|
self.obj().emit_by_name::<()>("connected", &[&vala_api]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Setup {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
println!("dropping AudreyUiSetup");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
|
|
Loading…
Reference in a new issue