From 2f70f6154715f9ea8dded70607e3e04375a39111 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Tue, 29 Oct 2024 19:13:58 +0100 Subject: [PATCH] don' use the libsecret crate --- Cargo.lock | 263 ++++++--------------------- Cargo.toml | 1 - src/ffi.rs | 497 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 3 +- 4 files changed, 551 insertions(+), 213 deletions(-) create mode 100644 src/ffi.rs diff --git a/Cargo.lock b/Cargo.lock index 8a128fa..73e74df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,7 +9,6 @@ dependencies = [ "glib-build-tools", "gtk4", "libadwaita", - "libsecret", ] [[package]] @@ -32,7 +31,7 @@ checksum = "e8a0ea147c94108c9613235388f540e4d14c327f7081c9e471fc8ee8a2533e69" dependencies = [ "bitflags", "cairo-sys-rs", - "glib 0.20.4", + "glib", "libc", ] @@ -42,19 +41,9 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" dependencies = [ - "glib-sys 0.20.4", + "glib-sys", "libc", - "system-deps 7.0.3", -] - -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", - "target-lexicon", + "system-deps", ] [[package]] @@ -153,8 +142,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4c29071a9e92337d8270a85cb0510cda4ac478be26d09ad027cc1d081911b19" dependencies = [ "gdk-pixbuf-sys", - "gio 0.20.4", - "glib 0.20.4", + "gio", + "glib", "libc", ] @@ -164,11 +153,11 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "687343b059b91df5f3fbd87b4307038fa9e647fcc0461d0d3f93e94fee20bf3d" dependencies = [ - "gio-sys 0.20.4", - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "gio-sys", + "glib-sys", + "gobject-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -180,8 +169,8 @@ dependencies = [ "cairo-rs", "gdk-pixbuf", "gdk4-sys", - "gio 0.20.4", - "glib 0.20.4", + "gio", + "glib", "libc", "pango", ] @@ -194,31 +183,13 @@ checksum = "7d3c03d1ea9d5199f14f060890fde68a3b5ec5699144773d1fa6abf337bfbc9c" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", - "gio-sys 0.20.4", - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "gio-sys", + "glib-sys", + "gobject-sys", "libc", "pango-sys", "pkg-config", - "system-deps 7.0.3", -] - -[[package]] -name = "gio" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c49f117d373ffcc98a35d114db5478bc223341cff53e39a5d6feced9e2ddffe" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "gio-sys 0.19.8", - "glib 0.19.9", - "libc", - "pin-project-lite", - "smallvec", - "thiserror", + "system-deps", ] [[package]] @@ -231,61 +202,26 @@ dependencies = [ "futures-core", "futures-io", "futures-util", - "gio-sys 0.20.4", - "glib 0.20.4", + "gio-sys", + "glib", "libc", "pin-project-lite", "smallvec", ] -[[package]] -name = "gio-sys" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd743ba4714d671ad6b6234e8ab2a13b42304d0e13ab7eba1dcdd78a7d6d4ef" -dependencies = [ - "glib-sys 0.19.8", - "gobject-sys 0.19.8", - "libc", - "system-deps 6.2.2", - "windows-sys", -] - [[package]] name = "gio-sys" version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f7efc368de04755344f0084104835b6bb71df2c1d41e37d863947392a894779" dependencies = [ - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "glib-sys", + "gobject-sys", "libc", - "system-deps 7.0.3", + "system-deps", "windows-sys", ] -[[package]] -name = "glib" -version = "0.19.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39650279f135469465018daae0ba53357942a5212137515777d5fdca74984a44" -dependencies = [ - "bitflags", - "futures-channel", - "futures-core", - "futures-executor", - "futures-task", - "futures-util", - "gio-sys 0.19.8", - "glib-macros 0.19.9", - "glib-sys 0.19.8", - "gobject-sys 0.19.8", - "libc", - "memchr", - "smallvec", - "thiserror", -] - [[package]] name = "glib" version = "0.20.4" @@ -298,10 +234,10 @@ dependencies = [ "futures-executor", "futures-task", "futures-util", - "gio-sys 0.20.4", - "glib-macros 0.20.4", - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", "libc", "memchr", "smallvec", @@ -313,20 +249,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7029c2651d9b5d5a3eea93ec8a1995665c6d3a69ce9bf6042ad9064d134736d8" dependencies = [ - "gio 0.20.4", -] - -[[package]] -name = "glib-macros" -version = "0.19.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4429b0277a14ae9751350ad9b658b1be0abb5b54faa5bcdf6e74a3372582fad7" -dependencies = [ - "heck", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", + "gio", ] [[package]] @@ -342,16 +265,6 @@ dependencies = [ "syn", ] -[[package]] -name = "glib-sys" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2dc18d3a82b0006d470b13304fbbb3e0a9bd4884cf985a60a7ed733ac2c4a5" -dependencies = [ - "libc", - "system-deps 6.2.2", -] - [[package]] name = "glib-sys" version = "0.20.4" @@ -359,18 +272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9eca5d88cfa6a453b00d203287c34a2b7cac3a7831779aa2bb0b3c7233752b" dependencies = [ "libc", - "system-deps 7.0.3", -] - -[[package]] -name = "gobject-sys" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e697e252d6e0416fd1d9e169bda51c0f1c926026c39ca21fbe8b1bb5c3b8b9e" -dependencies = [ - "glib-sys 0.19.8", - "libc", - "system-deps 6.2.2", + "system-deps", ] [[package]] @@ -379,9 +281,9 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462" dependencies = [ - "glib-sys 0.20.4", + "glib-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -390,7 +292,7 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f53144c7fe78292705ff23935f1477d511366fb2f73c43d63b37be89076d2fe" dependencies = [ - "glib 0.20.4", + "glib", "graphene-sys", "libc", ] @@ -401,10 +303,10 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e741797dc5081e59877a4d72c442c72d61efdd99161a0b1c1b29b6b988934b99" dependencies = [ - "glib-sys 0.20.4", + "glib-sys", "libc", "pkg-config", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -415,7 +317,7 @@ checksum = "aa21a2f7c51ee1c6cc1242c2faf3aae2b7566138f182696759987bde8219e922" dependencies = [ "cairo-rs", "gdk4", - "glib 0.20.4", + "glib", "graphene-rs", "gsk4-sys", "libc", @@ -430,12 +332,12 @@ checksum = "0f9fb607554f9f4e8829eb7ea301b0fde051e1dbfd5d16b143a8a9c2fac6c01b" dependencies = [ "cairo-sys-rs", "gdk4-sys", - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "glib-sys", + "gobject-sys", "graphene-sys", "libc", "pango-sys", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -449,8 +351,8 @@ dependencies = [ "futures-channel", "gdk-pixbuf", "gdk4", - "gio 0.20.4", - "glib 0.20.4", + "gio", + "glib", "graphene-rs", "gsk4", "gtk4-macros", @@ -480,14 +382,14 @@ dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", "gdk4-sys", - "gio-sys 0.20.4", - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "gio-sys", + "glib-sys", + "gobject-sys", "graphene-sys", "gsk4-sys", "libc", "pango-sys", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -519,8 +421,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878" dependencies = [ "gdk4", - "gio 0.20.4", - "glib 0.20.4", + "gio", + "glib", "gtk4", "libadwaita-sys", "libc", @@ -534,13 +436,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6" dependencies = [ "gdk4-sys", - "gio-sys 0.20.4", - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "gio-sys", + "glib-sys", + "gobject-sys", "gtk4-sys", "libc", "pango-sys", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -549,32 +451,6 @@ version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" -[[package]] -name = "libsecret" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c6ccddc706a38eca477b4d7857acd6c76c7d6fba5d47b4b2e7d800e5a17194" -dependencies = [ - "gio 0.19.8", - "glib 0.19.9", - "libc", - "libsecret-sys", -] - -[[package]] -name = "libsecret-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1af48e61f1c8e77e9705296f346e45b637754a92348a79b4c62df84d0654c2" -dependencies = [ - "gio-sys 0.19.8", - "glib-sys 0.19.8", - "gobject-sys 0.19.8", - "libc", - "pkg-config", - "system-deps 6.2.2", -] - [[package]] name = "memchr" version = "2.7.4" @@ -596,8 +472,8 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa26aa54b11094d72141a754901cd71d9356432bb8147f9cace8d9c7ba95f356" dependencies = [ - "gio 0.20.4", - "glib 0.20.4", + "gio", + "glib", "libc", "pango-sys", ] @@ -608,10 +484,10 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84fd65917bf12f06544ae2bbc200abf9fc0a513a5a88a0fa81013893aef2b838" dependencies = [ - "glib-sys 0.20.4", - "gobject-sys 0.20.4", + "glib-sys", + "gobject-sys", "libc", - "system-deps 7.0.3", + "system-deps", ] [[package]] @@ -729,26 +605,13 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "system-deps" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" -dependencies = [ - "cfg-expr 0.15.8", - "heck", - "pkg-config", - "toml", - "version-compare", -] - [[package]] name = "system-deps" version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" dependencies = [ - "cfg-expr 0.17.0", + "cfg-expr", "heck", "pkg-config", "toml", @@ -761,26 +624,6 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" -[[package]] -name = "thiserror" -version = "1.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "toml" version = "0.8.19" diff --git a/Cargo.toml b/Cargo.toml index 6b298ea..34e3283 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" [dependencies] adw = { version = "0.7.0", package = "libadwaita", features = ["v1_6"] } gtk = { version = "0.9.2", package = "gtk4", features = ["v4_16"] } -libsecret = { version = "0.5.0", features = ["v0_21"] } [build-dependencies] glib-build-tools = "0.20.0" diff --git a/src/ffi.rs b/src/ffi.rs new file mode 100644 index 0000000..f0cfedf --- /dev/null +++ b/src/ffi.rs @@ -0,0 +1,497 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from /usr/share/gir-1.0 +// from ../o/src +// DO NOT EDIT + +#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal, clippy::upper_case_acronyms)] +#![cfg_attr(docsrs, feature(doc_cfg))] + + +#[allow(unused_imports)] +use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double, + c_short, c_ushort, c_long, c_ulong, + c_void, size_t, ssize_t, time_t, off_t, intptr_t, uintptr_t, FILE}; +#[cfg(unix)] +#[allow(unused_imports)] +use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; + +#[allow(unused_imports)] +use gtk::{gio, glib::{gboolean, gconstpointer, gpointer, GType}}; + +// Enums +pub type AudreyPlaybinState = c_int; +pub const AUDREY_PLAYBIN_STATE_STOPPED: AudreyPlaybinState = 0; +pub const AUDREY_PLAYBIN_STATE_PAUSED: AudreyPlaybinState = 1; +pub const AUDREY_PLAYBIN_STATE_PLAYING: AudreyPlaybinState = 2; + +pub type AudreySubsonicError = c_int; +pub const AUDREY_SUBSONIC_ERROR_BAD_AUTHN: AudreySubsonicError = 0; +pub const AUDREY_SUBSONIC_ERROR_ERROR: AudreySubsonicError = 1; + +// Callbacks +pub type AudreySubsonicSongCallback = Option; + +// Records +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyApplicationClass { + pub parent_class: adw::AdwApplicationClass, +} + +impl ::std::fmt::Debug for AudreyApplicationClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyApplicationClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreyApplicationPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreyApplicationPrivate = _AudreyApplicationPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyPlaybinClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for AudreyPlaybinClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyPlaybinClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreyPlaybinPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreyPlaybinPrivate = _AudreyPlaybinPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyPlaybinSongClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for AudreyPlaybinSongClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyPlaybinSongClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreyPlaybinSongPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreyPlaybinSongPrivate = _AudreyPlaybinSongPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicAlbumClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for AudreySubsonicAlbumClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicAlbumClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreySubsonicAlbumPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreySubsonicAlbumPrivate = _AudreySubsonicAlbumPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicArtistClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for AudreySubsonicArtistClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicArtistClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreySubsonicArtistPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreySubsonicArtistPrivate = _AudreySubsonicArtistPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicClientClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for AudreySubsonicClientClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicClientClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreySubsonicClientPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreySubsonicClientPrivate = _AudreySubsonicClientPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicSong { + pub id: *mut c_char, + pub title: *mut c_char, + pub album: *mut c_char, + pub artist: *mut c_char, + pub track: i64, + pub year: i64, + pub starred: *mut glib::GDateTime, + pub duration: i64, + pub play_count: i64, + pub genre: *mut c_char, + pub cover_art: *mut c_char, +} + +impl ::std::fmt::Debug for AudreySubsonicSong { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicSong @ {self:p}")) + .field("id", &self.id) + .field("title", &self.title) + .field("album", &self.album) + .field("artist", &self.artist) + .field("track", &self.track) + .field("year", &self.year) + .field("starred", &self.starred) + .field("duration", &self.duration) + .field("play_count", &self.play_count) + .field("genre", &self.genre) + .field("cover_art", &self.cover_art) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyUiPlayQueueClass { + pub parent_class: adw::AdwBinClass, +} + +impl ::std::fmt::Debug for AudreyUiPlayQueueClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyUiPlayQueueClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreyUiPlayQueuePrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreyUiPlayQueuePrivate = _AudreyUiPlayQueuePrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyUiSetupClass { + pub parent_class: adw::AdwPreferencesDialogClass, +} + +impl ::std::fmt::Debug for AudreyUiSetupClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyUiSetupClass @ {self:p}")) + .finish() + } +} + +#[repr(C)] +pub struct _AudreyUiSetupPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type AudreyUiSetupPrivate = _AudreyUiSetupPrivate; + +// Classes +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyApplication { + pub parent_instance: adw::AdwApplication, + pub priv_: *mut AudreyApplicationPrivate, +} + +impl ::std::fmt::Debug for AudreyApplication { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyApplication @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyPlaybin { + pub parent_instance: gobject::GObject, + pub priv_: *mut AudreyPlaybinPrivate, +} + +impl ::std::fmt::Debug for AudreyPlaybin { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyPlaybin @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyPlaybinSong { + pub parent_instance: gobject::GObject, + pub priv_: *mut AudreyPlaybinSongPrivate, +} + +impl ::std::fmt::Debug for AudreyPlaybinSong { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyPlaybinSong @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicAlbum { + pub parent_instance: gobject::GObject, + pub priv_: *mut AudreySubsonicAlbumPrivate, + pub id: *mut c_char, + pub name: *mut c_char, +} + +impl ::std::fmt::Debug for AudreySubsonicAlbum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicAlbum @ {self:p}")) + .field("id", &self.id) + .field("name", &self.name) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicArtist { + pub parent_instance: gobject::GObject, + pub priv_: *mut AudreySubsonicArtistPrivate, + pub index: *mut c_char, + pub id: *mut c_char, + pub cover_art: *mut c_char, + pub artist_image_url: *mut c_char, + pub album_count: i64, +} + +impl ::std::fmt::Debug for AudreySubsonicArtist { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicArtist @ {self:p}")) + .field("index", &self.index) + .field("id", &self.id) + .field("cover_art", &self.cover_art) + .field("artist_image_url", &self.artist_image_url) + .field("album_count", &self.album_count) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreySubsonicClient { + pub parent_instance: gobject::GObject, + pub priv_: *mut AudreySubsonicClientPrivate, +} + +impl ::std::fmt::Debug for AudreySubsonicClient { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreySubsonicClient @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyUiPlayQueue { + pub parent_instance: adw::AdwBin, + pub priv_: *mut AudreyUiPlayQueuePrivate, +} + +impl ::std::fmt::Debug for AudreyUiPlayQueue { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyUiPlayQueue @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct AudreyUiSetup { + pub parent_instance: adw::AdwPreferencesDialog, + pub priv_: *mut AudreyUiSetupPrivate, + pub token: *mut c_char, + pub salt: *mut c_char, +} + +impl ::std::fmt::Debug for AudreyUiSetup { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("AudreyUiSetup @ {self:p}")) + .field("token", &self.token) + .field("salt", &self.salt) + .finish() + } +} + +#[link(name = "audrey")] +extern "C" { + + //========================================================================= + // AudreyPlaybinState + //========================================================================= + pub fn audrey_playbin_state_get_type() -> GType; + + //========================================================================= + // AudreySubsonicError + //========================================================================= + pub fn audrey_subsonic_error_get_type() -> GType; + + //========================================================================= + // AudreySubsonicSong + //========================================================================= + pub fn audrey_subsonic_song_get_type() -> GType; + pub fn audrey_subsonic_song_init(self_: *mut AudreySubsonicSong, reader: *mut json::JsonReader); + + //========================================================================= + // AudreyApplication + //========================================================================= + pub fn audrey_application_get_type() -> GType; + pub fn audrey_application_new() -> *mut AudreyApplication; + + //========================================================================= + // AudreyPlaybin + //========================================================================= + pub fn audrey_playbin_get_type() -> GType; + pub fn audrey_playbin_new() -> *mut AudreyPlaybin; + pub fn audrey_playbin_seek(self_: *mut AudreyPlaybin, position: c_double); + pub fn audrey_playbin_select_track(self_: *mut AudreyPlaybin, position: c_uint); + pub fn audrey_playbin_pause(self_: *mut AudreyPlaybin); + pub fn audrey_playbin_play(self_: *mut AudreyPlaybin); + pub fn audrey_playbin_go_to_next_track(self_: *mut AudreyPlaybin); + pub fn audrey_playbin_go_to_prev_track(self_: *mut AudreyPlaybin); + pub fn audrey_playbin_remove_track(self_: *mut AudreyPlaybin, position: c_uint); + pub fn audrey_playbin_clear(self_: *mut AudreyPlaybin); + pub fn audrey_playbin_append_track(self_: *mut AudreyPlaybin, song: *mut AudreySubsonicSong); + pub fn audrey_playbin_append_track_async(self_: *mut AudreyPlaybin, song: *mut AudreySubsonicSong, _callback_: gio::GAsyncReadyCallback, _callback__target: *mut c_void); + pub fn audrey_playbin_append_track_finish(self_: *mut AudreyPlaybin, _res_: *mut gio::GAsyncResult); + pub fn audrey_playbin_move_track(self_: *mut AudreyPlaybin, from: c_uint, to: c_uint); + pub fn audrey_playbin_stop(self_: *mut AudreyPlaybin); + pub fn audrey_playbin_get_state(self_: *mut AudreyPlaybin) -> AudreyPlaybinState; + pub fn audrey_playbin_get_volume(self_: *mut AudreyPlaybin) -> c_int; + pub fn audrey_playbin_set_volume(self_: *mut AudreyPlaybin, value: c_int); + pub fn audrey_playbin_get_mute(self_: *mut AudreyPlaybin) -> gboolean; + pub fn audrey_playbin_set_mute(self_: *mut AudreyPlaybin, value: gboolean); + pub fn audrey_playbin_get_play_queue_position(self_: *mut AudreyPlaybin) -> c_int; + pub fn audrey_playbin_get_position(self_: *mut AudreyPlaybin) -> c_double; + pub fn audrey_playbin_get_duration(self_: *mut AudreyPlaybin) -> c_double; + pub fn audrey_playbin_get_api(self_: *mut AudreyPlaybin) -> *mut AudreySubsonicClient; + pub fn audrey_playbin_set_api(self_: *mut AudreyPlaybin, value: *mut AudreySubsonicClient); + pub fn audrey_playbin_get_play_queue(self_: *mut AudreyPlaybin) -> *mut gio::GListModel; + pub fn audrey_playbin_get_play_queue_length(self_: *mut AudreyPlaybin) -> c_uint; + + //========================================================================= + // AudreyPlaybinSong + //========================================================================= + pub fn audrey_playbin_song_get_type() -> GType; + pub fn audrey_playbin_song_new(api: *mut AudreySubsonicClient, song: *mut AudreySubsonicSong) -> *mut AudreyPlaybinSong; + pub fn audrey_playbin_song_need_cover_art(self_: *mut AudreyPlaybinSong); + pub fn audrey_playbin_song_get_id(self_: *mut AudreyPlaybinSong) -> *const c_char; + pub fn audrey_playbin_song_get_title(self_: *mut AudreyPlaybinSong) -> *const c_char; + pub fn audrey_playbin_song_get_artist(self_: *mut AudreyPlaybinSong) -> *const c_char; + pub fn audrey_playbin_song_get_album(self_: *mut AudreyPlaybinSong) -> *const c_char; + pub fn audrey_playbin_song_get_genre(self_: *mut AudreyPlaybinSong) -> *const c_char; + pub fn audrey_playbin_song_get_duration(self_: *mut AudreyPlaybinSong) -> i64; + pub fn audrey_playbin_song_get_track(self_: *mut AudreyPlaybinSong) -> i64; + pub fn audrey_playbin_song_get_play_count(self_: *mut AudreyPlaybinSong) -> i64; + pub fn audrey_playbin_song_get_thumbnail(self_: *mut AudreyPlaybinSong) -> *mut gdk::GdkPaintable; + + //========================================================================= + // AudreySubsonicAlbum + //========================================================================= + pub fn audrey_subsonic_album_get_type() -> GType; + pub fn audrey_subsonic_album_new(reader: *mut json::JsonReader) -> *mut AudreySubsonicAlbum; + + //========================================================================= + // AudreySubsonicArtist + //========================================================================= + pub fn audrey_subsonic_artist_get_type() -> GType; + pub fn audrey_subsonic_artist_new(index: *const c_char, reader: *mut json::JsonReader) -> *mut AudreySubsonicArtist; + pub fn audrey_subsonic_artist_get_name(self_: *mut AudreySubsonicArtist) -> *const c_char; + + //========================================================================= + // AudreySubsonicClient + //========================================================================= + pub fn audrey_subsonic_client_get_type() -> GType; + pub fn audrey_subsonic_client_new_with_token(url: *const c_char, username: *const c_char, token: *const c_char, salt: *const c_char) -> *mut AudreySubsonicClient; + pub fn audrey_subsonic_client_ping(self_: *mut AudreySubsonicClient, _callback_: gio::GAsyncReadyCallback, _callback__target: *mut c_void); + pub fn audrey_subsonic_client_ping_finish(self_: *mut AudreySubsonicClient, _res_: *mut gio::GAsyncResult, error: *mut *mut glib::GError); + pub fn audrey_subsonic_client_scrobble(self_: *mut AudreySubsonicClient, id: *const c_char, _callback_: gio::GAsyncReadyCallback, _callback__target: *mut c_void); + pub fn audrey_subsonic_client_scrobble_finish(self_: *mut AudreySubsonicClient, _res_: *mut gio::GAsyncResult, error: *mut *mut glib::GError); + pub fn audrey_subsonic_client_get_random_songs(self_: *mut AudreySubsonicClient, parameters: *const c_char, callback: AudreySubsonicSongCallback, callback_target: *mut c_void, _callback_: gio::GAsyncReadyCallback, _callback__target: *mut c_void); + pub fn audrey_subsonic_client_get_random_songs_finish(self_: *mut AudreySubsonicClient, _res_: *mut gio::GAsyncResult, error: *mut *mut glib::GError); + pub fn audrey_subsonic_client_stream_uri(self_: *mut AudreySubsonicClient, id: *const c_char) -> *mut c_char; + pub fn audrey_subsonic_client_cover_art_uri(self_: *mut AudreySubsonicClient, id: *const c_char, size: c_int) -> *mut c_char; + pub fn audrey_subsonic_client_cover_art(self_: *mut AudreySubsonicClient, id: *const c_char, size: c_int, priority: c_int, cancellable: *mut gio::GCancellable, _callback_: gio::GAsyncReadyCallback, _callback__target: *mut c_void); + pub fn audrey_subsonic_client_cover_art_finish(self_: *mut AudreySubsonicClient, _res_: *mut gio::GAsyncResult, error: *mut *mut glib::GError) -> *mut gdk_pixbuf::GdkPixbuf; + pub fn audrey_subsonic_client_new() -> *mut AudreySubsonicClient; + + //========================================================================= + // AudreyUiPlayQueue + //========================================================================= + pub fn audrey_ui_play_queue_get_type() -> GType; + pub fn audrey_ui_play_queue_new() -> *mut AudreyUiPlayQueue; + pub fn audrey_ui_play_queue_get_playbin(self_: *mut AudreyUiPlayQueue) -> *mut AudreyPlaybin; + pub fn audrey_ui_play_queue_set_playbin(self_: *mut AudreyUiPlayQueue, value: *mut AudreyPlaybin); + pub fn audrey_ui_play_queue_get_can_clear_all(self_: *mut AudreyUiPlayQueue) -> gboolean; + + //========================================================================= + // AudreyUiSetup + //========================================================================= + pub fn audrey_ui_setup_get_type() -> GType; + pub fn audrey_ui_setup_load(self_: *mut AudreyUiSetup); + pub fn audrey_ui_setup_save(self_: *mut AudreyUiSetup); + pub fn audrey_ui_setup_new() -> *mut AudreyUiSetup; + pub fn audrey_ui_setup_get_status(self_: *mut AudreyUiSetup) -> *const c_char; + pub fn audrey_ui_setup_get_authn_can_edit(self_: *mut AudreyUiSetup) -> gboolean; + pub fn audrey_ui_setup_get_authn_can_validate(self_: *mut AudreyUiSetup) -> gboolean; + pub fn audrey_ui_setup_get_server_url(self_: *mut AudreyUiSetup) -> *const c_char; + pub fn audrey_ui_setup_set_server_url(self_: *mut AudreyUiSetup, value: *const c_char); + pub fn audrey_ui_setup_get_username(self_: *mut AudreyUiSetup) -> *const c_char; + pub fn audrey_ui_setup_set_username(self_: *mut AudreyUiSetup, value: *const c_char); + pub fn audrey_ui_setup_get_password(self_: *mut AudreyUiSetup) -> *const c_char; + pub fn audrey_ui_setup_set_password(self_: *mut AudreyUiSetup, value: *const c_char); + +} diff --git a/src/main.rs b/src/main.rs index 56f15c4..73c0837 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,12 +6,11 @@ pub mod ui; use gtk::prelude::*; use gtk::{gio, glib}; -extern crate libsecret; - #[link(name = "audrey")] #[link(name = "gcrypt")] #[link(name = "json-glib-1.0")] #[link(name = "mpv")] +#[link(name = "secret-1")] #[link(name = "soup-3.0")] extern "C" {}