Compare commits

...

7 commits

10 changed files with 74 additions and 45 deletions

1
Cargo.lock generated
View file

@ -1880,7 +1880,6 @@ dependencies = [
"glib", "glib",
"gstreamer-play", "gstreamer-play",
"gtk4", "gtk4",
"lazy_static",
"libadwaita", "libadwaita",
"log", "log",
"mpris-server", "mpris-server",

View file

@ -17,7 +17,6 @@ gettext-rs = { version = "0.7", features = ["gettext-system"] }
glib = { version = "0.20", features = ["v2_84"] } glib = { version = "0.20", features = ["v2_84"] }
gstreamer-play = "0.23" gstreamer-play = "0.23"
gtk = { package = "gtk4", version = "0.9", features = ["v4_18", "blueprint"] } gtk = { package = "gtk4", version = "0.9", features = ["v4_18", "blueprint"] }
lazy_static = "1"
log = "0.4" log = "0.4"
mpris-server = "0.8" mpris-server = "0.8"
once_cell = "1" once_cell = "1"

View file

@ -6,6 +6,14 @@
font-size: smaller; font-size: smaller;
} }
.rounded-entry {
border-radius: 999px;
padding-left: 12px;
padding-right: 12px;
padding-top: 3px;
padding-bottom: 3px;
}
.searchbar .searchtag { .searchbar .searchtag {
background-color: alpha(currentColor, 0.1); background-color: alpha(currentColor, 0.1);
border-radius: 100px; border-radius: 100px;

View file

@ -78,6 +78,10 @@ template $MusicusSearchPage: Adw.NavigationPage {
placeholder-text: _("Enter composers, performers, works…"); placeholder-text: _("Enter composers, performers, works…");
margin-top: 24; margin-top: 24;
activate => $select() swapped; activate => $select() swapped;
styles [
"rounded-entry"
]
} }
Gtk.Stack stack { Gtk.Stack stack {

View file

@ -5,7 +5,7 @@
"sdk": "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"sdk-extensions": [ "sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable", "org.freedesktop.Sdk.Extension.rust-stable",
"org.freedesktop.Sdk.Extension.llvm18" "org.freedesktop.Sdk.Extension.llvm20"
], ],
"command": "musicus", "command": "musicus",
"finish-args": [ "finish-args": [
@ -20,7 +20,7 @@
"--env=G_MESSAGES_DEBUG=none" "--env=G_MESSAGES_DEBUG=none"
], ],
"build-options": { "build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm18/bin", "append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm20/bin",
"build-args": [ "build-args": [
"--share=network" "--share=network"
], ],
@ -31,17 +31,6 @@
} }
}, },
"modules": [ "modules": [
{
"name": "blueprint-compiler",
"buildsystem": "meson",
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler.git",
"tag": "v0.16.0"
}
]
},
{ {
"name": "musicus", "name": "musicus",
"buildsystem": "meson", "buildsystem": "meson",

View file

@ -5,7 +5,7 @@
"sdk": "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"sdk-extensions": [ "sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable", "org.freedesktop.Sdk.Extension.rust-stable",
"org.freedesktop.Sdk.Extension.llvm18" "org.freedesktop.Sdk.Extension.llvm20"
], ],
"command": "musicus", "command": "musicus",
"finish-args": [ "finish-args": [
@ -20,7 +20,7 @@
"--env=G_MESSAGES_DEBUG=none" "--env=G_MESSAGES_DEBUG=none"
], ],
"build-options": { "build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm18/bin", "append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm20/bin",
"build-args": [ "build-args": [
"--share=network" "--share=network"
], ],

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-27 17:54+0200\n" "POT-Creation-Date: 2025-05-30 15:27+0200\n"
"PO-Revision-Date: 2025-04-27 18:23+0200\n" "PO-Revision-Date: 2025-04-27 18:23+0200\n"
"Last-Translator: elias@johrpan.de\n" "Last-Translator: elias@johrpan.de\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n" "Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
@ -818,7 +818,7 @@ msgstr "Bibliothek exportieren"
msgid "Exporting music library to {}" msgid "Exporting music library to {}"
msgstr "Bibliothek wird nach {} exportiert" msgstr "Bibliothek wird nach {} exportiert"
#: src/library_manager.rs:234 src/window.rs:282 #: src/library_manager.rs:234 src/window.rs:305
msgid "Updating metadata" msgid "Updating metadata"
msgstr "Metadaten werden aktualisiert" msgstr "Metadaten werden aktualisiert"
@ -826,19 +826,23 @@ msgstr "Metadaten werden aktualisiert"
msgid "Updating music library" msgid "Updating music library"
msgstr "Musikbibliothek wird aktualisiert" msgstr "Musikbibliothek wird aktualisiert"
#: src/window.rs:167 #: src/window.rs:166
msgid "Currently playing music"
msgstr "Musik wird abgespielt"
#: src/window.rs:190
msgid "Close window?" msgid "Close window?"
msgstr "Fenster schließen?" msgstr "Fenster schließen?"
#: src/window.rs:169 #: src/window.rs:192
msgid "There are ongoing processes that will be canceled." msgid "There are ongoing processes that will be canceled."
msgstr "Es gibt laufende Prozesse, die abgebrochen werden." msgstr "Es gibt laufende Prozesse, die abgebrochen werden."
#: src/window.rs:174 #: src/window.rs:197
msgid "Keep open" msgid "Keep open"
msgstr "Nicht schließen" msgstr "Nicht schließen"
#: src/window.rs:175 #: src/window.rs:198
msgid "Close window" msgid "Close window"
msgstr "Fenster schließen" msgstr "Fenster schließen"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-27 17:54+0200\n" "POT-Creation-Date: 2025-05-30 15:27+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -784,7 +784,7 @@ msgstr ""
msgid "Exporting music library to {}" msgid "Exporting music library to {}"
msgstr "" msgstr ""
#: src/library_manager.rs:234 src/window.rs:282 #: src/library_manager.rs:234 src/window.rs:305
msgid "Updating metadata" msgid "Updating metadata"
msgstr "" msgstr ""
@ -792,18 +792,22 @@ msgstr ""
msgid "Updating music library" msgid "Updating music library"
msgstr "" msgstr ""
#: src/window.rs:167 #: src/window.rs:166
msgid "Currently playing music"
msgstr ""
#: src/window.rs:190
msgid "Close window?" msgid "Close window?"
msgstr "" msgstr ""
#: src/window.rs:169 #: src/window.rs:192
msgid "There are ongoing processes that will be canceled." msgid "There are ongoing processes that will be canceled."
msgstr "" msgstr ""
#: src/window.rs:174 #: src/window.rs:197
msgid "Keep open" msgid "Keep open"
msgstr "" msgstr ""
#: src/window.rs:175 #: src/window.rs:198
msgid "Close window" msgid "Close window"
msgstr "" msgstr ""

View file

@ -2,15 +2,15 @@ pub mod activatable_row;
pub mod drag_widget; pub mod drag_widget;
pub mod error_dialog; pub mod error_dialog;
use std::sync::LazyLock;
use gettextrs::gettext; use gettextrs::gettext;
use gtk::glib::{self, clone}; use gtk::glib::{self, clone};
use lazy_static::lazy_static;
use error_dialog::ErrorDialog; use error_dialog::ErrorDialog;
lazy_static! {
/// The user's language code. /// The user's language code.
pub static ref LANG: String = { pub static LANG: LazyLock<String> = LazyLock::new(|| {
let lang = match glib::language_names().first() { let lang = match glib::language_names().first() {
Some(language_name) => match language_name.split('_').next() { Some(language_name) => match language_name.split('_').next() {
Some(lang) => lang.to_string(), Some(lang) => lang.to_string(),
@ -21,8 +21,7 @@ lazy_static! {
log::info!("Intialized user language to '{lang}'."); log::info!("Intialized user language to '{lang}'.");
lang lang
}; });
}
/// Create and show an error toast. This will also log the error to the console. /// Create and show an error toast. This will also log the error to the console.
pub fn error_toast(msgid: &str, err: anyhow::Error, toast_overlay: &adw::ToastOverlay) { pub fn error_toast(msgid: &str, err: anyhow::Error, toast_overlay: &adw::ToastOverlay) {

View file

@ -1,4 +1,7 @@
use std::{cell::RefCell, path::Path}; use std::{
cell::{Cell, RefCell},
path::Path,
};
use adw::{prelude::*, subclass::prelude::*}; use adw::{prelude::*, subclass::prelude::*};
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
@ -31,6 +34,7 @@ mod imp {
pub library: RefCell<Option<Library>>, pub library: RefCell<Option<Library>>,
pub player: Player, pub player: Player,
pub process_manager: ProcessManager, pub process_manager: ProcessManager,
pub inhibitor_cookie: Cell<Option<u32>>,
#[template_child] #[template_child]
pub toast_overlay: TemplateChild<adw::ToastOverlay>, pub toast_overlay: TemplateChild<adw::ToastOverlay>,
@ -148,6 +152,25 @@ mod imp {
let obj = self.obj().to_owned(); let obj = self.obj().to_owned();
self.player.connect_raise(move |_| obj.present()); self.player.connect_raise(move |_| obj.present());
let obj = self.obj().to_owned();
self.player.connect_playing_notify(move |player| {
if let Some(app) = obj.application() {
if let Some(cookie) = obj.imp().inhibitor_cookie.take() {
app.uninhibit(cookie);
};
if player.playing() {
let cookie = app.inhibit(
Some(&obj),
gtk::ApplicationInhibitFlags::SUSPEND,
Some(&gettext("Currently playing music")),
);
obj.imp().inhibitor_cookie.set(Some(cookie));
}
}
});
let settings = gio::Settings::new(config::APP_ID); let settings = gio::Settings::new(config::APP_ID);
let library_path = settings.string("library-path").to_string(); let library_path = settings.string("library-path").to_string();
if !library_path.is_empty() { if !library_path.is_empty() {