mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-15 00:48:52 +00:00
added libadwaita and added app icon
This commit is contained in:
parent
a2e0b6315f
commit
1b34ad7642
42
babylonia-terminal-gui/Cargo.lock
generated
42
babylonia-terminal-gui/Cargo.lock
generated
@ -69,6 +69,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"babylonia-terminal-sdk",
|
"babylonia-terminal-sdk",
|
||||||
|
"glib-build-tools",
|
||||||
"log",
|
"log",
|
||||||
"relm4",
|
"relm4",
|
||||||
"relm4-components",
|
"relm4-components",
|
||||||
@ -724,6 +725,15 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glib-build-tools"
|
||||||
|
version = "0.20.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7029c2651d9b5d5a3eea93ec8a1995665c6d3a69ce9bf6042ad9064d134736d8"
|
||||||
|
dependencies = [
|
||||||
|
"gio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glib-macros"
|
name = "glib-macros"
|
||||||
version = "0.20.5"
|
version = "0.20.5"
|
||||||
@ -1268,6 +1278,37 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libadwaita"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8611ee9fb85e7606c362b513afcaf5b59853f79e4d98caaaf581d99465014247"
|
||||||
|
dependencies = [
|
||||||
|
"gdk4",
|
||||||
|
"gio",
|
||||||
|
"glib",
|
||||||
|
"gtk4",
|
||||||
|
"libadwaita-sys",
|
||||||
|
"libc",
|
||||||
|
"pango",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libadwaita-sys"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b099a223560118d4d4fa04b6d23f3ea5b7171fe1d83dfb7e6b45b54cdfc83af9"
|
||||||
|
dependencies = [
|
||||||
|
"gdk4-sys",
|
||||||
|
"gio-sys",
|
||||||
|
"glib-sys",
|
||||||
|
"gobject-sys",
|
||||||
|
"gtk4-sys",
|
||||||
|
"libc",
|
||||||
|
"pango-sys",
|
||||||
|
"system-deps",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.168"
|
version = "0.2.168"
|
||||||
@ -1613,6 +1654,7 @@ dependencies = [
|
|||||||
"fragile",
|
"fragile",
|
||||||
"futures",
|
"futures",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
|
"libadwaita",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"relm4-css",
|
"relm4-css",
|
||||||
"relm4-macros",
|
"relm4-macros",
|
||||||
|
|||||||
@ -7,6 +7,9 @@ edition = "2021"
|
|||||||
babylonia-terminal-sdk = { path = "./../babylonia-terminal-sdk" }
|
babylonia-terminal-sdk = { path = "./../babylonia-terminal-sdk" }
|
||||||
anyhow = "1.0.94"
|
anyhow = "1.0.94"
|
||||||
log = "0.4.22"
|
log = "0.4.22"
|
||||||
relm4 = "0.9.1"
|
|
||||||
relm4-components = "0.9.1"
|
relm4-components = "0.9.1"
|
||||||
wincompatlib = "0.7.5"
|
wincompatlib = "0.7.5"
|
||||||
|
relm4 = { version = "0.9.1", features = ["libadwaita"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
glib-build-tools = "0.20.0"
|
||||||
|
|||||||
BIN
babylonia-terminal-gui/assets/icon.png
Normal file
BIN
babylonia-terminal-gui/assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 239 KiB |
7
babylonia-terminal-gui/assets/resources.xml
Normal file
7
babylonia-terminal-gui/assets/resources.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gresources>
|
||||||
|
<gresource prefix="/moe/celica/babylonia-terminal/icons/hicolor/scalable/apps">
|
||||||
|
<file alias="icon.png">icon.png</file>
|
||||||
|
</gresource>
|
||||||
|
</gresources>
|
||||||
5
babylonia-terminal-gui/build.rs
Normal file
5
babylonia-terminal-gui/build.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
use glib_build_tools::compile_resources;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
compile_resources(&["assets"], "assets/resources.xml", "resources.gresource");
|
||||||
|
}
|
||||||
@ -1,11 +1,22 @@
|
|||||||
use log::debug;
|
use log::debug;
|
||||||
use relm4::RelmApp;
|
use relm4::{
|
||||||
|
gtk::{self, gdk, gio},
|
||||||
|
RelmApp,
|
||||||
|
};
|
||||||
|
|
||||||
mod manager;
|
mod manager;
|
||||||
mod ui;
|
mod ui;
|
||||||
|
|
||||||
|
pub const APP_RESOURCE_PATH: &str = "/moe/celica/babylonia-terminal";
|
||||||
|
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
debug!("Start GUI!");
|
debug!("Start GUI!");
|
||||||
let app = RelmApp::new("moe.celica.BabyloniaTerminal").with_args(vec![]);
|
let app = RelmApp::new("moe.celica.BabyloniaTerminal").with_args(vec![]);
|
||||||
|
|
||||||
|
gio::resources_register_include!("resources.gresource").unwrap();
|
||||||
|
|
||||||
|
let display = gdk::Display::default().unwrap();
|
||||||
|
let theme = gtk::IconTheme::for_display(&display);
|
||||||
|
theme.add_resource_path(&format!("{APP_RESOURCE_PATH}/icons"));
|
||||||
ui::run(app);
|
ui::run(app);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ use crate::manager;
|
|||||||
use babylonia_terminal_sdk::game_state::GameState;
|
use babylonia_terminal_sdk::game_state::GameState;
|
||||||
|
|
||||||
use relm4::{
|
use relm4::{
|
||||||
|
adw::{self, ApplicationWindow},
|
||||||
gtk::{
|
gtk::{
|
||||||
self,
|
self,
|
||||||
prelude::{BoxExt, ButtonExt, GtkWindowExt, OrientableExt, WidgetExt},
|
prelude::{BoxExt, ButtonExt, GtkWindowExt, OrientableExt, WidgetExt},
|
||||||
@ -13,6 +14,8 @@ use relm4::{
|
|||||||
view, Component, RelmApp, RelmWidgetExt, WorkerController,
|
view, Component, RelmApp, RelmWidgetExt, WorkerController,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::APP_RESOURCE_PATH;
|
||||||
|
|
||||||
pub fn run(app: RelmApp<MainWindowMsg>) {
|
pub fn run(app: RelmApp<MainWindowMsg>) {
|
||||||
app.run_async::<MainWindow>(None);
|
app.run_async::<MainWindow>(None);
|
||||||
}
|
}
|
||||||
@ -50,11 +53,16 @@ impl SimpleAsyncComponent for MainWindow {
|
|||||||
|
|
||||||
view! {
|
view! {
|
||||||
#[root]
|
#[root]
|
||||||
gtk::Window {
|
adw::ApplicationWindow {
|
||||||
gtk::Box {
|
gtk::Box {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
set_orientation: gtk::Orientation::Vertical,
|
||||||
set_spacing: 5,
|
|
||||||
set_margin_all: 5,
|
adw::HeaderBar,
|
||||||
|
|
||||||
|
gtk::Image {
|
||||||
|
set_resource: Some(&format!("{APP_RESOURCE_PATH}/icons/hicolor/scalable/apps/icon.png")),
|
||||||
|
set_height_request: 256,
|
||||||
|
},
|
||||||
|
|
||||||
#[name(start_button)]
|
#[name(start_button)]
|
||||||
gtk::Button {
|
gtk::Button {
|
||||||
|
|||||||
42
babylonia-terminal/Cargo.lock
generated
42
babylonia-terminal/Cargo.lock
generated
@ -147,6 +147,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"babylonia-terminal-sdk",
|
"babylonia-terminal-sdk",
|
||||||
|
"glib-build-tools",
|
||||||
"log",
|
"log",
|
||||||
"relm4",
|
"relm4",
|
||||||
"relm4-components",
|
"relm4-components",
|
||||||
@ -905,6 +906,15 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glib-build-tools"
|
||||||
|
version = "0.20.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7029c2651d9b5d5a3eea93ec8a1995665c6d3a69ce9bf6042ad9064d134736d8"
|
||||||
|
dependencies = [
|
||||||
|
"gio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glib-macros"
|
name = "glib-macros"
|
||||||
version = "0.20.5"
|
version = "0.20.5"
|
||||||
@ -1474,6 +1484,37 @@ version = "1.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libadwaita"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8611ee9fb85e7606c362b513afcaf5b59853f79e4d98caaaf581d99465014247"
|
||||||
|
dependencies = [
|
||||||
|
"gdk4",
|
||||||
|
"gio",
|
||||||
|
"glib",
|
||||||
|
"gtk4",
|
||||||
|
"libadwaita-sys",
|
||||||
|
"libc",
|
||||||
|
"pango",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libadwaita-sys"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b099a223560118d4d4fa04b6d23f3ea5b7171fe1d83dfb7e6b45b54cdfc83af9"
|
||||||
|
dependencies = [
|
||||||
|
"gdk4-sys",
|
||||||
|
"gio-sys",
|
||||||
|
"glib-sys",
|
||||||
|
"gobject-sys",
|
||||||
|
"gtk4-sys",
|
||||||
|
"libc",
|
||||||
|
"pango-sys",
|
||||||
|
"system-deps",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.168"
|
version = "0.2.168"
|
||||||
@ -1875,6 +1916,7 @@ dependencies = [
|
|||||||
"fragile",
|
"fragile",
|
||||||
"futures",
|
"futures",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
|
"libadwaita",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"relm4-css",
|
"relm4-css",
|
||||||
"relm4-macros",
|
"relm4-macros",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user