aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRubén Beltrán del Río <jj@r.bdr.sh>2026-03-27 11:17:28 +0100
committerRubén Beltrán del Río <jj@r.bdr.sh>2026-03-27 12:22:36 +0100
commit2bebe9de998ba8475c89c608254c76d63206a214 (patch)
tree53e91f5d8c02650d48f26215d020e534137966f0 /src
parent1921e8c99d327518a4fd6fdb54928732bf21cd18 (diff)
Add about dialog
Diffstat (limited to 'src')
-rw-r--r--src/actions.rs3
-rw-r--r--src/components/header.rs7
-rw-r--r--src/main.rs25
3 files changed, 35 insertions, 0 deletions
diff --git a/src/actions.rs b/src/actions.rs
index 33289b1..09b7d4b 100644
--- a/src/actions.rs
+++ b/src/actions.rs
@@ -65,6 +65,9 @@ pub enum Action {
DisableHorizontalLayout,
EnableHorizontalLayout,
+ // Help and About
+ OpenAboutDialog,
+
// Preferences
ShowPreferences,
PreferencesChanged(UserPreferences),
diff --git a/src/components/header.rs b/src/components/header.rs
index 6c1055b..7977a5b 100644
--- a/src/components/header.rs
+++ b/src/components/header.rs
@@ -184,6 +184,13 @@ impl Header {
zoom_section.append(Some(&tr!("command.view.zoom_out")), Some("window.zoom-out"));
main_menu.append_section(None, &zoom_section);
+ let help_section = gio::Menu::new();
+ help_section.append(
+ Some(&tr!("command.application.about")),
+ Some("window.about"),
+ );
+ main_menu.append_section(None, &help_section);
+
let prefs_section = gio::Menu::new();
prefs_section.append(
Some(&tr!("command.application.preferences")),
diff --git a/src/main.rs b/src/main.rs
index cd71c94..655462c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -94,6 +94,7 @@ relm4::new_stateless_action!(
);
relm4::new_stateless_action!(ZoomInAction, WindowActionGroup, "zoom-in");
relm4::new_stateless_action!(ZoomOutAction, WindowActionGroup, "zoom-out");
+relm4::new_stateless_action!(AboutAction, WindowActionGroup, "about");
relm4::new_stateless_action!(PreferencesAction, WindowActionGroup, "preferences");
struct NewFromTemplateAction;
@@ -133,6 +134,7 @@ struct AppModel {
preferences_window: Option<relm4::Controller<preferences::PreferencesWindow>>,
editor_css_provider: gtk::CssProvider,
horizontal_layout_enabled: bool,
+
// Child Components
header: Controller<Header>,
footer: Controller<Footer>,
@@ -432,6 +434,7 @@ impl SimpleComponent for AppModel {
SaveAsAction => Action::SaveAs { close_after: false }, &["<Primary><Shift>s"];
OpenAction => Action::Open, &["<Primary>o"];
CloseAction => Action::CloseWindow, &["<Primary>w"];
+ AboutAction => Action::OpenAboutDialog, &[];
PreferencesAction => Action::ShowPreferences, &["<Primary>comma"]
]);
let layout_action = register_action!(
@@ -591,6 +594,28 @@ impl SimpleComponent for AppModel {
}
Action::EnableHorizontalLayout => handlers::view::change_horizontal_layout(self, true),
+ Action::OpenAboutDialog => {
+ adw::AboutDialog::builder()
+ .developers(
+ env!("CARGO_PKG_AUTHORS")
+ .split(':')
+ .map(String::from)
+ .collect::<Vec<_>>(),
+ )
+ .comments(tr!("about.comment"))
+ .copyright("© 2026 Rubén Beltrán del Río")
+ .license_type(gtk::License::Agpl30)
+ .application_icon("systems.tranquil.Map")
+ .application_name(env!("CARGO_PKG_NAME"))
+ .version(env!("CARGO_PKG_VERSION"))
+ .website(env!("CARGO_PKG_HOMEPAGE"))
+ .issue_url("https://todo.sr.ht/~rbdr/wmap")
+ .support_url("mailto:wmap@r.bdr.sh")
+ .visible(true)
+ .build()
+ .present(Some(&self.window));
+ },
+
// Preferences
Action::ShowPreferences => handlers::preferences::show(self, &sender),
Action::PreferencesChanged(preferences) => {