Add minimal GTK4/libadwaita window with header bar and status page
This commit is contained in:
@@ -1,3 +1,38 @@
|
||||
use adw::prelude::*;
|
||||
|
||||
const APP_ID: &str = "live.lashman.Pixstrip";
|
||||
|
||||
fn main() {
|
||||
println!("Pixstrip GTK - v{}", pixstrip_core::version());
|
||||
let app = adw::Application::builder()
|
||||
.application_id(APP_ID)
|
||||
.build();
|
||||
|
||||
app.connect_activate(build_ui);
|
||||
app.run();
|
||||
}
|
||||
|
||||
fn build_ui(app: &adw::Application) {
|
||||
let header = adw::HeaderBar::new();
|
||||
|
||||
let title = adw::WindowTitle::new("Pixstrip", "Batch Image Processor");
|
||||
header.set_title_widget(Some(&title));
|
||||
|
||||
let content = adw::StatusPage::builder()
|
||||
.title("Pixstrip")
|
||||
.description(format!("v{}", pixstrip_core::version()).as_str())
|
||||
.icon_name("image-x-generic-symbolic")
|
||||
.build();
|
||||
|
||||
let toolbar_view = adw::ToolbarView::new();
|
||||
toolbar_view.add_top_bar(&header);
|
||||
toolbar_view.set_content(Some(&content));
|
||||
|
||||
let window = adw::ApplicationWindow::builder()
|
||||
.application(app)
|
||||
.default_width(900)
|
||||
.default_height(650)
|
||||
.content(&toolbar_view)
|
||||
.build();
|
||||
|
||||
window.present();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user