Compare commits

...

3 commits

Author SHA1 Message Date
d37ec6a19a decrash 2024-11-13 16:36:20 +01:00
f0f69b7323 try this 2024-11-13 16:36:20 +01:00
48a5beb8b6 move some things around 2024-11-13 16:36:20 +01:00
4 changed files with 19 additions and 15 deletions

View file

@ -35,12 +35,12 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
vexpand: true;
Adw.ViewStackPage {
icon-name: "media-optical-cd";
title: _("Albums");
icon-name: "folder-music-symbolic";
title: _("Browse");
child: Adw.NavigationView {
Adw.NavigationPage {
title: _("Albums");
title: _("Browse");
vexpand: true;
child: Adw.ToolbarView {

View file

@ -17,15 +17,19 @@ mod imp {
impl ObjectImpl for Application {}
impl ApplicationImpl for Application {
// called once by the primary instance
fn startup(&self) {
self.parent_startup();
ui::Window::new(self.obj().as_ref());
}
// executed by the primary instance
fn activate(&self) {
self.parent_activate();
match self.obj().active_window() {
None => {
let window = ui::Window::new(self.obj().as_ref());
window.present();
}
Some(win) => win.present(),
}
self.obj()
.active_window()
.expect("no window was active")
.present();
}
}

View file

@ -41,9 +41,6 @@ fn main() -> glib::ExitCode {
init_tracing();
ui::Playbar::ensure_type();
ui::PlayQueue::ensure_type();
gtk::disable_setlocale();
bindtextdomain("audrey", meson_config::LOCALEDIR).expect("failed to bind text domain");
bind_textdomain_codeset("audrey", "UTF-8").expect("failed to bind textdomaincodeset");

View file

@ -176,7 +176,7 @@ mod imp {
None => glib::ControlFlow::Break,
Some(window) => {
match window.imp().state.get() {
State::Idle | State::FileLoading | State::Seeking => {},
State::Idle | State::FileLoading | State::Seeking => {}
State::Active => window.notify("time-pos"),
other => unreachable!("{other:?}"),
}
@ -361,7 +361,10 @@ mod imp {
match self.state.get() {
State::Idle => 0.0,
State::FileLoading | State::FileEnded => self.song().unwrap().duration() as f64,
State::FileLoading | State::FileEnded => self
.song()
.map(|song| song.duration() as f64)
.unwrap_or(0.0),
State::FileLoaded | State::Active | State::Seeking => {
self.mpv.get_property::<f64>("duration").unwrap()