feat(app): set header title seperately from window title
This change will enable applications to set different titles for each
This commit is contained in:
parent
02413e5fa6
commit
9552916a59
2 changed files with 4 additions and 1 deletions
|
|
@ -13,6 +13,8 @@ pub struct NavBar {
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
|
/// Label to as title in headerbar.
|
||||||
|
pub header_title: String,
|
||||||
pub use_template: bool,
|
pub use_template: bool,
|
||||||
pub can_fullscreen: bool,
|
pub can_fullscreen: bool,
|
||||||
pub sharp_corners: bool,
|
pub sharp_corners: bool,
|
||||||
|
|
@ -58,6 +60,7 @@ impl Default for Core {
|
||||||
scale_factor: 1.0,
|
scale_factor: 1.0,
|
||||||
title: String::new(),
|
title: String::new(),
|
||||||
window: Window {
|
window: Window {
|
||||||
|
header_title: String::new(),
|
||||||
use_template: true,
|
use_template: true,
|
||||||
can_fullscreen: false,
|
can_fullscreen: false,
|
||||||
sharp_corners: false,
|
sharp_corners: false,
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ impl<App: Application> ApplicationExt for App {
|
||||||
.push_maybe(if core.window.show_headerbar {
|
.push_maybe(if core.window.show_headerbar {
|
||||||
Some({
|
Some({
|
||||||
let mut header = crate::widget::header_bar()
|
let mut header = crate::widget::header_bar()
|
||||||
.title(self.title())
|
.title(&core.window.header_title)
|
||||||
.on_drag(Message::Cosmic(cosmic::Message::Drag))
|
.on_drag(Message::Cosmic(cosmic::Message::Drag))
|
||||||
.on_close(Message::Cosmic(cosmic::Message::Close));
|
.on_close(Message::Cosmic(cosmic::Message::Close));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue