feat(title): add header button

This commit is contained in:
doryan 2024-08-17 21:43:19 +04:00
parent d8d9311841
commit 17098e6e88

View File

@ -6,12 +6,17 @@ use gtk4 as gtk;
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *};
use crate::view::{
components::{about::open_about_dialogue, info_bar::InfoBar, menu::HeaderMenu, pages::Pages},
components::{
dialogues::{open_about_dialogue, open_help_dialogue},
info_bar::InfoBar,
menu::HeaderMenu,
pages::Pages,
},
pages::*,
properties::*,
};
use super::styles::load_css;
use super::{components::MenuActions, styles::load_css};
pub fn ui(application: &adw::Application) {
load_css();
@ -56,8 +61,13 @@ pub fn ui(application: &adw::Application) {
let mut menu_button = HeaderMenu::<&str>::new();
let actions: &[MenuActions] = &[
(open_about_dialogue, "about_software", "О программе"),
(open_help_dialogue, "help", "Помощь"),
];
menu_button.set_action_group_name(Some("menu_group_action"));
menu_button.append_items([(open_about_dialogue, "about_software", "О программе")]);
menu_button.append_items(actions);
title_bar.append(
&Label::builder()
@ -65,7 +75,8 @@ pub fn ui(application: &adw::Application) {
.set_align(Alignment::new(Align::Center, Align::Center))
.hexpand(true)
.vexpand(true)
.label("Комплексная программа для лаб. работ")
.use_markup(true)
.label("<b>Комплексная программа для лаб. работ</b>")
.build(),
);
title_bar.append(menu_button.get_button());