diff --git a/src/application.rs b/src/application.rs index 05a63b8..40a0951 100644 --- a/src/application.rs +++ b/src/application.rs @@ -1,8 +1,10 @@ +use crate::ui; +use adw::{prelude::*, subclass::prelude::*}; +use gtk::{gio, glib}; +use tracing::{event, Level}; + mod imp { - use crate::ui; - use adw::{prelude::*, subclass::prelude::*}; - use gtk::glib; - use tracing::{event, Level}; + use super::*; #[derive(Default)] pub struct Application {} @@ -46,8 +48,6 @@ mod imp { } } -use gtk::{gio, glib}; - glib::wrapper! { pub struct Application(ObjectSubclass) @extends adw::Application, gtk::Application, gio::Application, diff --git a/src/model/album.rs b/src/model/album.rs index 4366104..eac8687 100644 --- a/src/model/album.rs +++ b/src/model/album.rs @@ -1,8 +1,10 @@ +use adw::prelude::*; +use gtk::glib; +use gtk::subclass::prelude::*; +use std::cell::RefCell; + mod imp { - use adw::prelude::*; - use gtk::glib; - use gtk::subclass::prelude::*; - use std::cell::RefCell; + use super::*; #[derive(glib::Properties, Default)] #[properties(wrapper_type = super::Album)] @@ -25,8 +27,6 @@ mod imp { impl ObjectImpl for Album {} } -use gtk::glib; - glib::wrapper! { pub struct Album(ObjectSubclass); } diff --git a/src/model/song.rs b/src/model/song.rs index 2f00833..eb96184 100644 --- a/src/model/song.rs +++ b/src/model/song.rs @@ -1,8 +1,12 @@ +use crate::subsonic; +use adw::{prelude::*, subclass::prelude::*}; +use gtk::{gdk, glib, glib::Object}; +use std::cell::{Cell, RefCell}; +use tokio::sync::Semaphore; +use tracing::{event, Level}; + mod imp { - use adw::prelude::*; - use gtk::subclass::prelude::*; - use gtk::{gdk, glib}; - use std::cell::{Cell, RefCell}; + use super::*; static NEXT_COUNTER: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); @@ -60,13 +64,6 @@ mod imp { } } -use crate::subsonic; -use adw::{prelude::*, subclass::prelude::*}; -use glib::Object; -use gtk::{gdk, glib}; -use tokio::sync::Semaphore; -use tracing::{event, Level}; - // only fetch 20 thumbnails at a time static SEM: Semaphore = Semaphore::const_new(20); diff --git a/src/ui/play_queue.rs b/src/ui/play_queue.rs index bcff8e2..782966d 100644 --- a/src/ui/play_queue.rs +++ b/src/ui/play_queue.rs @@ -1,11 +1,12 @@ pub mod song; +use adw::{gdk, gio, glib, prelude::*, subclass::prelude::*}; +use glib::{subclass::InitializingObject, WeakRef}; pub use song::Song; +use std::cell::{Cell, RefCell}; +use tracing::{event, Level}; mod imp { - use adw::{gdk, gio, glib, prelude::*, subclass::prelude::*}; - use glib::{subclass::InitializingObject, WeakRef}; - use std::cell::{Cell, RefCell}; - use tracing::{event, Level}; + use super::*; #[derive(gtk::CompositeTemplate, glib::Properties, Default)] #[template(resource = "/eu/callcc/audrey/play_queue.ui")] @@ -102,8 +103,6 @@ mod imp { } } -use adw::prelude::*; -use gtk::glib; glib::wrapper! { pub struct PlayQueue(ObjectSubclass) diff --git a/src/ui/play_queue/song.rs b/src/ui/play_queue/song.rs index ec1b229..7e4391a 100644 --- a/src/ui/play_queue/song.rs +++ b/src/ui/play_queue/song.rs @@ -1,8 +1,11 @@ +use crate::model::Song as ModelSong; +use adw::prelude::*; +use glib::subclass::InitializingObject; +use gtk::{gdk, gio, glib, subclass::prelude::*}; +use std::cell::{Cell, RefCell}; + mod imp { - use crate::model::Song as ModelSong; - use glib::subclass::InitializingObject; - use gtk::{gdk, gio, glib, prelude::*, subclass::prelude::*}; - use std::cell::{Cell, RefCell}; + use super::*; #[derive(gtk::CompositeTemplate, glib::Properties, Default)] #[template(resource = "/eu/callcc/audrey/play_queue_song.ui")] @@ -174,10 +177,6 @@ mod imp { } } -use crate::model::Song as ModelSong; -use adw::prelude::*; -use gtk::glib; - glib::wrapper! { pub struct Song(ObjectSubclass) @extends gtk::Box, gtk::Widget, diff --git a/src/ui/playbar.rs b/src/ui/playbar.rs index a64903c..af5277f 100644 --- a/src/ui/playbar.rs +++ b/src/ui/playbar.rs @@ -1,11 +1,13 @@ +use crate::model::Song; +use adw::prelude::*; +use adw::subclass::prelude::*; +use glib::subclass::InitializingObject; +use gtk::{gdk, glib}; +use std::cell::{Cell, RefCell}; +use tracing::{event, Level}; + mod imp { - use crate::model::Song; - use adw::prelude::*; - use adw::subclass::prelude::*; - use glib::subclass::InitializingObject; - use gtk::{gdk, glib}; - use std::cell::{Cell, RefCell}; - use tracing::{event, Level}; + use super::*; #[derive(glib::Properties, gtk::CompositeTemplate, Default)] #[properties(wrapper_type = super::Playbar)] @@ -169,8 +171,6 @@ mod imp { } } -use gtk::glib; - glib::wrapper! { pub struct Playbar(ObjectSubclass) @extends adw::Bin, gtk::Widget, diff --git a/src/ui/setup.rs b/src/ui/setup.rs index f09f8af..1ca5da1 100644 --- a/src/ui/setup.rs +++ b/src/ui/setup.rs @@ -1,9 +1,11 @@ +use adw::{glib, prelude::*, subclass::prelude::*}; +use glib::subclass::InitializingObject; +use glib::WeakRef; +use std::cell::{Cell, RefCell}; +use tracing::{event, Level}; + mod imp { - use adw::{glib, prelude::*, subclass::prelude::*}; - use glib::subclass::InitializingObject; - use glib::WeakRef; - use std::cell::{Cell, RefCell}; - use tracing::{event, Level}; + use super::*; #[derive(gtk::CompositeTemplate, glib::Properties, Default)] #[template(resource = "/eu/callcc/audrey/setup.ui")] @@ -123,10 +125,6 @@ mod imp { } } -use adw::subclass::prelude::*; -use gtk::glib; -use tracing::{event, Level}; - glib::wrapper! { pub struct Setup(ObjectSubclass) @extends adw::PreferencesDialog, adw::Dialog, gtk::Widget, diff --git a/src/ui/window.rs b/src/ui/window.rs index 3bb1cd8..9e75bca 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -1,15 +1,18 @@ +use crate::model::{Album, Song}; +use crate::{mpris, mpv}; +use adw::prelude::*; +use adw::subclass::prelude::*; +use futures::TryStreamExt; +use glib::subclass::InitializingObject; +use glib::JoinHandle; +use gtk::{gdk, gio, glib}; +use std::cell::{Cell, RefCell}; +use std::rc::Rc; +use tracing::{event, span, Level}; +use zbus::object_server::InterfaceRef; + mod imp { - use crate::model::{Album, Song}; - use crate::{mpris, mpv}; - use adw::prelude::*; - use adw::subclass::prelude::*; - use glib::subclass::InitializingObject; - use glib::JoinHandle; - use gtk::{gdk, gio, glib}; - use std::cell::{Cell, RefCell}; - use std::rc::Rc; - use tracing::{event, span, Level}; - use zbus::object_server::InterfaceRef; + use super::*; #[derive(Debug, Copy, Clone)] pub(super) enum State { @@ -178,9 +181,7 @@ mod imp { gtk::style_context_add_provider_for_display(&display, &self.css_provider, 420); } - use gio::ActionEntry; - - let action_seek_backward = ActionEntry::builder("seek-backward") + let action_seek_backward = gio::ActionEntry::builder("seek-backward") .activate(glib::clone!( #[weak(rename_to = window)] self.obj(), @@ -190,7 +191,7 @@ mod imp { )) .build(); - let action_seek_forward = ActionEntry::builder("seek-forward") + let action_seek_forward = gio::ActionEntry::builder("seek-forward") .activate(glib::clone!( #[weak(rename_to = window)] self.obj(), @@ -798,8 +799,6 @@ mod imp { let api = Rc::clone(self.api.borrow().as_ref().unwrap()); let albums_model = self.obj().albums_model().clone(); let perform = async move { - use futures::TryStreamExt; - let mut albums = std::pin::pin!(api.album_list_full(crate::subsonic::AlbumListType::Newest)); while let Some(album) = albums.try_next().await? { @@ -841,12 +840,6 @@ mod imp { } } -use adw::prelude::*; -use adw::subclass::prelude::*; -use gtk::{gio, glib}; -use std::rc::Rc; -use tracing::{event, Level}; - glib::wrapper! { pub struct Window(ObjectSubclass) @extends adw::ApplicationWindow, gtk::ApplicationWindow, gtk::Window, gtk::Widget,