Compare commits

..

No commits in common. "2f70f6154715f9ea8dded70607e3e04375a39111" and "4193fb72c2542227156af5c466129069326abb31" have entirely different histories.

22 changed files with 266 additions and 688 deletions

263
Cargo.lock generated
View file

@ -9,6 +9,7 @@ dependencies = [
"glib-build-tools", "glib-build-tools",
"gtk4", "gtk4",
"libadwaita", "libadwaita",
"libsecret",
] ]
[[package]] [[package]]
@ -31,7 +32,7 @@ checksum = "e8a0ea147c94108c9613235388f540e4d14c327f7081c9e471fc8ee8a2533e69"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-sys-rs", "cairo-sys-rs",
"glib", "glib 0.20.4",
"libc", "libc",
] ]
@ -41,9 +42,19 @@ version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.20.4",
"libc", "libc",
"system-deps", "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",
] ]
[[package]] [[package]]
@ -142,8 +153,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4c29071a9e92337d8270a85cb0510cda4ac478be26d09ad027cc1d081911b19" checksum = "c4c29071a9e92337d8270a85cb0510cda4ac478be26d09ad027cc1d081911b19"
dependencies = [ dependencies = [
"gdk-pixbuf-sys", "gdk-pixbuf-sys",
"gio", "gio 0.20.4",
"glib", "glib 0.20.4",
"libc", "libc",
] ]
@ -153,11 +164,11 @@ version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "687343b059b91df5f3fbd87b4307038fa9e647fcc0461d0d3f93e94fee20bf3d" checksum = "687343b059b91df5f3fbd87b4307038fa9e647fcc0461d0d3f93e94fee20bf3d"
dependencies = [ dependencies = [
"gio-sys", "gio-sys 0.20.4",
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"libc", "libc",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -169,8 +180,8 @@ dependencies = [
"cairo-rs", "cairo-rs",
"gdk-pixbuf", "gdk-pixbuf",
"gdk4-sys", "gdk4-sys",
"gio", "gio 0.20.4",
"glib", "glib 0.20.4",
"libc", "libc",
"pango", "pango",
] ]
@ -183,13 +194,31 @@ checksum = "7d3c03d1ea9d5199f14f060890fde68a3b5ec5699144773d1fa6abf337bfbc9c"
dependencies = [ dependencies = [
"cairo-sys-rs", "cairo-sys-rs",
"gdk-pixbuf-sys", "gdk-pixbuf-sys",
"gio-sys", "gio-sys 0.20.4",
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"libc", "libc",
"pango-sys", "pango-sys",
"pkg-config", "pkg-config",
"system-deps", "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",
] ]
[[package]] [[package]]
@ -202,26 +231,61 @@ dependencies = [
"futures-core", "futures-core",
"futures-io", "futures-io",
"futures-util", "futures-util",
"gio-sys", "gio-sys 0.20.4",
"glib", "glib 0.20.4",
"libc", "libc",
"pin-project-lite", "pin-project-lite",
"smallvec", "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]] [[package]]
name = "gio-sys" name = "gio-sys"
version = "0.20.4" version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f7efc368de04755344f0084104835b6bb71df2c1d41e37d863947392a894779" checksum = "4f7efc368de04755344f0084104835b6bb71df2c1d41e37d863947392a894779"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"libc", "libc",
"system-deps", "system-deps 7.0.3",
"windows-sys", "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]] [[package]]
name = "glib" name = "glib"
version = "0.20.4" version = "0.20.4"
@ -234,10 +298,10 @@ dependencies = [
"futures-executor", "futures-executor",
"futures-task", "futures-task",
"futures-util", "futures-util",
"gio-sys", "gio-sys 0.20.4",
"glib-macros", "glib-macros 0.20.4",
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"libc", "libc",
"memchr", "memchr",
"smallvec", "smallvec",
@ -249,7 +313,20 @@ version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7029c2651d9b5d5a3eea93ec8a1995665c6d3a69ce9bf6042ad9064d134736d8" checksum = "7029c2651d9b5d5a3eea93ec8a1995665c6d3a69ce9bf6042ad9064d134736d8"
dependencies = [ dependencies = [
"gio", "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",
] ]
[[package]] [[package]]
@ -265,6 +342,16 @@ dependencies = [
"syn", "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]] [[package]]
name = "glib-sys" name = "glib-sys"
version = "0.20.4" version = "0.20.4"
@ -272,7 +359,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f9eca5d88cfa6a453b00d203287c34a2b7cac3a7831779aa2bb0b3c7233752b" checksum = "5f9eca5d88cfa6a453b00d203287c34a2b7cac3a7831779aa2bb0b3c7233752b"
dependencies = [ dependencies = [
"libc", "libc",
"system-deps", "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",
] ]
[[package]] [[package]]
@ -281,9 +379,9 @@ version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462" checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.20.4",
"libc", "libc",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -292,7 +390,7 @@ version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f53144c7fe78292705ff23935f1477d511366fb2f73c43d63b37be89076d2fe" checksum = "1f53144c7fe78292705ff23935f1477d511366fb2f73c43d63b37be89076d2fe"
dependencies = [ dependencies = [
"glib", "glib 0.20.4",
"graphene-sys", "graphene-sys",
"libc", "libc",
] ]
@ -303,10 +401,10 @@ version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e741797dc5081e59877a4d72c442c72d61efdd99161a0b1c1b29b6b988934b99" checksum = "e741797dc5081e59877a4d72c442c72d61efdd99161a0b1c1b29b6b988934b99"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.20.4",
"libc", "libc",
"pkg-config", "pkg-config",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -317,7 +415,7 @@ checksum = "aa21a2f7c51ee1c6cc1242c2faf3aae2b7566138f182696759987bde8219e922"
dependencies = [ dependencies = [
"cairo-rs", "cairo-rs",
"gdk4", "gdk4",
"glib", "glib 0.20.4",
"graphene-rs", "graphene-rs",
"gsk4-sys", "gsk4-sys",
"libc", "libc",
@ -332,12 +430,12 @@ checksum = "0f9fb607554f9f4e8829eb7ea301b0fde051e1dbfd5d16b143a8a9c2fac6c01b"
dependencies = [ dependencies = [
"cairo-sys-rs", "cairo-sys-rs",
"gdk4-sys", "gdk4-sys",
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"graphene-sys", "graphene-sys",
"libc", "libc",
"pango-sys", "pango-sys",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -351,8 +449,8 @@ dependencies = [
"futures-channel", "futures-channel",
"gdk-pixbuf", "gdk-pixbuf",
"gdk4", "gdk4",
"gio", "gio 0.20.4",
"glib", "glib 0.20.4",
"graphene-rs", "graphene-rs",
"gsk4", "gsk4",
"gtk4-macros", "gtk4-macros",
@ -382,14 +480,14 @@ dependencies = [
"cairo-sys-rs", "cairo-sys-rs",
"gdk-pixbuf-sys", "gdk-pixbuf-sys",
"gdk4-sys", "gdk4-sys",
"gio-sys", "gio-sys 0.20.4",
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"graphene-sys", "graphene-sys",
"gsk4-sys", "gsk4-sys",
"libc", "libc",
"pango-sys", "pango-sys",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -421,8 +519,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878" checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878"
dependencies = [ dependencies = [
"gdk4", "gdk4",
"gio", "gio 0.20.4",
"glib", "glib 0.20.4",
"gtk4", "gtk4",
"libadwaita-sys", "libadwaita-sys",
"libc", "libc",
@ -436,13 +534,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6" checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6"
dependencies = [ dependencies = [
"gdk4-sys", "gdk4-sys",
"gio-sys", "gio-sys 0.20.4",
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"gtk4-sys", "gtk4-sys",
"libc", "libc",
"pango-sys", "pango-sys",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -451,6 +549,32 @@ version = "0.2.161"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" 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]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"
@ -472,8 +596,8 @@ version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa26aa54b11094d72141a754901cd71d9356432bb8147f9cace8d9c7ba95f356" checksum = "aa26aa54b11094d72141a754901cd71d9356432bb8147f9cace8d9c7ba95f356"
dependencies = [ dependencies = [
"gio", "gio 0.20.4",
"glib", "glib 0.20.4",
"libc", "libc",
"pango-sys", "pango-sys",
] ]
@ -484,10 +608,10 @@ version = "0.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84fd65917bf12f06544ae2bbc200abf9fc0a513a5a88a0fa81013893aef2b838" checksum = "84fd65917bf12f06544ae2bbc200abf9fc0a513a5a88a0fa81013893aef2b838"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.20.4",
"gobject-sys", "gobject-sys 0.20.4",
"libc", "libc",
"system-deps", "system-deps 7.0.3",
] ]
[[package]] [[package]]
@ -605,13 +729,26 @@ dependencies = [
"unicode-ident", "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]] [[package]]
name = "system-deps" name = "system-deps"
version = "7.0.3" version = "7.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005"
dependencies = [ dependencies = [
"cfg-expr", "cfg-expr 0.17.0",
"heck", "heck",
"pkg-config", "pkg-config",
"toml", "toml",
@ -624,6 +761,26 @@ version = "0.12.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" 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]] [[package]]
name = "toml" name = "toml"
version = "0.8.19" version = "0.8.19"

View file

@ -6,6 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
adw = { version = "0.7.0", package = "libadwaita", features = ["v1_6"] } adw = { version = "0.7.0", package = "libadwaita", features = ["v1_6"] }
gtk = { version = "0.9.2", package = "gtk4", features = ["v4_16"] } gtk = { version = "0.9.2", package = "gtk4", features = ["v4_16"] }
libsecret = { version = "0.5.0", features = ["v0_21"] }
[build-dependencies] [build-dependencies]
glib-build-tools = "0.20.0" glib-build-tools = "0.20.0"

View file

@ -1,11 +1,11 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $AudreyUiPlayQueue: Adw.Bin { template $UiPlayQueue: Adw.Bin {
name: "play-queue"; name: "play-queue";
child: Stack { child: Stack {
visible-child-name: bind $visible_child_name (template.playbin as <$AudreyPlaybin>.play-queue-length) as <string>; visible-child-name: bind $visible_child_name (template.playbin as <$Playbin>.play-queue-length) as <string>;
StackPage { StackPage {
name: "empty"; name: "empty";
@ -31,7 +31,7 @@ template $AudreyUiPlayQueue: Adw.Bin {
activate => $on_row_activated (); activate => $on_row_activated ();
model: NoSelection { model: NoSelection {
model: bind template.playbin as <$AudreyPlaybin>.play_queue; model: bind template.playbin as <$Playbin>.play_queue;
}; };
factory: SignalListItemFactory { factory: SignalListItemFactory {

View file

@ -1,6 +1,6 @@
using Gtk 4.0; using Gtk 4.0;
template $AudreyUiPlayQueueSong: Box { template $UiPlayQueueSong: Box {
height-request: 48; height-request: 48;
spacing: 12; spacing: 12;
margin-start: 6; margin-start: 6;
@ -35,7 +35,7 @@ template $AudreyUiPlayQueueSong: Box {
margin-top: 1; margin-top: 1;
margin-bottom: 1; margin-bottom: 1;
pixel-size: 50; pixel-size: 50;
paintable: bind template.song as <$AudreyPlaybinSong>.thumbnail; paintable: bind template.song as <$PlaybinSong>.thumbnail;
} }
Box title_box { Box title_box {
@ -58,7 +58,7 @@ template $AudreyUiPlayQueueSong: Box {
max-width-chars: 90; max-width-chars: 90;
justify: fill; justify: fill;
label: bind template.song as <$AudreyPlaybinSong>.title; label: bind template.song as <$PlaybinSong>.title;
} }
Label { Label {
@ -71,7 +71,7 @@ template $AudreyUiPlayQueueSong: Box {
max-width-chars: 90; max-width-chars: 90;
justify: fill; justify: fill;
label: bind template.song as <$AudreyPlaybinSong>.artist; label: bind template.song as <$PlaybinSong>.artist;
} }
} }
} }
@ -83,12 +83,12 @@ template $AudreyUiPlayQueueSong: Box {
single-line-mode: true; single-line-mode: true;
styles [ "numeric", "dim-label" ] styles [ "numeric", "dim-label" ]
label: bind $format_duration (template.song as <$AudreyPlaybinSong>.duration) as <string>; label: bind $format_duration (template.song as <$PlaybinSong>.duration) as <string>;
} }
Button { Button {
focusable: true; focusable: true;
// TODO icon-name: bind $star_button_icon_name (template.song as <$AudreyPlaybinSong>.starred) as <string>; // TODO icon-name: bind $star_button_icon_name (template.song as <$PlaybinSong>.starred) as <string>;
icon-name: bind $star_button_icon_name () as <string>; icon-name: bind $star_button_icon_name () as <string>;
styles [ "flat" ] styles [ "flat" ]
valign: center; valign: center;
@ -116,7 +116,7 @@ template $AudreyUiPlayQueueSong: Box {
DropTarget { DropTarget {
actions: move; actions: move;
formats: "AudreyUiPlayQueueSong"; formats: "UiPlayQueueSong";
preload: true; preload: true;
drop => $on_drop (); drop => $on_drop ();

View file

@ -1,7 +1,7 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $AudreyUiPlaybar: Adw.Bin { template $UiPlaybar: Adw.Bin {
child: CenterBox { child: CenterBox {
hexpand: true; hexpand: true;
styles [ styles [
@ -66,7 +66,7 @@ template $AudreyUiPlaybar: Adw.Bin {
"numeric", "numeric",
] ]
label: bind $format_timestamp (template.playbin as <$AudreyPlaybin>.position) as <string>; label: bind $format_timestamp (template.playbin as <$Playbin>.position) as <string>;
} }
[center] [center]
@ -74,12 +74,12 @@ template $AudreyUiPlaybar: Adw.Bin {
name: "seek-scale"; name: "seek-scale";
orientation: horizontal; orientation: horizontal;
width-request: 400; width-request: 400;
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
adjustment: Adjustment { adjustment: Adjustment {
lower: 0; lower: 0;
value: bind template.playbin as <$AudreyPlaybin>.position; value: bind template.playbin as <$Playbin>.position;
upper: bind template.playbin as <$AudreyPlaybin>.duration; upper: bind template.playbin as <$Playbin>.duration;
}; };
change-value => $on_play_position_seek (); change-value => $on_play_position_seek ();
@ -92,7 +92,7 @@ template $AudreyUiPlaybar: Adw.Bin {
"numeric", "numeric",
] ]
label: bind $format_timestamp (template.playbin as <$AudreyPlaybin>.duration) as <string>; label: bind $format_timestamp (template.playbin as <$Playbin>.duration) as <string>;
} }
} }
@ -103,7 +103,7 @@ template $AudreyUiPlaybar: Adw.Bin {
Button { Button {
icon-name: "media-skip-backward"; icon-name: "media-skip-backward";
valign: center; valign: center;
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
clicked => $on_skip_backward_clicked (); clicked => $on_skip_backward_clicked ();
} }
@ -111,15 +111,15 @@ template $AudreyUiPlaybar: Adw.Bin {
Button { Button {
icon-name: "media-seek-backward"; icon-name: "media-seek-backward";
valign: center; valign: center;
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
clicked => $seek_backward (); clicked => $seek_backward ();
} }
Button { Button {
icon-name: bind $play_pause_icon_name (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <string>; icon-name: bind $play_pause_icon_name (template.playbin as <$Playbin>.state as <$PlaybinState>) as <string>;
valign: center; valign: center;
sensitive: bind $can_press_play (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>, template.playbin as <$AudreyPlaybin>.play-queue-length) as <bool>; sensitive: bind $can_press_play (template.playbin as <$Playbin>.state as <$PlaybinState>, template.playbin as <$Playbin>.play-queue-length) as <bool>;
clicked => $on_play_pause_clicked (); clicked => $on_play_pause_clicked ();
} }
@ -127,7 +127,7 @@ template $AudreyUiPlaybar: Adw.Bin {
Button { Button {
icon-name: "media-seek-forward"; icon-name: "media-seek-forward";
valign: center; valign: center;
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
clicked => $seek_forward (); clicked => $seek_forward ();
} }
@ -135,7 +135,7 @@ template $AudreyUiPlaybar: Adw.Bin {
Button { Button {
icon-name: "media-skip-forward"; icon-name: "media-skip-forward";
valign: center; valign: center;
sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; sensitive: bind $playbin_active (template.playbin as <$Playbin>.state as <$PlaybinState>) as <bool>;
clicked => $on_skip_forward_clicked (); clicked => $on_skip_forward_clicked ();
} }
@ -150,7 +150,7 @@ template $AudreyUiPlaybar: Adw.Bin {
} }
Button { Button {
icon-name: bind $mute_button_icon_name (template.playbin as <$AudreyPlaybin>.mute) as <string>; icon-name: bind $mute_button_icon_name (template.playbin as <$Playbin>.mute) as <string>;
valign: center; valign: center;
clicked => $on_mute_toggle (); clicked => $on_mute_toggle ();

View file

@ -1,7 +1,7 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $AudreyUiSetup: Adw.PreferencesDialog { template $UiSetup: Adw.PreferencesDialog {
title: _("Setup"); title: _("Setup");
Adw.ToolbarView { Adw.ToolbarView {

View file

@ -1,7 +1,7 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $AudreyUiWindow: Adw.ApplicationWindow { template $UiWindow: Adw.ApplicationWindow {
title: _("audrey"); title: _("audrey");
default-width: 800; default-width: 800;
default-height: 600; default-height: 600;
@ -109,7 +109,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
} }
} }
$AudreyUiPlayQueue play_queue { $UiPlayQueue play_queue {
hexpand: true; hexpand: true;
halign: fill; halign: fill;
@ -126,7 +126,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
}; };
[bottom] [bottom]
$AudreyUiPlaybar playbar { $UiPlaybar playbar {
song: bind template.song; song: bind template.song;
playbin: bind template.playbin; playbin: bind template.playbin;
playing_cover_art: bind template.playing_cover_art; playing_cover_art: bind template.playing_cover_art;

View file

@ -1,497 +0,0 @@
// 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<unsafe extern "C" fn(*mut AudreySubsonicSong, *mut c_void)>;
// 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);
}

View file

@ -6,11 +6,12 @@ pub mod ui;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::{gio, glib}; use gtk::{gio, glib};
extern crate libsecret;
#[link(name = "audrey")] #[link(name = "audrey")]
#[link(name = "gcrypt")] #[link(name = "gcrypt")]
#[link(name = "json-glib-1.0")] #[link(name = "json-glib-1.0")]
#[link(name = "mpv")] #[link(name = "mpv")]
#[link(name = "secret-1")]
#[link(name = "soup-3.0")] #[link(name = "soup-3.0")]
extern "C" {} extern "C" {}

View file

@ -34,5 +34,4 @@ audrey_c = static_library(
'--gresources', '--gresources',
meson.project_source_root() / 'resources/audrey.gresource.xml', meson.project_source_root() / 'resources/audrey.gresource.xml',
], ],
vala_gir: 'audrey-0.gir',
) )

View file

@ -1,5 +1,5 @@
[DBus (name = "org.mpris.MediaPlayer2")] [DBus (name = "org.mpris.MediaPlayer2")]
class Audrey.Mpris : Object { class Mpris : Object {
internal signal void on_raise (); internal signal void on_raise ();
internal signal void on_quit (); internal signal void on_quit ();
@ -32,7 +32,7 @@ class Audrey.Mpris : Object {
} }
[DBus (name = "org.mpris.MediaPlayer2.Player")] [DBus (name = "org.mpris.MediaPlayer2.Player")]
class Audrey.MprisPlayer : Object { class MprisPlayer : Object {
internal signal void on_next (); internal signal void on_next ();
internal signal void on_previous (); internal signal void on_previous ();
internal signal void on_pause (); internal signal void on_pause ();

View file

@ -1,2 +0,0 @@
mod song;
pub use song::Song;

View file

@ -1,15 +1,15 @@
public enum Audrey.PlaybinState { public enum PlaybinState {
STOPPED, STOPPED,
PAUSED, PAUSED,
PLAYING, PLAYING,
} }
private struct Audrey.CommandCallback { private struct CommandCallback {
unowned SourceFunc callback; unowned SourceFunc callback;
int error; int error;
} }
public class Audrey.PlaybinSong : Object { public class PlaybinSong : Object {
private Subsonic.Song inner; private Subsonic.Song inner;
public string id { get { return inner.id; } } public string id { get { return inner.id; } }
public string title { get { return inner.title; } } public string title { get { return inner.title; } }
@ -59,7 +59,7 @@ public class Audrey.PlaybinSong : Object {
} }
} }
public class Audrey.Playbin : GLib.Object { public class Playbin : GLib.Object {
private Mpv.Handle mpv = new Mpv.Handle (); private Mpv.Handle mpv = new Mpv.Handle ();
private int _volume = 100; private int _volume = 100;
private bool _mute = false; private bool _mute = false;

View file

@ -1,14 +0,0 @@
mod imp {
#[derive(gtk::Properties, Default)]
#[properties(wrapper_type = super::Song)]
pub struct Song {
inner: RefCell<subsonic::Song>,
#[property(get = |song| song.inner.borrow().id)]
id: &'static str,
}
}
glib::wrapper! {
pub struct Song(ObjectSubclass<imp::Song>);
}

View file

@ -1,11 +1,11 @@
public errordomain Audrey.Subsonic.Error { public errordomain Subsonic.Error {
BAD_AUTHN, BAD_AUTHN,
ERROR, ERROR,
} }
public delegate void Audrey.Subsonic.SongCallback (Song song); public delegate void Subsonic.SongCallback (Song song);
public class Audrey.Subsonic.Artist : Object { public class Subsonic.Artist : Object {
public string index; public string index;
public string id; public string id;
public string name { get; private set; } public string name { get; private set; }
@ -38,7 +38,7 @@ public class Audrey.Subsonic.Artist : Object {
} }
} }
public class Audrey.Subsonic.Album : Object { public class Subsonic.Album : Object {
public string id; public string id;
public string name; public string name;
@ -53,7 +53,7 @@ public class Audrey.Subsonic.Album : Object {
} }
} }
public struct Audrey.Subsonic.Song { public struct Subsonic.Song {
public string id; public string id;
public string title; public string title;
public string album; public string album;
@ -109,7 +109,7 @@ public struct Audrey.Subsonic.Song {
} }
} }
public class Audrey.Subsonic.Client : Object { public class Subsonic.Client : Object {
private Soup.Session session; private Soup.Session session;
private string url; private string url;
private string parameters; private string parameters;

View file

@ -1,2 +0,0 @@
mod song;
pub use song::Song;

View file

@ -1,7 +1,7 @@
// song widget+drag behavior taken from gnome music // song widget+drag behavior taken from gnome music
[GtkTemplate (ui = "/eu/callcc/audrey/play_queue_song.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/play_queue_song.ui")]
class Audrey.Ui.PlayQueueSong : Gtk.Box { class Ui.PlayQueueSong : Gtk.Box {
public bool draggable { get; set; default = false; } public bool draggable { get; set; default = false; }
public bool show_position { get; set; default = false; } public bool show_position { get; set; default = false; }
public bool show_artist { get; set; default = false; } public bool show_artist { get; set; default = false; }
@ -112,7 +112,7 @@ class Audrey.Ui.PlayQueueSong : Gtk.Box {
} }
[GtkTemplate (ui = "/eu/callcc/audrey/play_queue.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/play_queue.ui")]
public class Audrey.Ui.PlayQueue : Adw.Bin { public class Ui.PlayQueue : Adw.Bin {
private weak Playbin _playbin; private weak Playbin _playbin;
public Playbin playbin { public Playbin playbin {
get { return _playbin; } get { return _playbin; }

View file

@ -1,65 +0,0 @@
mod imp {
use std::cell::RefCell;
//use crate::playbin;
use gtk::{glib, prelude::*, subclass::prelude::*};
#[derive(gtk::CompositeTemplate, glib::Properties, Default)]
#[template(resource = "/eu/callcc/audrey/play_queue_song.ui")]
#[properties(wrapper_type = super::Song)]
pub struct Song {
#[property(get, set, default = false)]
draggable: RefCell<bool>,
#[property(get, set, default = false)]
show_position: RefCell<bool>,
#[property(get, set, default = false)]
show_artist: RefCell<bool>,
#[property(get, set, default = false)]
show_cover: RefCell<bool>,
#[property(get, set = Self::set_current, default = false)]
current: RefCell<bool>,
#[property(get, set)]
displayed_position: RefCell<u32>,
//#[property(get, set)]
//song: playbin::Song,
//playbin: playbin::Playbin,
connection: RefCell<u64>,
drag_x: RefCell<f64>,
drag_y: RefCell<f64>,
drag_widget: RefCell<Option<gtk::ListBox>>,
}
#[glib::object_subclass]
impl ObjectSubclass for Song {
const NAME: &'static str = "AudreyUiPlayQueueSong";
type Type = super::Song;
type ParentType = gtk::Box;
}
#[glib::derived_properties]
impl ObjectImpl for Song {}
impl WidgetImpl for Song {}
impl BoxImpl for Song {}
#[gtk::template_callbacks]
impl Song {
fn set_current(&self, value: bool) {
*self.current.borrow_mut() = value;
if value {
self.obj().add_css_class("playing");
} else {
self.obj().remove_css_class("playing");
}
}
}
}
use gtk::glib;
glib::wrapper! {
pub struct Song(ObjectSubclass<imp::Song>)
@extends gtk::Box, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
}

View file

@ -1,5 +1,5 @@
[GtkTemplate (ui = "/eu/callcc/audrey/playbar.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/playbar.ui")]
class Audrey.Ui.Playbar : Adw.Bin { class Ui.Playbar : Adw.Bin {
public PlaybinSong? song { get; set; } public PlaybinSong? song { get; set; }
public Gdk.Paintable? playing_cover_art { get; set; } public Gdk.Paintable? playing_cover_art { get; set; }
public weak Playbin playbin { get; set; } public weak Playbin playbin { get; set; }

View file

@ -17,7 +17,7 @@ static void salt_password (string password, out string token, out string salt) {
} }
[GtkTemplate (ui = "/eu/callcc/audrey/setup.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/setup.ui")]
public class Audrey.Ui.Setup : Adw.PreferencesDialog { public class Ui.Setup : Adw.PreferencesDialog {
public string status { get; private set; default = _("Not connected"); } public string status { get; private set; default = _("Not connected"); }
public bool authn_can_edit { get; private set; default = true; } public bool authn_can_edit { get; private set; default = true; }

View file

@ -2,18 +2,18 @@ mod ffi {
use gtk::glib; use gtk::glib;
#[repr(C)] #[repr(C)]
pub struct AudreyUiWindow { pub struct UiWindow {
parent_instance: adw::ffi::AdwApplicationWindow, parent_instance: adw::ffi::AdwApplicationWindow,
} }
#[repr(C)] #[repr(C)]
pub struct AudreyUiWindowClass { pub struct UiWindowClass {
parent_class: adw::ffi::AdwApplicationWindowClass, parent_class: adw::ffi::AdwApplicationWindowClass,
} }
extern "C" { extern "C" {
pub fn audrey_ui_window_get_type() -> glib::ffi::GType; pub fn ui_window_get_type() -> glib::ffi::GType;
pub fn audrey_ui_window_new(app: *mut gtk::ffi::GtkApplication) -> *mut AudreyUiWindow; pub fn ui_window_new(app: *mut gtk::ffi::GtkApplication) -> *mut UiWindow;
} }
} }
@ -21,12 +21,12 @@ use adw::prelude::*;
use gtk::{gio, glib}; use gtk::{gio, glib};
glib::wrapper! { glib::wrapper! {
pub struct Window(Object<ffi::AudreyUiWindow, ffi::AudreyUiWindowClass>) pub struct Window(Object<ffi::UiWindow, ffi::UiWindowClass>)
@extends adw::ApplicationWindow, gtk::ApplicationWindow, gtk::Window, gtk::Widget, @extends adw::ApplicationWindow, gtk::ApplicationWindow, gtk::Window, gtk::Widget,
@implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; @implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
match fn { match fn {
type_ => || ffi::audrey_ui_window_get_type(), type_ => || ffi::ui_window_get_type(),
} }
} }
@ -34,6 +34,6 @@ impl Window {
pub fn new(app: &impl IsA<gtk::Application>) -> Self { pub fn new(app: &impl IsA<gtk::Application>) -> Self {
use glib::translate::*; use glib::translate::*;
unsafe { from_glib_none(ffi::audrey_ui_window_new(app.as_ref().to_glib_none().0)) } unsafe { from_glib_none(ffi::ui_window_new(app.as_ref().to_glib_none().0)) }
} }
} }

View file

@ -1,7 +1,7 @@
[GtkTemplate (ui = "/eu/callcc/audrey/window.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/window.ui")]
class Audrey.Ui.Window : Adw.ApplicationWindow { class Ui.Window : Adw.ApplicationWindow {
[GtkChild] public unowned PlayQueue play_queue; [GtkChild] public unowned Ui.PlayQueue play_queue;
[GtkChild] public unowned Playbar playbar; [GtkChild] public unowned Ui.Playbar playbar;
//[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks; //[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks;
private Setup setup; private Setup setup;