Compare commits

..

No commits in common. "d37ec6a19a186c297dfa7f8e22064c988543bb8e" and "2f322774c90804a7dbe779a7de5b1841f8b186a4" have entirely different histories.

4 changed files with 15 additions and 19 deletions

View file

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

View file

@ -17,19 +17,15 @@ mod imp {
impl ObjectImpl for Application {} impl ObjectImpl for Application {}
impl ApplicationImpl 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) { fn activate(&self) {
self.parent_activate(); self.parent_activate();
self.obj() match self.obj().active_window() {
.active_window() None => {
.expect("no window was active") let window = ui::Window::new(self.obj().as_ref());
.present(); window.present();
}
Some(win) => win.present(),
}
} }
} }

View file

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

View file

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