Compare commits
2 Commits
f7f55d74fd
...
c14b20b79e
Author | SHA1 | Date |
---|---|---|
Savanni D'Gerinel | c14b20b79e | |
Savanni D'Gerinel | 56ff5527ba |
|
@ -56,6 +56,9 @@ impl AppWindow {
|
|||
.width_request(800)
|
||||
.height_request(746)
|
||||
.build();
|
||||
window.connect_destroy(|s| {
|
||||
let _ = gtk::prelude::WidgetExt::activate_action(s, "app.quit", None);
|
||||
});
|
||||
|
||||
let stylesheet = String::from_utf8(
|
||||
resources_lookup_data(
|
||||
|
@ -83,10 +86,22 @@ impl AppWindow {
|
|||
|
||||
let initial_view = View::Placeholder(PlaceholderView::default().upcast());
|
||||
|
||||
let header_bar = adw::HeaderBar::new();
|
||||
|
||||
let main_menu = gio::Menu::new();
|
||||
main_menu.append(Some("Quit"), Some("app.quit"));
|
||||
let main_menu_button = gtk::MenuButton::builder()
|
||||
.icon_name("open-menu")
|
||||
.direction(gtk::ArrowType::Down)
|
||||
.halign(gtk::Align::End)
|
||||
.menu_model(&main_menu)
|
||||
.build();
|
||||
header_bar.pack_end(&main_menu_button);
|
||||
|
||||
layout.append(&initial_view.widget());
|
||||
|
||||
let nav_layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||
nav_layout.append(&adw::HeaderBar::new());
|
||||
nav_layout.append(&header_bar);
|
||||
nav_layout.append(&layout);
|
||||
navigation.push(
|
||||
&adw::NavigationPage::builder()
|
||||
|
|
|
@ -25,6 +25,8 @@ mod views;
|
|||
|
||||
use adw::prelude::*;
|
||||
use app_window::AppWindow;
|
||||
use components::ActionGroup;
|
||||
use gio::{Action, ActionEntry};
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
const APP_ID_DEV: &str = "com.luminescent-dreams.fitnesstrax.dev";
|
||||
|
@ -65,6 +67,14 @@ fn main() {
|
|||
let icon_theme = gtk::IconTheme::for_display(&gdk::Display::default().unwrap());
|
||||
icon_theme.add_resource_path(&(RESOURCE_BASE_PATH.to_owned() + "/icons/scalable/actions"));
|
||||
|
||||
let app_close_action = ActionEntry::builder("quit")
|
||||
.activate(|app: &adw::Application, _, _| {
|
||||
app.quit();
|
||||
})
|
||||
.build();
|
||||
adw_app.add_action_entries([app_close_action]);
|
||||
adw_app.set_accels_for_action("app.quit", &["<Ctrl>Q"]);
|
||||
|
||||
AppWindow::new(app_id, RESOURCE_BASE_PATH, adw_app, ft_app.clone());
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue