Compare commits
3 commits
3923635703
...
e1af996482
Author | SHA1 | Date | |
---|---|---|---|
e1af996482 | |||
b069a2ddb7 | |||
d808f30005 |
11 changed files with 386 additions and 138 deletions
119
Cargo.lock
generated
119
Cargo.lock
generated
|
@ -214,6 +214,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
|
"zbus 5.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1596,9 +1597,9 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"sha2",
|
"sha2",
|
||||||
"subtle",
|
"subtle",
|
||||||
"zbus",
|
"zbus 4.4.0",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
"zvariant",
|
"zvariant 4.2.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2740,9 +2741,44 @@ dependencies = [
|
||||||
"uds_windows",
|
"uds_windows",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
"xdg-home",
|
"xdg-home",
|
||||||
"zbus_macros",
|
"zbus_macros 4.4.0",
|
||||||
"zbus_names",
|
"zbus_names 3.0.0",
|
||||||
"zvariant",
|
"zvariant 4.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zbus"
|
||||||
|
version = "5.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "333be40ef37976542e10832ba961e3e44ea215a6b1e2673066b303ee3e0ede10"
|
||||||
|
dependencies = [
|
||||||
|
"async-broadcast",
|
||||||
|
"async-executor",
|
||||||
|
"async-fs",
|
||||||
|
"async-io",
|
||||||
|
"async-lock",
|
||||||
|
"async-process",
|
||||||
|
"async-recursion",
|
||||||
|
"async-task",
|
||||||
|
"async-trait",
|
||||||
|
"blocking",
|
||||||
|
"enumflags2",
|
||||||
|
"event-listener",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"hex",
|
||||||
|
"nix",
|
||||||
|
"ordered-stream",
|
||||||
|
"serde",
|
||||||
|
"serde_repr",
|
||||||
|
"static_assertions",
|
||||||
|
"tracing",
|
||||||
|
"uds_windows",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
"xdg-home",
|
||||||
|
"zbus_macros 5.0.1",
|
||||||
|
"zbus_names 4.0.0",
|
||||||
|
"zvariant 5.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2755,7 +2791,20 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
"zvariant_utils",
|
"zvariant_utils 2.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zbus_macros"
|
||||||
|
version = "5.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "381be624000c82e716c2a45d9213fabacf82177591fa8a6ff655d2825450601a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-crate",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"zvariant_utils 3.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2766,7 +2815,18 @@ checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"zvariant",
|
"zvariant 4.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zbus_names"
|
||||||
|
version = "4.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cdc27fbd3593ff015cef906527a2ec4115e2e3dbf6204a24d952ac4975c80614"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"static_assertions",
|
||||||
|
"zvariant 5.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2820,7 +2880,21 @@ dependencies = [
|
||||||
"enumflags2",
|
"enumflags2",
|
||||||
"serde",
|
"serde",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"zvariant_derive",
|
"zvariant_derive 4.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zvariant"
|
||||||
|
version = "5.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c690a1da8858fd4377b8cc3134a753b0bea1d8ebd78ad6e5897fab821c5e184e"
|
||||||
|
dependencies = [
|
||||||
|
"endi",
|
||||||
|
"enumflags2",
|
||||||
|
"serde",
|
||||||
|
"static_assertions",
|
||||||
|
"zvariant_derive 5.0.1",
|
||||||
|
"zvariant_utils 3.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2833,7 +2907,20 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
"zvariant_utils",
|
"zvariant_utils 2.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zvariant_derive"
|
||||||
|
version = "5.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "83b6ddc1fed08493e4f2bd9350e7d00a3383467228735f3f169a9f8820fde755"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-crate",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"zvariant_utils 3.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2846,3 +2933,17 @@ dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zvariant_utils"
|
||||||
|
version = "3.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f8d85190ba70bc7b9540430df078bb529620b1464ed4a606010de584e27094d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"serde",
|
||||||
|
"static_assertions",
|
||||||
|
"syn",
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
|
@ -14,6 +14,7 @@ reqwest = { version = "0.12.9", features = ["json"] }
|
||||||
serde = { version = "1.0.214", features = ["derive"] }
|
serde = { version = "1.0.214", features = ["derive"] }
|
||||||
tokio = { version = "1", features = ["rt-multi-thread"] }
|
tokio = { version = "1", features = ["rt-multi-thread"] }
|
||||||
url = "2.5.2"
|
url = "2.5.2"
|
||||||
|
zbus = "5.0.1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = "0.70.1"
|
bindgen = "0.70.1"
|
||||||
|
|
|
@ -20,7 +20,32 @@ mod imp {
|
||||||
fn activate(&self) {
|
fn activate(&self) {
|
||||||
self.parent_activate();
|
self.parent_activate();
|
||||||
match self.obj().active_window() {
|
match self.obj().active_window() {
|
||||||
None => ui::Window::new(self.obj().as_ref()).present(),
|
None => {
|
||||||
|
let window = ui::Window::new(self.obj().as_ref());
|
||||||
|
window.present();
|
||||||
|
|
||||||
|
let mpris = crate::Mpris::new(&window);
|
||||||
|
let mpris_player = crate::mpris::Player::new();
|
||||||
|
|
||||||
|
glib::spawn_future_local(async {
|
||||||
|
// run this in glib's main loop
|
||||||
|
let conn = zbus::connection::Builder::session()
|
||||||
|
.expect("could not create dbus connection builder")
|
||||||
|
.internal_executor(false)
|
||||||
|
.name("org.mpris.MediaPlayer2.audrey")
|
||||||
|
.expect("could not register name in session bus")
|
||||||
|
.serve_at("/org/mpris/MediaPlayer2", mpris)
|
||||||
|
.expect("could not serve mpris")
|
||||||
|
.serve_at("/org/mpris/MediaPlayer2", mpris_player)
|
||||||
|
.expect("could not serve mpris player")
|
||||||
|
.build()
|
||||||
|
.await
|
||||||
|
.expect("could not build dbus connection");
|
||||||
|
loop {
|
||||||
|
conn.executor().tick().await;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
Some(win) => win.present(),
|
Some(win) => win.present(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
public class Audrey.Application : Adw.Application {
|
|
||||||
public Application () {
|
|
||||||
Object (
|
|
||||||
application_id: "eu.callcc.audrey",
|
|
||||||
flags: ApplicationFlags.DEFAULT_FLAGS
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
construct {
|
|
||||||
GLib.ActionEntry[] action_entries = {
|
|
||||||
{ "about", this.on_about_action },
|
|
||||||
{ "preferences", this.on_preferences_action },
|
|
||||||
{ "quit", this.quit }
|
|
||||||
};
|
|
||||||
this.add_action_entries (action_entries, this);
|
|
||||||
this.set_accels_for_action ("app.quit", {"<primary>q"});
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void activate () {
|
|
||||||
base.activate ();
|
|
||||||
// if this.active_window not null, this isnt the primary instance
|
|
||||||
var win = this.active_window ?? new Ui.Window (this);
|
|
||||||
win.present ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void on_about_action () {
|
|
||||||
string[] developers = { "Erica Z" };
|
|
||||||
var about = new Adw.AboutDialog () {
|
|
||||||
application_name = "audrey",
|
|
||||||
application_icon = "eu.callcc.audrey",
|
|
||||||
developer_name = "Erica Z",
|
|
||||||
translator_credits = _("translator-credits"),
|
|
||||||
version = "0.1.0", // AUDREY_VERSION
|
|
||||||
developers = developers,
|
|
||||||
copyright = "© 2024 Erica Z",
|
|
||||||
};
|
|
||||||
|
|
||||||
about.present (this.active_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void on_preferences_action () {
|
|
||||||
message ("app.preferences action activated");
|
|
||||||
}
|
|
||||||
|
|
||||||
~Application () {
|
|
||||||
debug ("destroying application");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,4 @@
|
||||||
audrey_sources = [
|
audrey_sources = [
|
||||||
'application.vala',
|
|
||||||
'globalconf.vala',
|
'globalconf.vala',
|
||||||
'mpris.vala',
|
'mpris.vala',
|
||||||
'playbin.vala',
|
'playbin.vala',
|
||||||
|
|
108
src/mpris.rs
108
src/mpris.rs
|
@ -1,30 +1,108 @@
|
||||||
mod player;
|
mod player;
|
||||||
pub use player::Player;
|
pub use player::Player;
|
||||||
|
|
||||||
mod ffi {
|
use adw::prelude::*;
|
||||||
|
use async_channel::Sender;
|
||||||
use gtk::glib;
|
use gtk::glib;
|
||||||
|
|
||||||
#[repr(C)]
|
pub struct Mpris {
|
||||||
pub struct AudreyMpris {
|
// needs to be Send, so can't store handle to the window...
|
||||||
parent_instance: glib::gobject_ffi::GObject,
|
raise_send: Sender<()>,
|
||||||
|
quit_send: Sender<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
impl Mpris {
|
||||||
pub struct AudreyMprisClass {
|
pub fn new(window: &crate::ui::Window) -> Self {
|
||||||
parent_class: glib::gobject_ffi::GObjectClass,
|
let (raise_send, raise_recv) = async_channel::bounded(1);
|
||||||
}
|
let (quit_send, quit_recv) = async_channel::bounded(1);
|
||||||
|
|
||||||
extern "C" {
|
glib::spawn_future_local(glib::clone!(
|
||||||
pub fn audrey_mpris_get_type() -> glib::ffi::GType;
|
#[weak]
|
||||||
|
window,
|
||||||
|
async move {
|
||||||
|
while let Ok(()) = raise_recv.recv().await {
|
||||||
|
window.present();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
glib::spawn_future_local(glib::clone!(
|
||||||
|
#[weak]
|
||||||
|
window,
|
||||||
|
async move {
|
||||||
|
while let Ok(()) = quit_recv.recv().await {
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
Self {
|
||||||
|
raise_send: raise_send,
|
||||||
|
quit_send: quit_send,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use gtk::glib;
|
#[zbus::interface(name = "org.mpris.MediaPlayer2")]
|
||||||
|
impl Mpris {
|
||||||
|
async fn raise(&self) {
|
||||||
|
// FIXME: don't unwrap
|
||||||
|
self.raise_send.send(()).await.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
glib::wrapper! {
|
async fn quit(&self) {
|
||||||
pub struct Mpris(Object<ffi::AudreyMpris, ffi::AudreyMprisClass>);
|
// FIXME: don't unwrap
|
||||||
|
self.quit_send.send(()).await.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
match fn {
|
#[zbus(property)]
|
||||||
type_ => || ffi::audrey_mpris_get_type(),
|
fn can_quit(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn fullscreen(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
// TODO: report that if the argument is just _ the attribute panics
|
||||||
|
async fn set_fullscreen(&self, _fullscreen: bool) -> zbus::Result<()> {
|
||||||
|
Err(zbus::Error::Unsupported)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_set_fullscreen(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_raise(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn has_track_list(&self) -> bool {
|
||||||
|
false // TODO?
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn identity(&self) -> String {
|
||||||
|
"audrey".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn desktop_entry(&self) -> String {
|
||||||
|
crate::APP_ID.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn supported_uri_schemes(&self) -> Vec<String> {
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn supported_mime_types(&self) -> Vec<String> {
|
||||||
|
vec![]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,3 @@
|
||||||
[DBus (name = "org.mpris.MediaPlayer2")]
|
|
||||||
class Audrey.Mpris : Object {
|
|
||||||
internal signal void on_raise ();
|
|
||||||
internal signal void on_quit ();
|
|
||||||
|
|
||||||
public bool can_raise { get { return true; } }
|
|
||||||
public void raise () throws Error {
|
|
||||||
this.on_raise ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool can_quit { get { return true; } }
|
|
||||||
public void quit () throws Error {
|
|
||||||
this.on_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool can_set_fullscreen { get { return false; } }
|
|
||||||
public bool fullscreen { get { return false; } set { assert (false); } }
|
|
||||||
public bool has_track_list { get { return false; } }
|
|
||||||
public string identity { owned get { return "audrey"; } }
|
|
||||||
public string desktop_entry { owned get { return "eu.callcc.audrey"; } }
|
|
||||||
public string[] supported_uri_schemes { owned get { return {}; } }
|
|
||||||
public string[] supported_mime_types { owned get { return {}; } }
|
|
||||||
|
|
||||||
internal Mpris (Ui.Window window) {
|
|
||||||
this.on_raise.connect (() => window.present ());
|
|
||||||
this.on_quit.connect (() => window.close ());
|
|
||||||
}
|
|
||||||
|
|
||||||
~Mpris () {
|
|
||||||
debug ("destroying mpris");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DBus (name = "org.mpris.MediaPlayer2.Player")]
|
[DBus (name = "org.mpris.MediaPlayer2.Player")]
|
||||||
class Audrey.MprisPlayer : Object {
|
class Audrey.MprisPlayer : Object {
|
||||||
internal signal void on_next ();
|
internal signal void on_next ();
|
||||||
|
|
|
@ -1,27 +1,147 @@
|
||||||
mod ffi {
|
use zbus::object_server::SignalEmitter;
|
||||||
use gtk::glib;
|
use zbus::zvariant::{ObjectPath, Value};
|
||||||
|
|
||||||
#[repr(C)]
|
pub struct Player {}
|
||||||
pub struct AudreyMprisPlayer {
|
|
||||||
parent_instance: glib::gobject_ffi::GObject,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
impl Player {
|
||||||
pub struct AudreyMprisClassPlayer {
|
pub fn new() -> Self {
|
||||||
parent_class: glib::gobject_ffi::GObjectClass,
|
Self {}
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
pub fn audrey_mpris_player_get_type() -> glib::ffi::GType;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use gtk::glib;
|
#[zbus::interface(name = "org.mpris.MediaPlayer2.Player")]
|
||||||
|
impl Player {
|
||||||
|
fn next(&self) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
glib::wrapper! {
|
fn previous(&self) {
|
||||||
pub struct Player(Object<ffi::AudreyMprisPlayer, ffi::AudreyMprisClassPlayer>);
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
match fn {
|
fn pause(&self) {
|
||||||
type_ => || ffi::audrey_mpris_player_get_type(),
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn play_pause(&self) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn stop(&self) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn play(&self) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn seek(&self, _offset: i64) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_position(&self, _track_id: ObjectPath<'_>, _position: i64) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn open_uri(&self, _s: &str) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(signal)]
|
||||||
|
async fn seeked(signal_emitter: &SignalEmitter<'_>, position: i64) -> zbus::Result<()>;
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn playback_status(&self) -> String {
|
||||||
|
"Stopped".into() // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn loop_status(&self) -> String {
|
||||||
|
"None".into() // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_loop_status(&self, _loop_status: &str) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn playback_rate(&self) -> f64 {
|
||||||
|
1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_playback_rate(&self, _playback_rate: f64) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn shuffle(&self) -> zbus::fdo::Result<bool> {
|
||||||
|
Err(zbus::fdo::Error::NotSupported("Shuffle".into()))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_shuffle(&self, _shuffle: bool) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn metadata(&self) -> Vec<(String, Value)> {
|
||||||
|
vec![] // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn volume(&self) -> f64 {
|
||||||
|
1.0 // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_volume(&self, _volume: f64) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
|
fn position(&self) -> i64 {
|
||||||
|
0 // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn minimum_rate(&self) -> f64 {
|
||||||
|
1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn maximum_rate(&self) -> f64 {
|
||||||
|
1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_go_next(&self) -> bool {
|
||||||
|
false // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_go_previous(&self) -> bool {
|
||||||
|
false // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_play(&self) -> bool {
|
||||||
|
false // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_pause(&self) -> bool {
|
||||||
|
false // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
fn can_seek(&self) -> bool {
|
||||||
|
false // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
|
fn can_control(&self) -> bool {
|
||||||
|
false // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
// ui::playbar
|
// ui::playbar
|
||||||
typedef void AudreyUiPlaybar;
|
typedef void AudreyUiPlaybar;
|
||||||
|
@ -18,3 +19,8 @@ void audrey_ui_play_queue_song_unbind(AudreyUiPlayQueueSong *self);
|
||||||
|
|
||||||
// ui::PlayQueue
|
// ui::PlayQueue
|
||||||
typedef void AudreyUiPlayQueue;
|
typedef void AudreyUiPlayQueue;
|
||||||
|
|
||||||
|
// Mpris
|
||||||
|
typedef void AudreyMpris;
|
||||||
|
AudreyMpris *audrey_mpris_new(void *window);
|
||||||
|
guint audrey_mpris_register_object(AudreyMpris *self, GDBusConnection *conn, const gchar *object_path, GError **error);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
mod ffi {
|
pub mod ffi {
|
||||||
use gtk::glib;
|
use gtk::glib;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[GtkTemplate (ui = "/eu/callcc/audrey/window.ui")]
|
[GtkTemplate (ui = "/eu/callcc/audrey/window.ui")]
|
||||||
class Audrey.Ui.Window : Adw.ApplicationWindow {
|
public class Audrey.Ui.Window : Adw.ApplicationWindow {
|
||||||
[GtkChild] public unowned PlayQueue play_queue;
|
[GtkChild] public unowned PlayQueue play_queue;
|
||||||
[GtkChild] public unowned Playbar playbar;
|
[GtkChild] public unowned Playbar playbar;
|
||||||
//[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks;
|
//[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks;
|
||||||
|
@ -29,7 +29,6 @@ class Audrey.Ui.Window : Adw.ApplicationWindow {
|
||||||
Object (application: app);
|
Object (application: app);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mpris mpris;
|
|
||||||
private MprisPlayer mpris_player;
|
private MprisPlayer mpris_player;
|
||||||
|
|
||||||
private void now_playing (PlaybinSong song) {
|
private void now_playing (PlaybinSong song) {
|
||||||
|
@ -59,16 +58,15 @@ class Audrey.Ui.Window : Adw.ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
|
/*
|
||||||
Bus.own_name (
|
Bus.own_name (
|
||||||
BusType.SESSION,
|
BusType.SESSION,
|
||||||
"org.mpris.MediaPlayer2.audrey",
|
"org.mpris.MediaPlayer2.audrey",
|
||||||
BusNameOwnerFlags.NONE,
|
BusNameOwnerFlags.NONE,
|
||||||
(conn) => {
|
(conn) => {
|
||||||
try {
|
try {
|
||||||
this.mpris = new Mpris (this);
|
|
||||||
this.mpris_player = new MprisPlayer (conn, this.playbin);
|
this.mpris_player = new MprisPlayer (conn, this.playbin);
|
||||||
|
|
||||||
conn.register_object ("/org/mpris/MediaPlayer2", this.mpris);
|
|
||||||
conn.register_object ("/org/mpris/MediaPlayer2", this.mpris_player);
|
conn.register_object ("/org/mpris/MediaPlayer2", this.mpris_player);
|
||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
error ("could not register dbus service: %s", e.message);
|
error ("could not register dbus service: %s", e.message);
|
||||||
|
@ -76,13 +74,14 @@ class Audrey.Ui.Window : Adw.ApplicationWindow {
|
||||||
},
|
},
|
||||||
() => {},
|
() => {},
|
||||||
() => { error ("could not acquire dbus name"); });
|
() => { error ("could not acquire dbus name"); });
|
||||||
|
*/
|
||||||
|
|
||||||
this.setup = new Setup ();
|
this.setup = new Setup ();
|
||||||
|
|
||||||
this.setup.connected.connect ((api) => {
|
this.setup.connected.connect ((api) => {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.playbin.api = api;
|
this.playbin.api = api;
|
||||||
this.mpris_player.api = api;
|
//this.mpris_player.api = api;
|
||||||
this.can_click_shuffle_all = true;
|
this.can_click_shuffle_all = true;
|
||||||
});
|
});
|
||||||
this.setup.load ();
|
this.setup.load ();
|
||||||
|
|
Loading…
Reference in a new issue