From 5002eee67ae3b80287558fed298681b3d30b77fa Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Sun, 8 Nov 2020 00:16:56 +0100 Subject: [PATCH] Add about dialog --- po/POTFILES.in | 1 + po/de.po | 18 +++++++++++++++--- po/musicus.pot | 16 ++++++++++++++-- res/ui/window.ui | 4 ++++ src/config.rs.in | 1 + src/dialogs/about.rs | 22 ++++++++++++++++++++++ src/dialogs/mod.rs | 3 +++ src/meson.build | 2 ++ src/window.rs | 8 ++++++++ 9 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 src/dialogs/about.rs diff --git a/po/POTFILES.in b/po/POTFILES.in index 98f5b25..ff1c22f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -30,6 +30,7 @@ src/database/models.rs src/database/mod.rs src/database/schema.rs src/database/tables.rs +src/dialogs/about.rs src/dialogs/ensemble_editor.rs src/dialogs/ensemble_selector.rs src/dialogs/instrument_editor.rs diff --git a/po/de.po b/po/de.po index 7de1666..7b0a7c2 100644 --- a/po/de.po +++ b/po/de.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-07 20:26+0100\n" -"PO-Revision-Date: 2020-11-07 20:27+0100\n" +"POT-Creation-Date: 2020-11-08 00:09+0100\n" +"PO-Revision-Date: 2020-11-08 00:12+0100\n" "Last-Translator: \n" "Language-Team: \n" "Language: de\n" @@ -266,7 +266,7 @@ msgstr "" "Legen Sie los, indem Sie etwas in der Seitenleiste auswählen oder fügen Sie " "mit dem Knopf oben links neue Aufnahmen zu Ihrer Musikbibliothek hinzu." -#: res/ui/window.ui:104 res/ui/window.ui:252 +#: res/ui/window.ui:104 res/ui/window.ui:252 src/dialogs/about.rs:10 msgid "Musicus" msgstr "Musicus" @@ -287,6 +287,10 @@ msgstr "Ordner auswählen" msgid "Preferences" msgstr "Einstellungen" +#: res/ui/window.ui:335 +msgid "About Musicus" +msgstr "Über Musicus" + #: res/ui/work_editor.ui:264 msgid "No work parts added." msgstr "Keine Werkabschnitte hinzugefügt." @@ -307,6 +311,14 @@ msgstr "Werk auswählen" msgid "Search works …" msgstr "Werke durchsuchen …" +#: src/dialogs/about.rs:12 +msgid "The classical music player and organizer." +msgstr "Das Programm zum Abspielen und Organisieren von Klassik." + +#: src/dialogs/about.rs:14 +msgid "Further information and source code" +msgstr "Weitere Informationen und Quellcode" + #: src/dialogs/preferences.rs:30 src/window.rs:70 msgid "Select music library folder" msgstr "Ordner der Musikbibliothek auswählen" diff --git a/po/musicus.pot b/po/musicus.pot index 27f628c..525ba55 100644 --- a/po/musicus.pot +++ b/po/musicus.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: musicus\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-07 20:26+0100\n" +"POT-Creation-Date: 2020-11-08 00:09+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -263,7 +263,7 @@ msgid "" "your library using the button in the top left corner." msgstr "" -#: res/ui/window.ui:104 res/ui/window.ui:252 +#: res/ui/window.ui:104 res/ui/window.ui:252 src/dialogs/about.rs:10 msgid "Musicus" msgstr "" @@ -281,6 +281,10 @@ msgstr "" msgid "Preferences" msgstr "" +#: res/ui/window.ui:335 +msgid "About Musicus" +msgstr "" + #: res/ui/work_editor.ui:264 msgid "No work parts added." msgstr "" @@ -301,6 +305,14 @@ msgstr "" msgid "Search works …" msgstr "" +#: src/dialogs/about.rs:12 +msgid "The classical music player and organizer." +msgstr "" + +#: src/dialogs/about.rs:14 +msgid "Further information and source code" +msgstr "" + #: src/dialogs/preferences.rs:30 src/window.rs:70 msgid "Select music library folder" msgstr "" diff --git a/res/ui/window.ui b/res/ui/window.ui index 3bf0610..daf26ef 100644 --- a/res/ui/window.ui +++ b/res/ui/window.ui @@ -331,6 +331,10 @@ Preferences win.preferences + + About Musicus + win.about + diff --git a/src/config.rs.in b/src/config.rs.in index 9a3de2e..be48dba 100644 --- a/src/config.rs.in +++ b/src/config.rs.in @@ -1 +1,2 @@ +pub static VERSION: &str = @VERSION@; pub static LOCALEDIR: &str = @LOCALEDIR@; \ No newline at end of file diff --git a/src/dialogs/about.rs b/src/dialogs/about.rs new file mode 100644 index 0000000..147d179 --- /dev/null +++ b/src/dialogs/about.rs @@ -0,0 +1,22 @@ +use crate::config; +use gettextrs::gettext; +use gtk::prelude::*; + +pub fn show_about_dialog>(parent: &W) { + let dialog = gtk::AboutDialogBuilder::new() + .transient_for(parent) + .modal(true) + .logo_icon_name("de.johrpan.musicus") + .program_name(&gettext("Musicus")) + .version(config::VERSION) + .comments(&gettext("The classical music player and organizer.")) + .website("https://github.com/johrpan/musicus") + .website_label(&gettext("Further information and source code")) + .copyright("© 2020 Elias Projahn") + .license_type(gtk::License::Agpl30) + .authors(vec![String::from("Elias Projahn ")]) + .build(); + + dialog.connect_response(|dialog, _| dialog.close()); + dialog.show(); +} diff --git a/src/dialogs/mod.rs b/src/dialogs/mod.rs index 86bbb6f..e8784f7 100644 --- a/src/dialogs/mod.rs +++ b/src/dialogs/mod.rs @@ -1,3 +1,6 @@ +pub mod about; +pub use about::*; + pub mod ensemble_editor; pub use ensemble_editor::*; diff --git a/src/meson.build b/src/meson.build index 2660253..aa53a58 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,6 +3,7 @@ localedir = join_paths(prefix, get_option('localedir')) global_conf = configuration_data() global_conf.set_quoted('LOCALEDIR', localedir) +global_conf.set_quoted('VERSION', meson.project_version()) config_rs = configure_file( input: 'config.rs.in', output: 'config.rs', @@ -37,6 +38,7 @@ sources = files( 'database/models.rs', 'database/schema.rs', 'database/tables.rs', + 'dialogs/about.rs', 'dialogs/ensemble_editor.rs', 'dialogs/ensemble_selector.rs', 'dialogs/instrument_editor.rs', diff --git a/src/window.rs b/src/window.rs index 28a4eba..fe95daa 100644 --- a/src/window.rs +++ b/src/window.rs @@ -110,6 +110,14 @@ impl Window { }) ); + action!( + result.window, + "about", + clone!(@strong result => move |_, _| { + show_about_dialog(&result.window); + }) + ); + action!( result.window, "add-person",