37 lines
712 B
Rust
Raw Normal View History

2024-09-20 18:02:10 +03:00
mod subject;
mod tray;
2024-09-18 20:33:29 +03:00
2024-09-23 18:51:48 +03:00
use subject::Subject;
use tray::Tray;
2024-09-25 22:19:48 +03:00
use gtk::{glib::GString, HeaderBar};
2024-09-24 23:08:40 +03:00
2024-09-22 12:38:13 +03:00
pub struct Header {
2024-09-23 18:51:48 +03:00
widget: HeaderBar,
2024-09-25 22:19:48 +03:00
subject: Subject,
2024-09-22 12:38:13 +03:00
}
impl Header {
// Construct
2024-09-26 00:59:44 +03:00
pub fn new() -> Header {
2024-09-23 18:51:48 +03:00
let tray = Tray::new();
let subject = Subject::new();
let widget = HeaderBar::builder().build();
widget.pack_start(tray.widget());
widget.set_title_widget(Some(subject.widget()));
2024-09-26 00:59:44 +03:00
Self { widget, subject }
2024-09-25 22:19:48 +03:00
}
// Actions
pub fn update(&self, title: GString, description: GString) {
self.subject.update(title, description);
}
2024-09-19 11:29:03 +03:00
// Getters
2024-09-23 18:51:48 +03:00
pub fn widget(&self) -> &HeaderBar {
&self.widget
}
2024-09-20 18:02:10 +03:00
}