mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-03-15 14:38:29 +03:00
Added about dialog
This commit is contained in:
parent
b1b6f2d68e
commit
c7c0c3d9dc
6 changed files with 52 additions and 4 deletions
|
@ -1 +1 @@
|
|||
Subproject commit ccb2f2082ad278cce946ebd960e4a065368babaf
|
||||
Subproject commit 02b1fabc36807b1e9411ff32f84a991fbcbc949b
|
|
@ -20,6 +20,15 @@ Adw.ApplicationWindow window {
|
|||
title-widget: Adw.WindowTitle {
|
||||
title: "An Anime Game Launcher";
|
||||
};
|
||||
|
||||
[end]
|
||||
Gtk.MenuButton menu {
|
||||
menu-model: app_menu;
|
||||
icon-name: "open-menu-symbolic";
|
||||
halign: end;
|
||||
valign: center;
|
||||
margin-start: 12;
|
||||
}
|
||||
}
|
||||
|
||||
Adw.StatusPage status_page {
|
||||
|
@ -101,3 +110,18 @@ Adw.ApplicationWindow window {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
Gtk.AboutDialog about {
|
||||
program-name: "An Anime Game Launcher";
|
||||
|
||||
logo: "resource:///org/app/assets/images/icon.png";
|
||||
website: "https://gitlab.com/an-anime-team/alternatives/an-anime-game-launcher-gtk";
|
||||
|
||||
modal: true;
|
||||
transient-for: window;
|
||||
}
|
||||
|
||||
menu app_menu {
|
||||
item ("Check for updates")
|
||||
item ("About", "show-about-dialog.show-about-dialog")
|
||||
}
|
||||
|
|
|
@ -128,7 +128,6 @@ Adw.PreferencesPage general_page {
|
|||
|
||||
Adw.ComboRow dxvk_selected {
|
||||
title: "Selected version";
|
||||
subtitle: "WIP: does nothing as for now";
|
||||
}
|
||||
|
||||
Adw.ActionRow {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 30f0deea34851aa6fbb4f8a5dcd9216f5ac714f9
|
||||
Subproject commit 50db59f2d2c88fe0ee2fc979e11e7c989eaa07da
|
|
@ -8,6 +8,9 @@ pub mod lib;
|
|||
|
||||
use ui::*;
|
||||
|
||||
pub const APP_ID: &str = "com.gitlab.an-anime-team.an-anime-game-launcher-gtk";
|
||||
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
gtk::init().expect("GTK initialization failed");
|
||||
|
@ -19,7 +22,7 @@ async fn main() {
|
|||
|
||||
// Create app
|
||||
let application = gtk::Application::new(
|
||||
Some("com.gitlab.an-anime-team.an-anime-game-launcher-gtk"),
|
||||
Some(APP_ID),
|
||||
Default::default()
|
||||
);
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ pub struct AppWidgets {
|
|||
pub window: adw::ApplicationWindow,
|
||||
pub toast_overlay: adw::ToastOverlay,
|
||||
|
||||
pub menu: gtk::MenuButton,
|
||||
pub about: gtk::AboutDialog,
|
||||
|
||||
pub leaflet: adw::Leaflet,
|
||||
pub status_page: adw::StatusPage,
|
||||
pub launcher_content: adw::PreferencesPage,
|
||||
|
@ -54,6 +57,9 @@ impl AppWidgets {
|
|||
window: window.clone(),
|
||||
toast_overlay: toast_overlay.clone(),
|
||||
|
||||
menu: get_object(&builder, "menu")?,
|
||||
about: get_object(&builder, "about")?,
|
||||
|
||||
leaflet: get_object(&builder, "leaflet")?,
|
||||
status_page: get_object(&builder, "status_page")?,
|
||||
launcher_content: get_object(&builder, "launcher_content")?,
|
||||
|
@ -68,6 +74,18 @@ impl AppWidgets {
|
|||
preferences_stack: PreferencesStack::new(window, toast_overlay)?
|
||||
};
|
||||
|
||||
// Set default About Dialog values
|
||||
result.about.set_version(Some(crate::APP_VERSION));
|
||||
result.about.set_license_type(gtk::License::Gpl30);
|
||||
|
||||
result.about.set_authors(&[
|
||||
"Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>"
|
||||
]);
|
||||
|
||||
result.about.set_system_information(Some(&[
|
||||
format!("Anime Game core library version: {}", anime_game_core::VERSION)
|
||||
].join("\n")));
|
||||
|
||||
// Add preferences page to the leaflet
|
||||
result.leaflet.append(&result.preferences_stack.preferences).set_name(Some("preferences_page"));
|
||||
|
||||
|
@ -145,6 +163,10 @@ impl App {
|
|||
|
||||
/// Add default events and values to the widgets
|
||||
fn init_events(self) -> Self {
|
||||
add_action(&self.widgets.menu, "show-about-dialog", clone!(@strong self.widgets.about as about => move || {
|
||||
about.show();
|
||||
}));
|
||||
|
||||
// Open preferences page
|
||||
self.widgets.open_preferences.connect_clicked(Actions::OpenPreferencesPage.into_fn(&self));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue